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:
@@ -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 }) => {
|
||||
|
||||
Reference in New Issue
Block a user