fix: sanitize all secure keys in config

Check and remove all the secure keys in the site Mermaid Config,
not just `securityLevel`. Unfortunately, the logic of Mermaid's
`sanitize` function in `config.ts` is a bit convoluted. For instance,
the `secure` config restricts keys deeply in the object.

See: https://github.com/mermaid-js/mermaid/blob/9745f325cb9e1967640f0e85da193a2f820634f1/packages/mermaid/src/config.ts#L155-L190
This commit is contained in:
Alois Klink
2026-04-02 19:00:54 +09:00
parent 48b9560e8e
commit 7e9cdfca73
3 changed files with 60 additions and 7 deletions
+3 -1
View File
@@ -83,7 +83,8 @@ test.describe('Site Loads', () => {
config: `data:application/json,${encodeURIComponent(
JSON.stringify({
someOtherSetting: 'Test value',
securityLevel: 'loose'
securityLevel: 'loose',
secure: []
})
)}`
}).toString()}`
@@ -99,6 +100,7 @@ test.describe('Site Loads', () => {
});
// should scrub unsafe securityLevel but keep other settings
expect(parsedConfig.securityLevel).toBeUndefined();
expect(parsedConfig.secure).toBeUndefined();
});
test('should show troubleshooting steps if loading fails', async ({ editPage, page }) => {