File tree Expand file tree Collapse file tree
packages/core/test/lib/utils Expand file tree Collapse file tree Original file line number Diff line number Diff 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 ;
You can’t perform that action at this time.
0 commit comments