Skip to content

Commit a6aff08

Browse files
committed
add regression test
1 parent 9f720b5 commit a6aff08

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

packages/core/test/lib/utils/normalize.test.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,27 @@ describe('normalize()', () => {
655655
});
656656
});
657657

658+
describe('regression: JSON cannot spoof skip-normalization via string keys', () => {
659+
test('__sentry_skip_normalization__ as an own string property is still normalized', () => {
660+
function someFun(): void {
661+
/* no-empty */
662+
}
663+
const jsonLikePayload = {
664+
__sentry_skip_normalization__: true,
665+
nan: NaN,
666+
fun: someFun,
667+
};
668+
669+
const result = normalize(jsonLikePayload);
670+
671+
expect(result).toEqual({
672+
__sentry_skip_normalization__: true,
673+
nan: '[NaN]',
674+
fun: '[Function: someFun]',
675+
});
676+
});
677+
});
678+
658679
describe('skips normalizing objects marked with setSkipNormalizationHint (internal symbol)', () => {
659680
test('by leaving non-serializable values intact', () => {
660681
const someFun = () => undefined;

0 commit comments

Comments
 (0)