@@ -53,6 +53,10 @@ describe('isSensitiveKey', () => {
5353 expect ( isSensitiveKey ( 'refresh_token' ) ) . toBe ( true )
5454 expect ( isSensitiveKey ( 'auth_token' ) ) . toBe ( true )
5555 expect ( isSensitiveKey ( 'accessToken' ) ) . toBe ( true )
56+ expect ( isSensitiveKey ( 'sessionToken' ) ) . toBe ( true )
57+ expect ( isSensitiveKey ( 'webIdentityToken' ) ) . toBe ( true )
58+ expect ( isSensitiveKey ( 'verificationToken' ) ) . toBe ( true )
59+ expect ( isSensitiveKey ( 'githubToken' ) ) . toBe ( true )
5660 } )
5761
5862 it . concurrent ( 'should match secret variations' , ( ) => {
@@ -110,6 +114,22 @@ describe('isSensitiveKey', () => {
110114 } )
111115
112116 describe ( 'non-sensitive keys (no false positives)' , ( ) => {
117+ it . concurrent ( 'should preserve workflow-state tokens that do not grant access' , ( ) => {
118+ expect ( isSensitiveKey ( 'syncToken' ) ) . toBe ( false )
119+ expect ( isSensitiveKey ( 'SyncToken' ) ) . toBe ( false )
120+ expect ( isSensitiveKey ( 'nextSyncToken' ) ) . toBe ( false )
121+ expect ( isSensitiveKey ( 'pageToken' ) ) . toBe ( false )
122+ expect ( isSensitiveKey ( 'nextPageToken' ) ) . toBe ( false )
123+ expect ( isSensitiveKey ( 'scroll_token' ) ) . toBe ( false )
124+ expect ( isSensitiveKey ( 'continuationToken' ) ) . toBe ( false )
125+ expect ( isSensitiveKey ( 'nextContinuationToken' ) ) . toBe ( false )
126+ expect ( isSensitiveKey ( 'cursorToken' ) ) . toBe ( false )
127+ expect ( isSensitiveKey ( 'nextToken' ) ) . toBe ( false )
128+ expect ( isSensitiveKey ( 'clientRequestToken' ) ) . toBe ( false )
129+ expect ( isSensitiveKey ( 'idempotencyToken' ) ) . toBe ( false )
130+ expect ( isSensitiveKey ( 'subjectFromWebIdentityToken' ) ) . toBe ( false )
131+ } )
132+
113133 it . concurrent ( 'should not match keys with sensitive words as prefix only' , ( ) => {
114134 expect ( isSensitiveKey ( 'tokenCount' ) ) . toBe ( false )
115135 expect ( isSensitiveKey ( 'tokenizer' ) ) . toBe ( false )
@@ -230,6 +250,32 @@ describe('redactApiKeys', () => {
230250 expect ( result . config . normalField ) . toBe ( 'normal-value' )
231251 } )
232252
253+ it . concurrent ( 'should preserve non-secret token fields while redacting credentials' , ( ) => {
254+ const result = redactApiKeys ( {
255+ syncToken : '3' ,
256+ nextPageToken : 'page-2' ,
257+ nextToken : 'next-page' ,
258+ continuationToken : 'continue-page' ,
259+ clientRequestToken : 'idempotency-key' ,
260+ record : { Id : '42' , SyncToken : '3' } ,
261+ accessToken : 'access-secret' ,
262+ sessionToken : 'session-secret' ,
263+ verificationToken : 'verification-secret' ,
264+ } )
265+
266+ expect ( result ) . toEqual ( {
267+ syncToken : '3' ,
268+ nextPageToken : 'page-2' ,
269+ nextToken : 'next-page' ,
270+ continuationToken : 'continue-page' ,
271+ clientRequestToken : 'idempotency-key' ,
272+ record : { Id : '42' , SyncToken : '3' } ,
273+ accessToken : REDACTED_MARKER ,
274+ sessionToken : REDACTED_MARKER ,
275+ verificationToken : REDACTED_MARKER ,
276+ } )
277+ } )
278+
233279 it . concurrent ( 'should redact sensitive keys in arrays' , ( ) => {
234280 const arr = [ { apiKey : 'secret-key-1' } , { apiKey : 'secret-key-2' } ]
235281
0 commit comments