@@ -1010,11 +1010,11 @@ describe('ResolvedSecretTraceRegistry', () => {
10101010
10111011 it ( 'conservatively retains every active secret that shares a raw plaintext literal' , ( ) => {
10121012 const registry = new ResolvedSecretTraceRegistry ( [
1013- { name : 'FIRST' , plaintext : 'true ' , encryptedValue : 'first-ciphertext' } ,
1014- { name : 'SECOND' , plaintext : 'true ' , encryptedValue : 'second-ciphertext' } ,
1013+ { name : 'FIRST' , plaintext : '4815162342 ' , encryptedValue : 'first-ciphertext' } ,
1014+ { name : 'SECOND' , plaintext : '4815162342 ' , encryptedValue : 'second-ciphertext' } ,
10151015 ] )
1016- registry . recordResolved ( 'FIRST' , 'true ' )
1017- registry . recordResolved ( 'SECOND' , 'true ' )
1016+ registry . recordResolved ( 'FIRST' , '4815162342 ' )
1017+ registry . recordResolved ( 'SECOND' , '4815162342 ' )
10181018
10191019 const expected = {
10201020 version : 1 as const ,
@@ -1024,11 +1024,11 @@ describe('ResolvedSecretTraceRegistry', () => {
10241024 { name : 'SECOND' , encryptedValue : 'second-ciphertext' } ,
10251025 ] ,
10261026 }
1027- expect ( registry . exportCommittedProvenanceForValue ( 'true ' ) ) . toEqual ( expected )
1028- expect ( registry . exportCommittedProvenanceForValue ( true ) ) . toEqual ( expected )
1027+ expect ( registry . exportCommittedProvenanceForValue ( '4815162342 ' ) ) . toEqual ( expected )
1028+ expect ( registry . exportCommittedProvenanceForValue ( 4815162342 ) ) . toEqual ( expected )
10291029 } )
10301030
1031- it ( 'exports active numeric, boolean, and null literals crossing a value boundary' , ( ) => {
1031+ it ( 'exports active numeric literals crossing a value boundary, but not boolean or null ' , ( ) => {
10321032 const registry = new ResolvedSecretTraceRegistry ( [
10331033 { name : 'NUMBER' , plaintext : '1234' , encryptedValue : 'number-ciphertext' } ,
10341034 { name : 'BOOLEAN' , plaintext : 'false' , encryptedValue : 'boolean-ciphertext' } ,
@@ -1048,11 +1048,7 @@ describe('ResolvedSecretTraceRegistry', () => {
10481048 ) . toEqual ( {
10491049 version : 1 ,
10501050 complete : true ,
1051- entries : [
1052- { encryptedValue : 'boolean-ciphertext' } ,
1053- { encryptedValue : 'null-ciphertext' } ,
1054- { encryptedValue : 'number-ciphertext' } ,
1055- ] ,
1051+ entries : [ { encryptedValue : 'number-ciphertext' } ] ,
10561052 } )
10571053 } )
10581054
@@ -1576,3 +1572,53 @@ describe('incompleteness diagnostics', () => {
15761572 expect ( logged ) . not . toContain ( 'MISSING' )
15771573 } )
15781574} )
1575+
1576+ describe ( 'non-identifying literals in durable provenance' , ( ) => {
1577+ /**
1578+ * The amplifier behind the boolean redaction: once recorded on a row, every later read of that
1579+ * table reactivated the value and rewrote every boolean in it.
1580+ */
1581+ it ( 'never records a value too small to identify anything' , ( ) => {
1582+ const registry = new ResolvedSecretTraceRegistry ( [
1583+ { name : 'BANNER_ENABLED' , plaintext : 'false' , encryptedValue : 'flag-ciphertext' } ,
1584+ { name : 'TOKEN' , plaintext : 'xoxb-real-secret-value' , encryptedValue : 'token-ciphertext' } ,
1585+ ] )
1586+ registry . recordResolved ( 'BANNER_ENABLED' , 'false' )
1587+ registry . recordResolved ( 'TOKEN' , 'xoxb-real-secret-value' )
1588+
1589+ expect ( registry . exportProvenanceForValue ( { had_error : false , note : 'fromUser=false' } ) ) . toEqual (
1590+ { version : 1 , complete : true , entries : [ ] }
1591+ )
1592+ expect ( registry . exportProvenanceForValue ( { token : 'xoxb-real-secret-value' } ) ) . toEqual ( {
1593+ version : 1 ,
1594+ complete : true ,
1595+ entries : [ { name : 'TOKEN' , encryptedValue : 'token-ciphertext' } ] ,
1596+ } )
1597+ } )
1598+
1599+ it ( 'still recognizes the internal alias, which names the variable its value cannot' , ( ) => {
1600+ const registry = new ResolvedSecretTraceRegistry ( [
1601+ { name : 'BANNER_ENABLED' , plaintext : 'false' , encryptedValue : 'flag-ciphertext' } ,
1602+ ] )
1603+ registry . recordResolved ( 'BANNER_ENABLED' , 'false' )
1604+
1605+ expect ( registry . exportProvenanceForValue ( { code : '__var_BANNER_ENABLED' } ) ) . toEqual ( {
1606+ version : 1 ,
1607+ complete : true ,
1608+ entries : [ { name : 'BANNER_ENABLED' , encryptedValue : 'flag-ciphertext' } ] ,
1609+ } )
1610+ } )
1611+
1612+ it ( 'keeps it out of the model matcher so nothing downstream can substitute it' , ( ) => {
1613+ const registry = new ResolvedSecretTraceRegistry ( [
1614+ { name : 'BANNER_ENABLED' , plaintext : 'false' , encryptedValue : 'flag-ciphertext' } ,
1615+ ] )
1616+ registry . recordResolved ( 'BANNER_ENABLED' , 'false' )
1617+
1618+ const snapshot = registry . getModelEgressSnapshot ( )
1619+ expect ( snapshot . complete ) . toBe ( true )
1620+ if ( snapshot . complete ) {
1621+ expect ( snapshot . matches . map ( ( match ) => match . plaintext ) ) . not . toContain ( 'false' )
1622+ }
1623+ } )
1624+ } )
0 commit comments