@discretion/core 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +117 -0
- package/LICENSE +21 -0
- package/README.md +319 -0
- package/dist/src/checksums/aba.d.ts +25 -0
- package/dist/src/checksums/aba.d.ts.map +1 -0
- package/dist/src/checksums/aba.js +47 -0
- package/dist/src/checksums/aba.js.map +1 -0
- package/dist/src/checksums/digits.d.ts +55 -0
- package/dist/src/checksums/digits.d.ts.map +1 -0
- package/dist/src/checksums/digits.js +114 -0
- package/dist/src/checksums/digits.js.map +1 -0
- package/dist/src/checksums/icao9303.d.ts +29 -0
- package/dist/src/checksums/icao9303.d.ts.map +1 -0
- package/dist/src/checksums/icao9303.js +56 -0
- package/dist/src/checksums/icao9303.js.map +1 -0
- package/dist/src/checksums/index.d.ts +21 -0
- package/dist/src/checksums/index.d.ts.map +1 -0
- package/dist/src/checksums/index.js +21 -0
- package/dist/src/checksums/index.js.map +1 -0
- package/dist/src/checksums/iso7064.d.ts +67 -0
- package/dist/src/checksums/iso7064.d.ts.map +1 -0
- package/dist/src/checksums/iso7064.js +159 -0
- package/dist/src/checksums/iso7064.js.map +1 -0
- package/dist/src/checksums/luhn.d.ts +32 -0
- package/dist/src/checksums/luhn.d.ts.map +1 -0
- package/dist/src/checksums/luhn.js +66 -0
- package/dist/src/checksums/luhn.js.map +1 -0
- package/dist/src/checksums/mod97.d.ts +55 -0
- package/dist/src/checksums/mod97.d.ts.map +1 -0
- package/dist/src/checksums/mod97.js +94 -0
- package/dist/src/checksums/mod97.js.map +1 -0
- package/dist/src/checksums/verhoeff.d.ts +28 -0
- package/dist/src/checksums/verhoeff.d.ts.map +1 -0
- package/dist/src/checksums/verhoeff.js +80 -0
- package/dist/src/checksums/verhoeff.js.map +1 -0
- package/dist/src/checksums/weighted.d.ts +64 -0
- package/dist/src/checksums/weighted.d.ts.map +1 -0
- package/dist/src/checksums/weighted.js +97 -0
- package/dist/src/checksums/weighted.js.map +1 -0
- package/dist/src/context/documentProfile.d.ts +34 -0
- package/dist/src/context/documentProfile.d.ts.map +1 -0
- package/dist/src/context/documentProfile.js +253 -0
- package/dist/src/context/documentProfile.js.map +1 -0
- package/dist/src/context/negativeRules.d.ts +60 -0
- package/dist/src/context/negativeRules.d.ts.map +1 -0
- package/dist/src/context/negativeRules.js +696 -0
- package/dist/src/context/negativeRules.js.map +1 -0
- package/dist/src/context/score.d.ts +52 -0
- package/dist/src/context/score.d.ts.map +1 -0
- package/dist/src/context/score.js +346 -0
- package/dist/src/context/score.js.map +1 -0
- package/dist/src/context/structure.d.ts +46 -0
- package/dist/src/context/structure.d.ts.map +1 -0
- package/dist/src/context/structure.js +528 -0
- package/dist/src/context/structure.js.map +1 -0
- package/dist/src/context/triggers.d.ts +73 -0
- package/dist/src/context/triggers.d.ts.map +1 -0
- package/dist/src/context/triggers.js +172 -0
- package/dist/src/context/triggers.js.map +1 -0
- package/dist/src/context/types.d.ts +137 -0
- package/dist/src/context/types.d.ts.map +1 -0
- package/dist/src/context/types.js +25 -0
- package/dist/src/context/types.js.map +1 -0
- package/dist/src/crypto/keccak256.d.ts +15 -0
- package/dist/src/crypto/keccak256.d.ts.map +1 -0
- package/dist/src/crypto/keccak256.js +89 -0
- package/dist/src/crypto/keccak256.js.map +1 -0
- package/dist/src/crypto/sha256.d.ts +16 -0
- package/dist/src/crypto/sha256.d.ts.map +1 -0
- package/dist/src/crypto/sha256.js +81 -0
- package/dist/src/crypto/sha256.js.map +1 -0
- package/dist/src/detect/detectors/bankcodes/auBsb.d.ts +11 -0
- package/dist/src/detect/detectors/bankcodes/auBsb.d.ts.map +1 -0
- package/dist/src/detect/detectors/bankcodes/auBsb.js +34 -0
- package/dist/src/detect/detectors/bankcodes/auBsb.js.map +1 -0
- package/dist/src/detect/detectors/bankcodes/brAgencia.d.ts +15 -0
- package/dist/src/detect/detectors/bankcodes/brAgencia.d.ts.map +1 -0
- package/dist/src/detect/detectors/bankcodes/brAgencia.js +43 -0
- package/dist/src/detect/detectors/bankcodes/brAgencia.js.map +1 -0
- package/dist/src/detect/detectors/bankcodes/caTransit.d.ts +13 -0
- package/dist/src/detect/detectors/bankcodes/caTransit.d.ts.map +1 -0
- package/dist/src/detect/detectors/bankcodes/caTransit.js +86 -0
- package/dist/src/detect/detectors/bankcodes/caTransit.js.map +1 -0
- package/dist/src/detect/detectors/bankcodes/inIfsc.d.ts +13 -0
- package/dist/src/detect/detectors/bankcodes/inIfsc.d.ts.map +1 -0
- package/dist/src/detect/detectors/bankcodes/inIfsc.js +37 -0
- package/dist/src/detect/detectors/bankcodes/inIfsc.js.map +1 -0
- package/dist/src/detect/detectors/bankcodes/index.d.ts +10 -0
- package/dist/src/detect/detectors/bankcodes/index.d.ts.map +1 -0
- package/dist/src/detect/detectors/bankcodes/index.js +10 -0
- package/dist/src/detect/detectors/bankcodes/index.js.map +1 -0
- package/dist/src/detect/detectors/bankcodes/ukSortCode.d.ts +13 -0
- package/dist/src/detect/detectors/bankcodes/ukSortCode.d.ts.map +1 -0
- package/dist/src/detect/detectors/bankcodes/ukSortCode.js +36 -0
- package/dist/src/detect/detectors/bankcodes/ukSortCode.js.map +1 -0
- package/dist/src/detect/detectors/bankcodes/usRouting.d.ts +12 -0
- package/dist/src/detect/detectors/bankcodes/usRouting.d.ts.map +1 -0
- package/dist/src/detect/detectors/bankcodes/usRouting.js +45 -0
- package/dist/src/detect/detectors/bankcodes/usRouting.js.map +1 -0
- package/dist/src/detect/detectors/contact/email.d.ts +16 -0
- package/dist/src/detect/detectors/contact/email.d.ts.map +1 -0
- package/dist/src/detect/detectors/contact/email.js +111 -0
- package/dist/src/detect/detectors/contact/email.js.map +1 -0
- package/dist/src/detect/detectors/contact/index.d.ts +11 -0
- package/dist/src/detect/detectors/contact/index.d.ts.map +1 -0
- package/dist/src/detect/detectors/contact/index.js +11 -0
- package/dist/src/detect/detectors/contact/index.js.map +1 -0
- package/dist/src/detect/detectors/contact/ipv4.d.ts +12 -0
- package/dist/src/detect/detectors/contact/ipv4.d.ts.map +1 -0
- package/dist/src/detect/detectors/contact/ipv4.js +109 -0
- package/dist/src/detect/detectors/contact/ipv4.js.map +1 -0
- package/dist/src/detect/detectors/contact/ipv6.d.ts +16 -0
- package/dist/src/detect/detectors/contact/ipv6.d.ts.map +1 -0
- package/dist/src/detect/detectors/contact/ipv6.js +187 -0
- package/dist/src/detect/detectors/contact/ipv6.js.map +1 -0
- package/dist/src/detect/detectors/contact/mac.d.ts +14 -0
- package/dist/src/detect/detectors/contact/mac.d.ts.map +1 -0
- package/dist/src/detect/detectors/contact/mac.js +64 -0
- package/dist/src/detect/detectors/contact/mac.js.map +1 -0
- package/dist/src/detect/detectors/contact/phone.d.ts +21 -0
- package/dist/src/detect/detectors/contact/phone.d.ts.map +1 -0
- package/dist/src/detect/detectors/contact/phone.js +76 -0
- package/dist/src/detect/detectors/contact/phone.js.map +1 -0
- package/dist/src/detect/detectors/contact/urlCredentials.d.ts +23 -0
- package/dist/src/detect/detectors/contact/urlCredentials.d.ts.map +1 -0
- package/dist/src/detect/detectors/contact/urlCredentials.js +123 -0
- package/dist/src/detect/detectors/contact/urlCredentials.js.map +1 -0
- package/dist/src/detect/detectors/crypto/ada.d.ts +13 -0
- package/dist/src/detect/detectors/crypto/ada.d.ts.map +1 -0
- package/dist/src/detect/detectors/crypto/ada.js +51 -0
- package/dist/src/detect/detectors/crypto/ada.js.map +1 -0
- package/dist/src/detect/detectors/crypto/btc.d.ts +15 -0
- package/dist/src/detect/detectors/crypto/btc.d.ts.map +1 -0
- package/dist/src/detect/detectors/crypto/btc.js +78 -0
- package/dist/src/detect/detectors/crypto/btc.js.map +1 -0
- package/dist/src/detect/detectors/crypto/dot.d.ts +13 -0
- package/dist/src/detect/detectors/crypto/dot.d.ts.map +1 -0
- package/dist/src/detect/detectors/crypto/dot.js +41 -0
- package/dist/src/detect/detectors/crypto/dot.js.map +1 -0
- package/dist/src/detect/detectors/crypto/eth.d.ts +15 -0
- package/dist/src/detect/detectors/crypto/eth.d.ts.map +1 -0
- package/dist/src/detect/detectors/crypto/eth.js +63 -0
- package/dist/src/detect/detectors/crypto/eth.js.map +1 -0
- package/dist/src/detect/detectors/crypto/index.d.ts +12 -0
- package/dist/src/detect/detectors/crypto/index.d.ts.map +1 -0
- package/dist/src/detect/detectors/crypto/index.js +12 -0
- package/dist/src/detect/detectors/crypto/index.js.map +1 -0
- package/dist/src/detect/detectors/crypto/ltc.d.ts +12 -0
- package/dist/src/detect/detectors/crypto/ltc.d.ts.map +1 -0
- package/dist/src/detect/detectors/crypto/ltc.js +71 -0
- package/dist/src/detect/detectors/crypto/ltc.js.map +1 -0
- package/dist/src/detect/detectors/crypto/sol.d.ts +13 -0
- package/dist/src/detect/detectors/crypto/sol.d.ts.map +1 -0
- package/dist/src/detect/detectors/crypto/sol.js +39 -0
- package/dist/src/detect/detectors/crypto/sol.js.map +1 -0
- package/dist/src/detect/detectors/crypto/trx.d.ts +8 -0
- package/dist/src/detect/detectors/crypto/trx.d.ts.map +1 -0
- package/dist/src/detect/detectors/crypto/trx.js +34 -0
- package/dist/src/detect/detectors/crypto/trx.js.map +1 -0
- package/dist/src/detect/detectors/crypto/xmr.d.ts +10 -0
- package/dist/src/detect/detectors/crypto/xmr.d.ts.map +1 -0
- package/dist/src/detect/detectors/crypto/xmr.js +51 -0
- package/dist/src/detect/detectors/crypto/xmr.js.map +1 -0
- package/dist/src/detect/detectors/documents/driversLicense.d.ts +24 -0
- package/dist/src/detect/detectors/documents/driversLicense.d.ts.map +1 -0
- package/dist/src/detect/detectors/documents/driversLicense.js +79 -0
- package/dist/src/detect/detectors/documents/driversLicense.js.map +1 -0
- package/dist/src/detect/detectors/documents/healthData.d.ts +23 -0
- package/dist/src/detect/detectors/documents/healthData.d.ts.map +1 -0
- package/dist/src/detect/detectors/documents/healthData.js +78 -0
- package/dist/src/detect/detectors/documents/healthData.js.map +1 -0
- package/dist/src/detect/detectors/documents/index.d.ts +9 -0
- package/dist/src/detect/detectors/documents/index.d.ts.map +1 -0
- package/dist/src/detect/detectors/documents/index.js +9 -0
- package/dist/src/detect/detectors/documents/index.js.map +1 -0
- package/dist/src/detect/detectors/documents/passportMrz.d.ts +20 -0
- package/dist/src/detect/detectors/documents/passportMrz.d.ts.map +1 -0
- package/dist/src/detect/detectors/documents/passportMrz.js +194 -0
- package/dist/src/detect/detectors/documents/passportMrz.js.map +1 -0
- package/dist/src/detect/detectors/documents/usNpi.d.ts +16 -0
- package/dist/src/detect/detectors/documents/usNpi.d.ts.map +1 -0
- package/dist/src/detect/detectors/documents/usNpi.js +48 -0
- package/dist/src/detect/detectors/documents/usNpi.js.map +1 -0
- package/dist/src/detect/detectors/documents/vin.d.ts +15 -0
- package/dist/src/detect/detectors/documents/vin.d.ts.map +1 -0
- package/dist/src/detect/detectors/documents/vin.js +64 -0
- package/dist/src/detect/detectors/documents/vin.js.map +1 -0
- package/dist/src/detect/detectors/financial/creditCard.d.ts +23 -0
- package/dist/src/detect/detectors/financial/creditCard.d.ts.map +1 -0
- package/dist/src/detect/detectors/financial/creditCard.js +157 -0
- package/dist/src/detect/detectors/financial/creditCard.js.map +1 -0
- package/dist/src/detect/detectors/financial/iban.d.ts +18 -0
- package/dist/src/detect/detectors/financial/iban.d.ts.map +1 -0
- package/dist/src/detect/detectors/financial/iban.js +80 -0
- package/dist/src/detect/detectors/financial/iban.js.map +1 -0
- package/dist/src/detect/detectors/financial/ibanRegistry.d.ts +35 -0
- package/dist/src/detect/detectors/financial/ibanRegistry.d.ts.map +1 -0
- package/dist/src/detect/detectors/financial/ibanRegistry.js +92 -0
- package/dist/src/detect/detectors/financial/ibanRegistry.js.map +1 -0
- package/dist/src/detect/detectors/financial/index.d.ts +7 -0
- package/dist/src/detect/detectors/financial/index.d.ts.map +1 -0
- package/dist/src/detect/detectors/financial/index.js +7 -0
- package/dist/src/detect/detectors/financial/index.js.map +1 -0
- package/dist/src/detect/detectors/financial/swiftBic.d.ts +17 -0
- package/dist/src/detect/detectors/financial/swiftBic.d.ts.map +1 -0
- package/dist/src/detect/detectors/financial/swiftBic.js +55 -0
- package/dist/src/detect/detectors/financial/swiftBic.js.map +1 -0
- package/dist/src/detect/detectors/index.d.ts +15 -0
- package/dist/src/detect/detectors/index.d.ts.map +1 -0
- package/dist/src/detect/detectors/index.js +15 -0
- package/dist/src/detect/detectors/index.js.map +1 -0
- package/dist/src/detect/detectors/location/coordinates.d.ts +14 -0
- package/dist/src/detect/detectors/location/coordinates.d.ts.map +1 -0
- package/dist/src/detect/detectors/location/coordinates.js +79 -0
- package/dist/src/detect/detectors/location/coordinates.js.map +1 -0
- package/dist/src/detect/detectors/location/index.d.ts +7 -0
- package/dist/src/detect/detectors/location/index.d.ts.map +1 -0
- package/dist/src/detect/detectors/location/index.js +7 -0
- package/dist/src/detect/detectors/location/index.js.map +1 -0
- package/dist/src/detect/detectors/location/postalCode.d.ts +13 -0
- package/dist/src/detect/detectors/location/postalCode.d.ts.map +1 -0
- package/dist/src/detect/detectors/location/postalCode.js +53 -0
- package/dist/src/detect/detectors/location/postalCode.js.map +1 -0
- package/dist/src/detect/detectors/location/postalRegistry.d.ts +19 -0
- package/dist/src/detect/detectors/location/postalRegistry.d.ts.map +1 -0
- package/dist/src/detect/detectors/location/postalRegistry.js +73 -0
- package/dist/src/detect/detectors/location/postalRegistry.js.map +1 -0
- package/dist/src/detect/detectors/location/streetAddress.d.ts +21 -0
- package/dist/src/detect/detectors/location/streetAddress.d.ts.map +1 -0
- package/dist/src/detect/detectors/location/streetAddress.js +70 -0
- package/dist/src/detect/detectors/location/streetAddress.js.map +1 -0
- package/dist/src/detect/detectors/natid/africa.d.ts +17 -0
- package/dist/src/detect/detectors/natid/africa.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/africa.js +106 -0
- package/dist/src/detect/detectors/natid/africa.js.map +1 -0
- package/dist/src/detect/detectors/natid/ar.d.ts +14 -0
- package/dist/src/detect/detectors/natid/ar.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/ar.js +62 -0
- package/dist/src/detect/detectors/natid/ar.js.map +1 -0
- package/dist/src/detect/detectors/natid/au.d.ts +13 -0
- package/dist/src/detect/detectors/natid/au.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/au.js +100 -0
- package/dist/src/detect/detectors/natid/au.js.map +1 -0
- package/dist/src/detect/detectors/natid/be.d.ts +8 -0
- package/dist/src/detect/detectors/natid/be.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/be.js +44 -0
- package/dist/src/detect/detectors/natid/be.js.map +1 -0
- package/dist/src/detect/detectors/natid/bg.d.ts +7 -0
- package/dist/src/detect/detectors/natid/bg.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/bg.js +44 -0
- package/dist/src/detect/detectors/natid/bg.js.map +1 -0
- package/dist/src/detect/detectors/natid/br.d.ts +8 -0
- package/dist/src/detect/detectors/natid/br.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/br.js +85 -0
- package/dist/src/detect/detectors/natid/br.js.map +1 -0
- package/dist/src/detect/detectors/natid/ca.d.ts +8 -0
- package/dist/src/detect/detectors/natid/ca.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/ca.js +41 -0
- package/dist/src/detect/detectors/natid/ca.js.map +1 -0
- package/dist/src/detect/detectors/natid/cl.d.ts +9 -0
- package/dist/src/detect/detectors/natid/cl.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/cl.js +47 -0
- package/dist/src/detect/detectors/natid/cl.js.map +1 -0
- package/dist/src/detect/detectors/natid/cn.d.ts +9 -0
- package/dist/src/detect/detectors/natid/cn.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/cn.js +49 -0
- package/dist/src/detect/detectors/natid/cn.js.map +1 -0
- package/dist/src/detect/detectors/natid/co.d.ts +10 -0
- package/dist/src/detect/detectors/natid/co.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/co.js +43 -0
- package/dist/src/detect/detectors/natid/co.js.map +1 -0
- package/dist/src/detect/detectors/natid/cz.d.ts +11 -0
- package/dist/src/detect/detectors/natid/cz.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/cz.js +44 -0
- package/dist/src/detect/detectors/natid/cz.js.map +1 -0
- package/dist/src/detect/detectors/natid/de.d.ts +16 -0
- package/dist/src/detect/detectors/natid/de.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/de.js +77 -0
- package/dist/src/detect/detectors/natid/de.js.map +1 -0
- package/dist/src/detect/detectors/natid/dk.d.ts +9 -0
- package/dist/src/detect/detectors/natid/dk.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/dk.js +31 -0
- package/dist/src/detect/detectors/natid/dk.js.map +1 -0
- package/dist/src/detect/detectors/natid/es.d.ts +12 -0
- package/dist/src/detect/detectors/natid/es.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/es.js +96 -0
- package/dist/src/detect/detectors/natid/es.js.map +1 -0
- package/dist/src/detect/detectors/natid/fi.d.ts +10 -0
- package/dist/src/detect/detectors/natid/fi.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/fi.js +40 -0
- package/dist/src/detect/detectors/natid/fi.js.map +1 -0
- package/dist/src/detect/detectors/natid/fr.d.ts +12 -0
- package/dist/src/detect/detectors/natid/fr.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/fr.js +61 -0
- package/dist/src/detect/detectors/natid/fr.js.map +1 -0
- package/dist/src/detect/detectors/natid/gb.d.ts +10 -0
- package/dist/src/detect/detectors/natid/gb.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/gb.js +72 -0
- package/dist/src/detect/detectors/natid/gb.js.map +1 -0
- package/dist/src/detect/detectors/natid/gr.d.ts +7 -0
- package/dist/src/detect/detectors/natid/gr.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/gr.js +36 -0
- package/dist/src/detect/detectors/natid/gr.js.map +1 -0
- package/dist/src/detect/detectors/natid/gulf.d.ts +16 -0
- package/dist/src/detect/detectors/natid/gulf.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/gulf.js +121 -0
- package/dist/src/detect/detectors/natid/gulf.js.map +1 -0
- package/dist/src/detect/detectors/natid/hk.d.ts +9 -0
- package/dist/src/detect/detectors/natid/hk.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/hk.js +41 -0
- package/dist/src/detect/detectors/natid/hk.js.map +1 -0
- package/dist/src/detect/detectors/natid/hr.d.ts +6 -0
- package/dist/src/detect/detectors/natid/hr.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/hr.js +32 -0
- package/dist/src/detect/detectors/natid/hr.js.map +1 -0
- package/dist/src/detect/detectors/natid/hu.d.ts +7 -0
- package/dist/src/detect/detectors/natid/hu.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/hu.js +37 -0
- package/dist/src/detect/detectors/natid/hu.js.map +1 -0
- package/dist/src/detect/detectors/natid/ie.d.ts +9 -0
- package/dist/src/detect/detectors/natid/ie.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/ie.js +36 -0
- package/dist/src/detect/detectors/natid/ie.js.map +1 -0
- package/dist/src/detect/detectors/natid/il.d.ts +10 -0
- package/dist/src/detect/detectors/natid/il.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/il.js +38 -0
- package/dist/src/detect/detectors/natid/il.js.map +1 -0
- package/dist/src/detect/detectors/natid/in.d.ts +17 -0
- package/dist/src/detect/detectors/natid/in.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/in.js +67 -0
- package/dist/src/detect/detectors/natid/in.js.map +1 -0
- package/dist/src/detect/detectors/natid/index.d.ts +55 -0
- package/dist/src/detect/detectors/natid/index.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/index.js +55 -0
- package/dist/src/detect/detectors/natid/index.js.map +1 -0
- package/dist/src/detect/detectors/natid/is.d.ts +8 -0
- package/dist/src/detect/detectors/natid/is.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/is.js +42 -0
- package/dist/src/detect/detectors/natid/is.js.map +1 -0
- package/dist/src/detect/detectors/natid/it.d.ts +12 -0
- package/dist/src/detect/detectors/natid/it.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/it.js +62 -0
- package/dist/src/detect/detectors/natid/it.js.map +1 -0
- package/dist/src/detect/detectors/natid/jp.d.ts +9 -0
- package/dist/src/detect/detectors/natid/jp.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/jp.js +46 -0
- package/dist/src/detect/detectors/natid/jp.js.map +1 -0
- package/dist/src/detect/detectors/natid/kr.d.ts +11 -0
- package/dist/src/detect/detectors/natid/kr.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/kr.js +40 -0
- package/dist/src/detect/detectors/natid/kr.js.map +1 -0
- package/dist/src/detect/detectors/natid/kz.d.ts +8 -0
- package/dist/src/detect/detectors/natid/kz.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/kz.js +46 -0
- package/dist/src/detect/detectors/natid/kz.js.map +1 -0
- package/dist/src/detect/detectors/natid/mx.d.ts +16 -0
- package/dist/src/detect/detectors/natid/mx.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/mx.js +82 -0
- package/dist/src/detect/detectors/natid/mx.js.map +1 -0
- package/dist/src/detect/detectors/natid/nl.d.ts +8 -0
- package/dist/src/detect/detectors/natid/nl.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/nl.js +40 -0
- package/dist/src/detect/detectors/natid/nl.js.map +1 -0
- package/dist/src/detect/detectors/natid/no.d.ts +9 -0
- package/dist/src/detect/detectors/natid/no.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/no.js +52 -0
- package/dist/src/detect/detectors/natid/no.js.map +1 -0
- package/dist/src/detect/detectors/natid/nz.d.ts +9 -0
- package/dist/src/detect/detectors/natid/nz.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/nz.js +52 -0
- package/dist/src/detect/detectors/natid/nz.js.map +1 -0
- package/dist/src/detect/detectors/natid/pe.d.ts +7 -0
- package/dist/src/detect/detectors/natid/pe.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/pe.js +26 -0
- package/dist/src/detect/detectors/natid/pe.js.map +1 -0
- package/dist/src/detect/detectors/natid/pl.d.ts +11 -0
- package/dist/src/detect/detectors/natid/pl.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/pl.js +105 -0
- package/dist/src/detect/detectors/natid/pl.js.map +1 -0
- package/dist/src/detect/detectors/natid/pt.d.ts +6 -0
- package/dist/src/detect/detectors/natid/pt.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/pt.js +35 -0
- package/dist/src/detect/detectors/natid/pt.js.map +1 -0
- package/dist/src/detect/detectors/natid/ro.d.ts +8 -0
- package/dist/src/detect/detectors/natid/ro.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/ro.js +48 -0
- package/dist/src/detect/detectors/natid/ro.js.map +1 -0
- package/dist/src/detect/detectors/natid/ru.d.ts +11 -0
- package/dist/src/detect/detectors/natid/ru.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/ru.js +86 -0
- package/dist/src/detect/detectors/natid/ru.js.map +1 -0
- package/dist/src/detect/detectors/natid/se.d.ts +9 -0
- package/dist/src/detect/detectors/natid/se.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/se.js +43 -0
- package/dist/src/detect/detectors/natid/se.js.map +1 -0
- package/dist/src/detect/detectors/natid/seasia.d.ts +19 -0
- package/dist/src/detect/detectors/natid/seasia.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/seasia.js +182 -0
- package/dist/src/detect/detectors/natid/seasia.js.map +1 -0
- package/dist/src/detect/detectors/natid/sg.d.ts +8 -0
- package/dist/src/detect/detectors/natid/sg.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/sg.js +39 -0
- package/dist/src/detect/detectors/natid/sg.js.map +1 -0
- package/dist/src/detect/detectors/natid/si.d.ts +8 -0
- package/dist/src/detect/detectors/natid/si.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/si.js +44 -0
- package/dist/src/detect/detectors/natid/si.js.map +1 -0
- package/dist/src/detect/detectors/natid/tr.d.ts +14 -0
- package/dist/src/detect/detectors/natid/tr.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/tr.js +79 -0
- package/dist/src/detect/detectors/natid/tr.js.map +1 -0
- package/dist/src/detect/detectors/natid/tw.d.ts +9 -0
- package/dist/src/detect/detectors/natid/tw.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/tw.js +40 -0
- package/dist/src/detect/detectors/natid/tw.js.map +1 -0
- package/dist/src/detect/detectors/natid/ua.d.ts +7 -0
- package/dist/src/detect/detectors/natid/ua.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/ua.js +38 -0
- package/dist/src/detect/detectors/natid/ua.js.map +1 -0
- package/dist/src/detect/detectors/natid/us.d.ts +15 -0
- package/dist/src/detect/detectors/natid/us.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/us.js +119 -0
- package/dist/src/detect/detectors/natid/us.js.map +1 -0
- package/dist/src/detect/detectors/natid/za.d.ts +9 -0
- package/dist/src/detect/detectors/natid/za.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/za.js +44 -0
- package/dist/src/detect/detectors/natid/za.js.map +1 -0
- package/dist/src/detect/detectors/secrets/apiKey.d.ts +14 -0
- package/dist/src/detect/detectors/secrets/apiKey.d.ts.map +1 -0
- package/dist/src/detect/detectors/secrets/apiKey.js +103 -0
- package/dist/src/detect/detectors/secrets/apiKey.js.map +1 -0
- package/dist/src/detect/detectors/secrets/connectionString.d.ts +12 -0
- package/dist/src/detect/detectors/secrets/connectionString.d.ts.map +1 -0
- package/dist/src/detect/detectors/secrets/connectionString.js +70 -0
- package/dist/src/detect/detectors/secrets/connectionString.js.map +1 -0
- package/dist/src/detect/detectors/secrets/genericSecret.d.ts +22 -0
- package/dist/src/detect/detectors/secrets/genericSecret.d.ts.map +1 -0
- package/dist/src/detect/detectors/secrets/genericSecret.js +77 -0
- package/dist/src/detect/detectors/secrets/genericSecret.js.map +1 -0
- package/dist/src/detect/detectors/secrets/index.d.ts +9 -0
- package/dist/src/detect/detectors/secrets/index.d.ts.map +1 -0
- package/dist/src/detect/detectors/secrets/index.js +9 -0
- package/dist/src/detect/detectors/secrets/index.js.map +1 -0
- package/dist/src/detect/detectors/secrets/jwt.d.ts +11 -0
- package/dist/src/detect/detectors/secrets/jwt.d.ts.map +1 -0
- package/dist/src/detect/detectors/secrets/jwt.js +111 -0
- package/dist/src/detect/detectors/secrets/jwt.js.map +1 -0
- package/dist/src/detect/detectors/secrets/pemPrivateKey.d.ts +16 -0
- package/dist/src/detect/detectors/secrets/pemPrivateKey.d.ts.map +1 -0
- package/dist/src/detect/detectors/secrets/pemPrivateKey.js +56 -0
- package/dist/src/detect/detectors/secrets/pemPrivateKey.js.map +1 -0
- package/dist/src/detect/detectors/vat/euVat.d.ts +17 -0
- package/dist/src/detect/detectors/vat/euVat.d.ts.map +1 -0
- package/dist/src/detect/detectors/vat/euVat.js +293 -0
- package/dist/src/detect/detectors/vat/euVat.js.map +1 -0
- package/dist/src/detect/detectors/vat/index.d.ts +5 -0
- package/dist/src/detect/detectors/vat/index.d.ts.map +1 -0
- package/dist/src/detect/detectors/vat/index.js +5 -0
- package/dist/src/detect/detectors/vat/index.js.map +1 -0
- package/dist/src/detect/entropy.d.ts +28 -0
- package/dist/src/detect/entropy.d.ts.map +1 -0
- package/dist/src/detect/entropy.js +64 -0
- package/dist/src/detect/entropy.js.map +1 -0
- package/dist/src/detect/isoCountries.d.ts +10 -0
- package/dist/src/detect/isoCountries.d.ts.map +1 -0
- package/dist/src/detect/isoCountries.js +25 -0
- package/dist/src/detect/isoCountries.js.map +1 -0
- package/dist/src/detect/registry.d.ts +50 -0
- package/dist/src/detect/registry.d.ts.map +1 -0
- package/dist/src/detect/registry.js +110 -0
- package/dist/src/detect/registry.js.map +1 -0
- package/dist/src/detect/runner.d.ts +64 -0
- package/dist/src/detect/runner.d.ts.map +1 -0
- package/dist/src/detect/runner.js +142 -0
- package/dist/src/detect/runner.js.map +1 -0
- package/dist/src/detect/types.d.ts +251 -0
- package/dist/src/detect/types.d.ts.map +1 -0
- package/dist/src/detect/types.js +59 -0
- package/dist/src/detect/types.js.map +1 -0
- package/dist/src/encoding/base58.d.ts +26 -0
- package/dist/src/encoding/base58.d.ts.map +1 -0
- package/dist/src/encoding/base58.js +77 -0
- package/dist/src/encoding/base58.js.map +1 -0
- package/dist/src/encoding/base58monero.d.ts +15 -0
- package/dist/src/encoding/base58monero.d.ts.map +1 -0
- package/dist/src/encoding/base58monero.js +87 -0
- package/dist/src/encoding/base58monero.js.map +1 -0
- package/dist/src/encoding/bech32.d.ts +28 -0
- package/dist/src/encoding/bech32.d.ts.map +1 -0
- package/dist/src/encoding/bech32.js +108 -0
- package/dist/src/encoding/bech32.js.map +1 -0
- package/dist/src/encoding/bytes.d.ts +15 -0
- package/dist/src/encoding/bytes.d.ts.map +1 -0
- package/dist/src/encoding/bytes.js +46 -0
- package/dist/src/encoding/bytes.js.map +1 -0
- package/dist/src/entityFamily.d.ts +18 -0
- package/dist/src/entityFamily.d.ts.map +1 -0
- package/dist/src/entityFamily.js +54 -0
- package/dist/src/entityFamily.js.map +1 -0
- package/dist/src/entityLabel.d.ts +18 -0
- package/dist/src/entityLabel.d.ts.map +1 -0
- package/dist/src/entityLabel.js +53 -0
- package/dist/src/entityLabel.js.map +1 -0
- package/dist/src/entityTypes.d.ts +64 -0
- package/dist/src/entityTypes.d.ts.map +1 -0
- package/dist/src/entityTypes.js +94 -0
- package/dist/src/entityTypes.js.map +1 -0
- package/dist/src/exposure/index.d.ts +86 -0
- package/dist/src/exposure/index.d.ts.map +1 -0
- package/dist/src/exposure/index.js +134 -0
- package/dist/src/exposure/index.js.map +1 -0
- package/dist/src/fuse/calibrate.d.ts +95 -0
- package/dist/src/fuse/calibrate.d.ts.map +1 -0
- package/dist/src/fuse/calibrate.js +165 -0
- package/dist/src/fuse/calibrate.js.map +1 -0
- package/dist/src/fuse/defaultCalibration.d.ts +52 -0
- package/dist/src/fuse/defaultCalibration.d.ts.map +1 -0
- package/dist/src/fuse/defaultCalibration.js +41 -0
- package/dist/src/fuse/defaultCalibration.js.map +1 -0
- package/dist/src/fuse/explain.d.ts +55 -0
- package/dist/src/fuse/explain.d.ts.map +1 -0
- package/dist/src/fuse/explain.js +91 -0
- package/dist/src/fuse/explain.js.map +1 -0
- package/dist/src/fuse/profiles.d.ts +80 -0
- package/dist/src/fuse/profiles.d.ts.map +1 -0
- package/dist/src/fuse/profiles.js +126 -0
- package/dist/src/fuse/profiles.js.map +1 -0
- package/dist/src/fuse/resolve.d.ts +73 -0
- package/dist/src/fuse/resolve.d.ts.map +1 -0
- package/dist/src/fuse/resolve.js +206 -0
- package/dist/src/fuse/resolve.js.map +1 -0
- package/dist/src/gazetteer/index.d.ts +41 -0
- package/dist/src/gazetteer/index.d.ts.map +1 -0
- package/dist/src/gazetteer/index.js +117 -0
- package/dist/src/gazetteer/index.js.map +1 -0
- package/dist/src/generate/bankcodes.d.ts +20 -0
- package/dist/src/generate/bankcodes.d.ts.map +1 -0
- package/dist/src/generate/bankcodes.js +71 -0
- package/dist/src/generate/bankcodes.js.map +1 -0
- package/dist/src/generate/contact.d.ts +31 -0
- package/dist/src/generate/contact.d.ts.map +1 -0
- package/dist/src/generate/contact.js +139 -0
- package/dist/src/generate/contact.js.map +1 -0
- package/dist/src/generate/crypto.d.ts +27 -0
- package/dist/src/generate/crypto.d.ts.map +1 -0
- package/dist/src/generate/crypto.js +88 -0
- package/dist/src/generate/crypto.js.map +1 -0
- package/dist/src/generate/documents.d.ts +24 -0
- package/dist/src/generate/documents.d.ts.map +1 -0
- package/dist/src/generate/documents.js +124 -0
- package/dist/src/generate/documents.js.map +1 -0
- package/dist/src/generate/financial.d.ts +26 -0
- package/dist/src/generate/financial.d.ts.map +1 -0
- package/dist/src/generate/financial.js +136 -0
- package/dist/src/generate/financial.js.map +1 -0
- package/dist/src/generate/index.d.ts +23 -0
- package/dist/src/generate/index.d.ts.map +1 -0
- package/dist/src/generate/index.js +23 -0
- package/dist/src/generate/index.js.map +1 -0
- package/dist/src/generate/location.d.ts +12 -0
- package/dist/src/generate/location.d.ts.map +1 -0
- package/dist/src/generate/location.js +75 -0
- package/dist/src/generate/location.js.map +1 -0
- package/dist/src/generate/natidAmOc.d.ts +22 -0
- package/dist/src/generate/natidAmOc.d.ts.map +1 -0
- package/dist/src/generate/natidAmOc.js +181 -0
- package/dist/src/generate/natidAmOc.js.map +1 -0
- package/dist/src/generate/natidAsia.d.ts +20 -0
- package/dist/src/generate/natidAsia.d.ts.map +1 -0
- package/dist/src/generate/natidAsia.js +147 -0
- package/dist/src/generate/natidAsia.js.map +1 -0
- package/dist/src/generate/natidCee.d.ts +21 -0
- package/dist/src/generate/natidCee.d.ts.map +1 -0
- package/dist/src/generate/natidCee.js +181 -0
- package/dist/src/generate/natidCee.js.map +1 -0
- package/dist/src/generate/natidMeCis.d.ts +17 -0
- package/dist/src/generate/natidMeCis.d.ts.map +1 -0
- package/dist/src/generate/natidMeCis.js +121 -0
- package/dist/src/generate/natidMeCis.js.map +1 -0
- package/dist/src/generate/natidWest.d.ts +32 -0
- package/dist/src/generate/natidWest.d.ts.map +1 -0
- package/dist/src/generate/natidWest.js +187 -0
- package/dist/src/generate/natidWest.js.map +1 -0
- package/dist/src/generate/prng.d.ts +10 -0
- package/dist/src/generate/prng.d.ts.map +1 -0
- package/dist/src/generate/prng.js +18 -0
- package/dist/src/generate/prng.js.map +1 -0
- package/dist/src/generate/secrets.d.ts +23 -0
- package/dist/src/generate/secrets.d.ts.map +1 -0
- package/dist/src/generate/secrets.js +126 -0
- package/dist/src/generate/secrets.js.map +1 -0
- package/dist/src/generate/vat.d.ts +11 -0
- package/dist/src/generate/vat.d.ts.map +1 -0
- package/dist/src/generate/vat.js +233 -0
- package/dist/src/generate/vat.js.map +1 -0
- package/dist/src/index.d.ts +81 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +76 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/mask/egressGuard.d.ts +54 -0
- package/dist/src/mask/egressGuard.d.ts.map +1 -0
- package/dist/src/mask/egressGuard.js +67 -0
- package/dist/src/mask/egressGuard.js.map +1 -0
- package/dist/src/mask/masker.d.ts +76 -0
- package/dist/src/mask/masker.d.ts.map +1 -0
- package/dist/src/mask/masker.js +201 -0
- package/dist/src/mask/masker.js.map +1 -0
- package/dist/src/mask/restorer.d.ts +96 -0
- package/dist/src/mask/restorer.d.ts.map +1 -0
- package/dist/src/mask/restorer.js +263 -0
- package/dist/src/mask/restorer.js.map +1 -0
- package/dist/src/mask/surrogatePools.d.ts +33 -0
- package/dist/src/mask/surrogatePools.d.ts.map +1 -0
- package/dist/src/mask/surrogatePools.js +81 -0
- package/dist/src/mask/surrogatePools.js.map +1 -0
- package/dist/src/mask/surrogates.d.ts +45 -0
- package/dist/src/mask/surrogates.d.ts.map +1 -0
- package/dist/src/mask/surrogates.js +241 -0
- package/dist/src/mask/surrogates.js.map +1 -0
- package/dist/src/mask/vault.d.ts +76 -0
- package/dist/src/mask/vault.d.ts.map +1 -0
- package/dist/src/mask/vault.js +141 -0
- package/dist/src/mask/vault.js.map +1 -0
- package/dist/src/ner/align.d.ts +36 -0
- package/dist/src/ner/align.d.ts.map +1 -0
- package/dist/src/ner/align.js +73 -0
- package/dist/src/ner/align.js.map +1 -0
- package/dist/src/ner/chunk.d.ts +27 -0
- package/dist/src/ner/chunk.d.ts.map +1 -0
- package/dist/src/ner/chunk.js +55 -0
- package/dist/src/ner/chunk.js.map +1 -0
- package/dist/src/ner/chunkCache.d.ts +63 -0
- package/dist/src/ner/chunkCache.d.ts.map +1 -0
- package/dist/src/ner/chunkCache.js +99 -0
- package/dist/src/ner/chunkCache.js.map +1 -0
- package/dist/src/ner/engine.d.ts +53 -0
- package/dist/src/ner/engine.d.ts.map +1 -0
- package/dist/src/ner/engine.js +113 -0
- package/dist/src/ner/engine.js.map +1 -0
- package/dist/src/ner/merge.d.ts +26 -0
- package/dist/src/ner/merge.d.ts.map +1 -0
- package/dist/src/ner/merge.js +108 -0
- package/dist/src/ner/merge.js.map +1 -0
- package/dist/src/ner/runStage2.d.ts +17 -0
- package/dist/src/ner/runStage2.d.ts.map +1 -0
- package/dist/src/ner/runStage2.js +43 -0
- package/dist/src/ner/runStage2.js.map +1 -0
- package/dist/src/ner/stage2b.d.ts +59 -0
- package/dist/src/ner/stage2b.d.ts.map +1 -0
- package/dist/src/ner/stage2b.js +51 -0
- package/dist/src/ner/stage2b.js.map +1 -0
- package/dist/src/ner/transformersClassifier.d.ts +45 -0
- package/dist/src/ner/transformersClassifier.d.ts.map +1 -0
- package/dist/src/ner/transformersClassifier.js +40 -0
- package/dist/src/ner/transformersClassifier.js.map +1 -0
- package/dist/src/ner/types.d.ts +93 -0
- package/dist/src/ner/types.d.ts.map +1 -0
- package/dist/src/ner/types.js +12 -0
- package/dist/src/ner/types.js.map +1 -0
- package/dist/src/normalization.d.ts +24 -0
- package/dist/src/normalization.d.ts.map +1 -0
- package/dist/src/normalization.js +92 -0
- package/dist/src/normalization.js.map +1 -0
- package/dist/src/offsetMap.d.ts +165 -0
- package/dist/src/offsetMap.d.ts.map +1 -0
- package/dist/src/offsetMap.js +225 -0
- package/dist/src/offsetMap.js.map +1 -0
- package/dist/src/pipeline.d.ts +58 -0
- package/dist/src/pipeline.d.ts.map +1 -0
- package/dist/src/pipeline.js +57 -0
- package/dist/src/pipeline.js.map +1 -0
- package/dist/src/protect.d.ts +146 -0
- package/dist/src/protect.d.ts.map +1 -0
- package/dist/src/protect.js +161 -0
- package/dist/src/protect.js.map +1 -0
- package/dist/src/scripts.d.ts +37 -0
- package/dist/src/scripts.d.ts.map +1 -0
- package/dist/src/scripts.js +145 -0
- package/dist/src/scripts.js.map +1 -0
- package/dist/src/transforms/foldDigits.d.ts +49 -0
- package/dist/src/transforms/foldDigits.d.ts.map +1 -0
- package/dist/src/transforms/foldDigits.js +135 -0
- package/dist/src/transforms/foldDigits.js.map +1 -0
- package/dist/src/transforms/graphemes.d.ts +6 -0
- package/dist/src/transforms/graphemes.d.ts.map +1 -0
- package/dist/src/transforms/graphemes.js +6 -0
- package/dist/src/transforms/graphemes.js.map +1 -0
- package/dist/src/transforms/homoglyphFold.d.ts +5 -0
- package/dist/src/transforms/homoglyphFold.d.ts.map +1 -0
- package/dist/src/transforms/homoglyphFold.js +214 -0
- package/dist/src/transforms/homoglyphFold.js.map +1 -0
- package/dist/src/transforms/nfkc.d.ts +20 -0
- package/dist/src/transforms/nfkc.d.ts.map +1 -0
- package/dist/src/transforms/nfkc.js +48 -0
- package/dist/src/transforms/nfkc.js.map +1 -0
- package/dist/src/transforms/stripInvisibles.d.ts +37 -0
- package/dist/src/transforms/stripInvisibles.d.ts.map +1 -0
- package/dist/src/transforms/stripInvisibles.js +151 -0
- package/dist/src/transforms/stripInvisibles.js.map +1 -0
- package/dist/src/transforms/whitespacePunct.d.ts +21 -0
- package/dist/src/transforms/whitespacePunct.d.ts.map +1 -0
- package/dist/src/transforms/whitespacePunct.js +100 -0
- package/dist/src/transforms/whitespacePunct.js.map +1 -0
- package/dist/src/types.d.ts +212 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +14 -0
- package/dist/src/types.js.map +1 -0
- package/package.json +67 -0
- package/src/checksums/aba.ts +45 -0
- package/src/checksums/digits.ts +108 -0
- package/src/checksums/icao9303.ts +53 -0
- package/src/checksums/index.ts +36 -0
- package/src/checksums/iso7064.ts +168 -0
- package/src/checksums/luhn.ts +66 -0
- package/src/checksums/mod97.ts +91 -0
- package/src/checksums/verhoeff.ts +84 -0
- package/src/checksums/weighted.ts +108 -0
- package/src/context/documentProfile.ts +293 -0
- package/src/context/negativeRules.ts +765 -0
- package/src/context/score.ts +430 -0
- package/src/context/structure.ts +611 -0
- package/src/context/triggers.ts +266 -0
- package/src/context/types.ts +150 -0
- package/src/crypto/keccak256.ts +98 -0
- package/src/crypto/sha256.ts +76 -0
- package/src/detect/AUTHORING.md +50 -0
- package/src/detect/detectors/bankcodes/auBsb.ts +36 -0
- package/src/detect/detectors/bankcodes/brAgencia.ts +46 -0
- package/src/detect/detectors/bankcodes/caTransit.ts +89 -0
- package/src/detect/detectors/bankcodes/inIfsc.ts +40 -0
- package/src/detect/detectors/bankcodes/index.ts +9 -0
- package/src/detect/detectors/bankcodes/ukSortCode.ts +38 -0
- package/src/detect/detectors/bankcodes/usRouting.ts +47 -0
- package/src/detect/detectors/contact/email.ts +113 -0
- package/src/detect/detectors/contact/index.ts +10 -0
- package/src/detect/detectors/contact/ipv4.ts +112 -0
- package/src/detect/detectors/contact/ipv6.ts +188 -0
- package/src/detect/detectors/contact/mac.ts +68 -0
- package/src/detect/detectors/contact/phone.ts +81 -0
- package/src/detect/detectors/contact/urlCredentials.ts +124 -0
- package/src/detect/detectors/crypto/ada.ts +52 -0
- package/src/detect/detectors/crypto/btc.ts +77 -0
- package/src/detect/detectors/crypto/dot.ts +42 -0
- package/src/detect/detectors/crypto/eth.ts +70 -0
- package/src/detect/detectors/crypto/index.ts +11 -0
- package/src/detect/detectors/crypto/ltc.ts +69 -0
- package/src/detect/detectors/crypto/sol.ts +41 -0
- package/src/detect/detectors/crypto/trx.ts +35 -0
- package/src/detect/detectors/crypto/xmr.ts +54 -0
- package/src/detect/detectors/documents/driversLicense.ts +83 -0
- package/src/detect/detectors/documents/healthData.ts +88 -0
- package/src/detect/detectors/documents/index.ts +8 -0
- package/src/detect/detectors/documents/passportMrz.ts +203 -0
- package/src/detect/detectors/documents/usNpi.ts +50 -0
- package/src/detect/detectors/documents/vin.ts +67 -0
- package/src/detect/detectors/financial/creditCard.ts +167 -0
- package/src/detect/detectors/financial/iban.ts +82 -0
- package/src/detect/detectors/financial/ibanRegistry.ts +112 -0
- package/src/detect/detectors/financial/index.ts +6 -0
- package/src/detect/detectors/financial/swiftBic.ts +61 -0
- package/src/detect/detectors/index.ts +14 -0
- package/src/detect/detectors/location/coordinates.ts +84 -0
- package/src/detect/detectors/location/index.ts +6 -0
- package/src/detect/detectors/location/postalCode.ts +56 -0
- package/src/detect/detectors/location/postalRegistry.ts +74 -0
- package/src/detect/detectors/location/streetAddress.ts +84 -0
- package/src/detect/detectors/natid/africa.ts +108 -0
- package/src/detect/detectors/natid/ar.ts +62 -0
- package/src/detect/detectors/natid/au.ts +99 -0
- package/src/detect/detectors/natid/be.ts +45 -0
- package/src/detect/detectors/natid/bg.ts +44 -0
- package/src/detect/detectors/natid/br.ts +81 -0
- package/src/detect/detectors/natid/ca.ts +40 -0
- package/src/detect/detectors/natid/cl.ts +47 -0
- package/src/detect/detectors/natid/cn.ts +48 -0
- package/src/detect/detectors/natid/co.ts +46 -0
- package/src/detect/detectors/natid/cz.ts +44 -0
- package/src/detect/detectors/natid/de.ts +75 -0
- package/src/detect/detectors/natid/dk.ts +31 -0
- package/src/detect/detectors/natid/es.ts +95 -0
- package/src/detect/detectors/natid/fi.ts +41 -0
- package/src/detect/detectors/natid/fr.ts +63 -0
- package/src/detect/detectors/natid/gb.ts +70 -0
- package/src/detect/detectors/natid/gr.ts +35 -0
- package/src/detect/detectors/natid/gulf.ts +116 -0
- package/src/detect/detectors/natid/hk.ts +42 -0
- package/src/detect/detectors/natid/hr.ts +32 -0
- package/src/detect/detectors/natid/hu.ts +36 -0
- package/src/detect/detectors/natid/ie.ts +37 -0
- package/src/detect/detectors/natid/il.ts +37 -0
- package/src/detect/detectors/natid/in.ts +67 -0
- package/src/detect/detectors/natid/index.ts +54 -0
- package/src/detect/detectors/natid/is.ts +42 -0
- package/src/detect/detectors/natid/it.ts +65 -0
- package/src/detect/detectors/natid/jp.ts +48 -0
- package/src/detect/detectors/natid/kr.ts +41 -0
- package/src/detect/detectors/natid/kz.ts +44 -0
- package/src/detect/detectors/natid/mx.ts +83 -0
- package/src/detect/detectors/natid/nl.ts +38 -0
- package/src/detect/detectors/natid/no.ts +50 -0
- package/src/detect/detectors/natid/nz.ts +53 -0
- package/src/detect/detectors/natid/pe.ts +28 -0
- package/src/detect/detectors/natid/pl.ts +100 -0
- package/src/detect/detectors/natid/pt.ts +36 -0
- package/src/detect/detectors/natid/ro.ts +47 -0
- package/src/detect/detectors/natid/ru.ts +82 -0
- package/src/detect/detectors/natid/se.ts +42 -0
- package/src/detect/detectors/natid/seasia.ts +174 -0
- package/src/detect/detectors/natid/sg.ts +39 -0
- package/src/detect/detectors/natid/si.ts +42 -0
- package/src/detect/detectors/natid/tr.ts +76 -0
- package/src/detect/detectors/natid/tw.ts +41 -0
- package/src/detect/detectors/natid/ua.ts +38 -0
- package/src/detect/detectors/natid/us.ts +118 -0
- package/src/detect/detectors/natid/za.ts +42 -0
- package/src/detect/detectors/secrets/apiKey.ts +115 -0
- package/src/detect/detectors/secrets/connectionString.ts +71 -0
- package/src/detect/detectors/secrets/genericSecret.ts +81 -0
- package/src/detect/detectors/secrets/index.ts +8 -0
- package/src/detect/detectors/secrets/jwt.ts +101 -0
- package/src/detect/detectors/secrets/pemPrivateKey.ts +59 -0
- package/src/detect/detectors/vat/euVat.ts +280 -0
- package/src/detect/detectors/vat/index.ts +4 -0
- package/src/detect/entropy.ts +60 -0
- package/src/detect/isoCountries.ts +30 -0
- package/src/detect/registry.ts +134 -0
- package/src/detect/runner.ts +187 -0
- package/src/detect/types.ts +296 -0
- package/src/encoding/base58.ts +85 -0
- package/src/encoding/base58monero.ts +90 -0
- package/src/encoding/bech32.ts +125 -0
- package/src/encoding/bytes.ts +48 -0
- package/src/entityFamily.ts +70 -0
- package/src/entityLabel.ts +56 -0
- package/src/entityTypes.ts +107 -0
- package/src/exposure/index.ts +189 -0
- package/src/fuse/calibrate.ts +224 -0
- package/src/fuse/defaultCalibration.ts +71 -0
- package/src/fuse/explain.ts +114 -0
- package/src/fuse/profiles.ts +187 -0
- package/src/fuse/resolve.ts +237 -0
- package/src/gazetteer/index.ts +139 -0
- package/src/generate/bankcodes.ts +82 -0
- package/src/generate/contact.ts +147 -0
- package/src/generate/crypto.ts +91 -0
- package/src/generate/documents.ts +142 -0
- package/src/generate/financial.ts +149 -0
- package/src/generate/index.ts +22 -0
- package/src/generate/location.ts +80 -0
- package/src/generate/natidAmOc.ts +198 -0
- package/src/generate/natidAsia.ts +162 -0
- package/src/generate/natidCee.ts +196 -0
- package/src/generate/natidMeCis.ts +131 -0
- package/src/generate/natidWest.ts +208 -0
- package/src/generate/prng.ts +17 -0
- package/src/generate/secrets.ts +141 -0
- package/src/generate/vat.ts +239 -0
- package/src/index.ts +186 -0
- package/src/mask/egressGuard.ts +88 -0
- package/src/mask/masker.ts +276 -0
- package/src/mask/restorer.ts +284 -0
- package/src/mask/surrogatePools.ts +96 -0
- package/src/mask/surrogates.ts +248 -0
- package/src/mask/vault.ts +153 -0
- package/src/ner/align.ts +86 -0
- package/src/ner/chunk.ts +65 -0
- package/src/ner/chunkCache.ts +110 -0
- package/src/ner/engine.ts +141 -0
- package/src/ner/merge.ts +123 -0
- package/src/ner/runStage2.ts +51 -0
- package/src/ner/stage2b.ts +73 -0
- package/src/ner/transformersClassifier.ts +79 -0
- package/src/ner/types.ts +99 -0
- package/src/normalization.ts +119 -0
- package/src/offsetMap.ts +271 -0
- package/src/pipeline.ts +96 -0
- package/src/protect.ts +284 -0
- package/src/scripts.ts +164 -0
- package/src/transforms/foldDigits.ts +138 -0
- package/src/transforms/graphemes.ts +5 -0
- package/src/transforms/homoglyphFold.ts +221 -0
- package/src/transforms/nfkc.ts +48 -0
- package/src/transforms/stripInvisibles.ts +158 -0
- package/src/transforms/whitespacePunct.ts +100 -0
- package/src/types.ts +339 -0
|
@@ -0,0 +1,696 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stage 3, NEGATIVE CONTEXT.
|
|
3
|
+
*
|
|
4
|
+
* SPEC.md: "NEGATIVE CONTEXT — signals that a candidate is NOT sensitive:
|
|
5
|
+
* inside a code comment describing a format, in a documentation example
|
|
6
|
+
* block, a known dummy value, lorem ipsum, a test fixture, a UUID in a log
|
|
7
|
+
* line, a git SHA. These must actively suppress."
|
|
8
|
+
*
|
|
9
|
+
* THE SAFETY RULE FOR THIS FILE. Every rule here can cause a real secret to
|
|
10
|
+
* go unreported, which in this product is the worst possible failure. So each
|
|
11
|
+
* rule must satisfy three things, and each is enforced by review, not by the
|
|
12
|
+
* type system alone:
|
|
13
|
+
*
|
|
14
|
+
* 1. It states a GENERAL principle about how text is written — never a
|
|
15
|
+
* literal drawn from the evaluation corpus. A rule tuned to the corpus
|
|
16
|
+
* would make the measured precision gain self-fulfilling and dishonest.
|
|
17
|
+
* 2. It states the real positive it risks suppressing, in `risk`.
|
|
18
|
+
* 3. It suppresses only on CONCLUSIVE evidence that the value is a
|
|
19
|
+
* different kind of thing. Where the evidence merely weakens the case,
|
|
20
|
+
* the rule returns a penalty instead, and the candidate survives at
|
|
21
|
+
* lower confidence.
|
|
22
|
+
*
|
|
23
|
+
* Note what is deliberately absent: no rule here looks at OTHER candidates'
|
|
24
|
+
* spans. Deciding that a generic high-entropy match should yield to a
|
|
25
|
+
* structurally validated JWT covering the same characters is cross-type
|
|
26
|
+
* overlap resolution, which SPEC.md assigns to Stage 4. Keeping it out is
|
|
27
|
+
* what stops Stage 3 quietly absorbing the next milestone's work.
|
|
28
|
+
*/
|
|
29
|
+
import { parsePhoneNumberFromString } from 'libphonenumber-js/max';
|
|
30
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
31
|
+
// Shared helpers
|
|
32
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
33
|
+
/** Numeric identifier types that a containing structure can rule out. */
|
|
34
|
+
const NUMERIC_IDENTIFIERS = [
|
|
35
|
+
'POSTAL_CODE',
|
|
36
|
+
'NATIONAL_ID',
|
|
37
|
+
'TAX_ID',
|
|
38
|
+
'HEALTH_DATA',
|
|
39
|
+
'DRIVERS_LICENSE',
|
|
40
|
+
'US_ROUTING_NUMBER',
|
|
41
|
+
'CREDIT_CARD',
|
|
42
|
+
'US_NPI',
|
|
43
|
+
'VIN',
|
|
44
|
+
];
|
|
45
|
+
/** Characters that may appear inside a written telephone number. */
|
|
46
|
+
const PHONE_RUN_CHAR = /[+\d\s().-]/;
|
|
47
|
+
/** Highest valid TCP/UDP port, used to sanity-check a `host:port` reading. */
|
|
48
|
+
const MAX_PORT = 65535;
|
|
49
|
+
function countDigits(value) {
|
|
50
|
+
let n = 0;
|
|
51
|
+
for (const ch of value)
|
|
52
|
+
if (ch >= '0' && ch <= '9')
|
|
53
|
+
n += 1;
|
|
54
|
+
return n;
|
|
55
|
+
}
|
|
56
|
+
/** The candidate's offsets relative to its own line. */
|
|
57
|
+
function localSpan(ctx) {
|
|
58
|
+
return { start: ctx.start - ctx.line.start, end: ctx.end - ctx.line.start };
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* The maximal run of telephone-shaped characters containing the candidate.
|
|
62
|
+
* Returns undefined when the candidate is not made only of such characters.
|
|
63
|
+
*/
|
|
64
|
+
function phoneRunAround(ctx) {
|
|
65
|
+
const { text } = ctx.line;
|
|
66
|
+
const { start, end } = localSpan(ctx);
|
|
67
|
+
const value = text.slice(start, end);
|
|
68
|
+
if (value.length === 0 || !/^[\d\s().-]+$/.test(value))
|
|
69
|
+
return undefined;
|
|
70
|
+
let from = start;
|
|
71
|
+
let to = end;
|
|
72
|
+
while (from > 0 && PHONE_RUN_CHAR.test(text[from - 1] ?? ''))
|
|
73
|
+
from -= 1;
|
|
74
|
+
while (to < text.length && PHONE_RUN_CHAR.test(text[to] ?? ''))
|
|
75
|
+
to += 1;
|
|
76
|
+
return {
|
|
77
|
+
run: text.slice(from, to),
|
|
78
|
+
prefix: text.slice(from, start),
|
|
79
|
+
digitsBefore: countDigits(text.slice(from, start)),
|
|
80
|
+
digitsAfter: countDigits(text.slice(end, to)),
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Labels whose last component marks a host name rather than a file or a
|
|
85
|
+
* property path. A bare "looks dotted" test reads `customers.csv:10001` and
|
|
86
|
+
* `kunde.adresse.plz:10115` as host and port, which suppresses real postal
|
|
87
|
+
* codes (M7 safety review). Two-letter labels are accepted wholesale as
|
|
88
|
+
* country-code TLDs; everything else must be named.
|
|
89
|
+
*/
|
|
90
|
+
const KNOWN_TLDS = new Set([
|
|
91
|
+
'com', 'org', 'net', 'edu', 'gov', 'mil', 'int', 'info', 'biz', 'name',
|
|
92
|
+
'io', 'dev', 'app', 'cloud', 'sh', 'ai', 'co', 'tech', 'online', 'site',
|
|
93
|
+
'xyz', 'me', 'tv', 'cc', 'gg',
|
|
94
|
+
// Internal and reserved suffixes, which is where host:port genuinely appears.
|
|
95
|
+
'local', 'localhost', 'internal', 'corp', 'lan', 'home', 'intranet',
|
|
96
|
+
'test', 'example', 'invalid', 'localdomain',
|
|
97
|
+
]);
|
|
98
|
+
function looksLikeHostName(candidateHost) {
|
|
99
|
+
const match = /([A-Za-z0-9][A-Za-z0-9-]*)\.([A-Za-z]{2,24})$/.exec(candidateHost);
|
|
100
|
+
const tld = match?.[2]?.toLowerCase();
|
|
101
|
+
if (tld === undefined)
|
|
102
|
+
return false;
|
|
103
|
+
return tld.length === 2 || KNOWN_TLDS.has(tld);
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* The URI authority component containing the candidate, if any.
|
|
107
|
+
*
|
|
108
|
+
* The authority is what sits between `://` and the first `/`, `?` or `#`.
|
|
109
|
+
* Restricting to it is what keeps a genuine address in a query string
|
|
110
|
+
* (`…/contact?email=someone@example.com`) from being suppressed: that lies in
|
|
111
|
+
* the path, not the authority.
|
|
112
|
+
*/
|
|
113
|
+
function uriAuthorityAround(ctx) {
|
|
114
|
+
const { text } = ctx.line;
|
|
115
|
+
const { start, end } = localSpan(ctx);
|
|
116
|
+
const schemeAt = text.lastIndexOf('://', start);
|
|
117
|
+
if (schemeAt === -1)
|
|
118
|
+
return undefined;
|
|
119
|
+
const authorityStart = schemeAt + 3;
|
|
120
|
+
let authorityEnd = authorityStart;
|
|
121
|
+
// Scan only over characters RFC 3986 actually permits in an authority.
|
|
122
|
+
// The original scan ran until a delimiter it happened to list, so a '|' in
|
|
123
|
+
// a log line, a ';' in a JDBC URL or a CSV separator did not stop it and the
|
|
124
|
+
// "authority" swallowed the rest of the line — the M7 review executed
|
|
125
|
+
// 'INFO|…|https://enroll.acme-benefits.com|200|ssn=240-01-2233|…' and watched
|
|
126
|
+
// a valid SSN suppressed as part of the authority.
|
|
127
|
+
while (authorityEnd < text.length && AUTHORITY_CHAR.test(text[authorityEnd] ?? '')) {
|
|
128
|
+
authorityEnd += 1;
|
|
129
|
+
}
|
|
130
|
+
if (start < authorityStart || end > authorityEnd)
|
|
131
|
+
return undefined;
|
|
132
|
+
return text.slice(authorityStart, authorityEnd);
|
|
133
|
+
}
|
|
134
|
+
/** Characters RFC 3986 permits in a URI authority component. */
|
|
135
|
+
const AUTHORITY_CHAR = /[A-Za-z0-9._~%+@:[\]-]/;
|
|
136
|
+
/** The innermost bracketed group containing the candidate, if any. */
|
|
137
|
+
function bracketedAround(ctx) {
|
|
138
|
+
const { text } = ctx.line;
|
|
139
|
+
const { start, end } = localSpan(ctx);
|
|
140
|
+
const openers = { '[': ']', '(': ')' };
|
|
141
|
+
for (let i = start - 1; i >= 0; i -= 1) {
|
|
142
|
+
const ch = text[i] ?? '';
|
|
143
|
+
if (ch === ']' || ch === ')')
|
|
144
|
+
return undefined;
|
|
145
|
+
const closer = openers[ch];
|
|
146
|
+
if (closer === undefined)
|
|
147
|
+
continue;
|
|
148
|
+
const closeAt = text.indexOf(closer, end);
|
|
149
|
+
if (closeAt === -1)
|
|
150
|
+
return undefined;
|
|
151
|
+
return { inner: text.slice(i + 1, closeAt), open: i };
|
|
152
|
+
}
|
|
153
|
+
return undefined;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Does a measured quantity precede this point on the line?
|
|
157
|
+
*
|
|
158
|
+
* A reference interval annotates a measurement — that adjacency is the actual
|
|
159
|
+
* signal, and requiring it is what separates "196.0 mmol/L [65-156]" from an
|
|
160
|
+
* identifier that merely happens to sit in brackets.
|
|
161
|
+
*/
|
|
162
|
+
function measurementPrecedes(line, before) {
|
|
163
|
+
// A REAL unit is required, immediately after a number. The earlier version
|
|
164
|
+
// accepted any trailing letters (and matched zero-width), so a Polish
|
|
165
|
+
// address — "Sklep nr 12 Gdansk (80-180)" — read as a measured quantity and
|
|
166
|
+
// the postal code was suppressed. A bare number is deliberately NOT enough:
|
|
167
|
+
// a number directly before a bracket is indistinguishable from a house
|
|
168
|
+
// number, which is exactly the address shape.
|
|
169
|
+
const tokens = line.slice(0, before).trimEnd().split(/\s+/);
|
|
170
|
+
const unit = tokens[tokens.length - 1];
|
|
171
|
+
const quantity = tokens[tokens.length - 2];
|
|
172
|
+
if (unit === undefined || quantity === undefined)
|
|
173
|
+
return false;
|
|
174
|
+
return UNIT_TOKEN.test(unit) && /^\d+(?:[.,]\d+)?$/.test(quantity);
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Units a measured quantity is written in. Tokenized rather than scanned
|
|
178
|
+
* backwards because units themselves contain digits and slashes (`x10^9/L`),
|
|
179
|
+
* which defeats any anchored character-class scan.
|
|
180
|
+
*/
|
|
181
|
+
const UNIT_TOKEN = /^(?:%|°[CF]?|[x×]10\^?-?\d+(?:\/[A-Za-zµ]{1,6})?|mmHg|kPa|bpm|fL|pg|kcal|IU|U|(?:[mkcdµunp]?(?:mol|g|L|l|m|s|Hz|Pa|eq|Gy|Sv)))(?:\/(?:[mkcdµunp]?[Lldgm]\d?|min|h|24h))?$/i;
|
|
182
|
+
/**
|
|
183
|
+
* Attached pre-release suffixes: `-rc.2`, `-beta`, `-SNAPSHOT`.
|
|
184
|
+
*
|
|
185
|
+
* Only ATTACHED markers are consulted. An earlier revision matched version
|
|
186
|
+
* vocabulary near the run and then anywhere on the line; both were wrong in
|
|
187
|
+
* opposite directions — line membership let "Updated", "release" and a legal
|
|
188
|
+
* citation's "v." suppress national identifiers, and requiring adjacency gave
|
|
189
|
+
* back the changelog and Docker-tag errors the rule exists to remove. The
|
|
190
|
+
* structural conditions in the rule carry the decision instead.
|
|
191
|
+
*/
|
|
192
|
+
const PRERELEASE_SUFFIX = /^-(?:rc|alpha|beta|snapshot|dev|pre)\b/i;
|
|
193
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
194
|
+
// Rules
|
|
195
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
196
|
+
/**
|
|
197
|
+
* A digit group inside an international telephone number.
|
|
198
|
+
*
|
|
199
|
+
* National identifier and postal-code patterns are pure digit shapes, so they
|
|
200
|
+
* match happily inside a phone number written in international form. The
|
|
201
|
+
* leading `+` is the conclusive part: it marks an E.164 country prefix, and
|
|
202
|
+
* identifiers are not written with one.
|
|
203
|
+
*/
|
|
204
|
+
const phoneNumberInterior = {
|
|
205
|
+
id: 'phone-run-interior',
|
|
206
|
+
appliesTo: NUMERIC_IDENTIFIERS,
|
|
207
|
+
action: 'suppress',
|
|
208
|
+
principle: 'A digit group that forms part of a run beginning with an international dialling prefix (+) is part of a telephone number, not an independent identifier.',
|
|
209
|
+
risk: 'An identifier written immediately after a phone number with no separating punctuation would be suppressed. The dialling-prefix, single-field and interiority conditions below each independently narrow that.',
|
|
210
|
+
test(ctx) {
|
|
211
|
+
const phone = phoneRunAround(ctx);
|
|
212
|
+
if (phone === undefined)
|
|
213
|
+
return false;
|
|
214
|
+
const run = phone.run.trim();
|
|
215
|
+
// A dialling prefix is '+' followed IMMEDIATELY by a digit. Without this,
|
|
216
|
+
// '+' at the start of a git diff line or a markdown bullet reads as a
|
|
217
|
+
// country code: the M7 review executed '+ 3787 344936 71000' (a Luhn-valid
|
|
218
|
+
// Amex PAN in a bullet list) and '+123-45-6789' (an SSN on an added diff
|
|
219
|
+
// line) and watched both get suppressed.
|
|
220
|
+
if (!/^\+\d/.test(run))
|
|
221
|
+
return false;
|
|
222
|
+
// A telephone number is ONE field. A tab or a run of two or more spaces is
|
|
223
|
+
// a column boundary, so what lies beyond it belongs to a different column
|
|
224
|
+
// — the review found German postal codes suppressed because they sat in
|
|
225
|
+
// the column next to a '+49' phone column in a space-aligned paste.
|
|
226
|
+
if (/\t|\s{2,}/.test(run))
|
|
227
|
+
return false;
|
|
228
|
+
// The run must be an ACTUAL phone number, not merely phone-shaped. A digit
|
|
229
|
+
// count between 7 and 15 was far too loose: single-space column layouts
|
|
230
|
+
// fuse a phone and the next column into one run that still fits the
|
|
231
|
+
// window, and the review executed 'Tel +33 1 23 45 67 75008' suppressing a
|
|
232
|
+
// French postal code. libphonenumber is already bundled for the PHONE
|
|
233
|
+
// detector, so this is the same authority Stage 1 uses, not a new one.
|
|
234
|
+
if (parsePhoneNumberFromString(run)?.isValid() !== true)
|
|
235
|
+
return false;
|
|
236
|
+
// INTERIORITY. The rule's whole claim is that the candidate is PART OF a
|
|
237
|
+
// longer phone number. If the candidate accounts for every digit in the
|
|
238
|
+
// run, it is not interior to anything and the claim is false — that is
|
|
239
|
+
// how a standalone routing number, NPI or card on a '+' line was being
|
|
240
|
+
// suppressed.
|
|
241
|
+
if (phone.digitsBefore + phone.digitsAfter < 1)
|
|
242
|
+
return false;
|
|
243
|
+
// A TRAILING candidate whose prefix is ALREADY a complete valid number is
|
|
244
|
+
// a separate field that a single space fused onto the phone. Germany's
|
|
245
|
+
// variable-length numbering makes '+49 30 901820 10115' parse as valid in
|
|
246
|
+
// full, so validity alone could not separate the postal code from the
|
|
247
|
+
// number; asking whether the phone was already complete without it can.
|
|
248
|
+
if (phone.digitsAfter === 0 && parsePhoneNumberFromString(phone.prefix.trim())?.isValid() === true) {
|
|
249
|
+
return false;
|
|
250
|
+
}
|
|
251
|
+
return true;
|
|
252
|
+
},
|
|
253
|
+
};
|
|
254
|
+
/**
|
|
255
|
+
* A value inside a URI's authority component.
|
|
256
|
+
*
|
|
257
|
+
* `redis://app:secret@host:5432/db` contains something email-shaped and
|
|
258
|
+
* something postal-code-shaped, but the authority is a connection target: its
|
|
259
|
+
* parts are a username, a password, a host and a port. The credential itself
|
|
260
|
+
* remains protected, because the URI as a whole is what the connection-string
|
|
261
|
+
* and credentialled-URL detectors report.
|
|
262
|
+
*/
|
|
263
|
+
const uriAuthorityMember = {
|
|
264
|
+
id: 'uri-authority',
|
|
265
|
+
appliesTo: ['EMAIL', 'POSTAL_CODE', 'NATIONAL_ID', 'TAX_ID', 'DRIVERS_LICENSE'],
|
|
266
|
+
action: 'suppress',
|
|
267
|
+
principle: "A value inside a URI's authority component is a host, port, username or password of a connection target, not an independent address or identifier — but only when the URI actually carries a credential, so that something else reports it.",
|
|
268
|
+
risk: 'An address used as a bare userinfo component could be suppressed with nothing else reporting it. The password requirement below is exactly what prevents that.',
|
|
269
|
+
test(ctx) {
|
|
270
|
+
const authority = uriAuthorityAround(ctx);
|
|
271
|
+
if (authority === undefined)
|
|
272
|
+
return false;
|
|
273
|
+
// The rule's safety rests on the URI as a whole being reported by another
|
|
274
|
+
// detector. The M7 review measured that claim instead of trusting it:
|
|
275
|
+
// for `https://john.doe@example.com`, EMAIL is the ONLY detector that
|
|
276
|
+
// fires — the credentialled-URL and connection-string detectors both
|
|
277
|
+
// require a `user:pass@` form. Suppressing there would have been a silent
|
|
278
|
+
// leak, so an address is only yielded when a password component is
|
|
279
|
+
// present and those detectors therefore cover the URI.
|
|
280
|
+
// (It was previously safe only by accident: the EMAIL detector's span
|
|
281
|
+
// includes the leading `//`, which fell outside the authority. Relying on
|
|
282
|
+
// a span defect is not a safety argument — hence the explicit condition.)
|
|
283
|
+
//
|
|
284
|
+
// The requirement is keyed on POSITION, not on entity type. Keying it on
|
|
285
|
+
// EMAIL alone left the same hole open for every other type: the review
|
|
286
|
+
// executed a Turkish TC Kimlik number used as a bare userinfo username
|
|
287
|
+
// (`https://30214566412@sso…/oauth2/authorize`) and found the national
|
|
288
|
+
// identifier suppressed with nothing else reporting it.
|
|
289
|
+
const at = authority.lastIndexOf('@');
|
|
290
|
+
if (at === -1)
|
|
291
|
+
return true; // No userinfo: the candidate is a host or port.
|
|
292
|
+
const authorityStart = ctx.line.text.lastIndexOf('://', localSpan(ctx).start) + 3;
|
|
293
|
+
const inUserinfo = localSpan(ctx).start < authorityStart + at;
|
|
294
|
+
if (!inUserinfo)
|
|
295
|
+
return true; // Host or port side of the '@'.
|
|
296
|
+
// Userinfo: yield it only when a password component makes the whole URI
|
|
297
|
+
// detectable by the credentialled-URL and connection-string detectors.
|
|
298
|
+
return /^[^@/]*:[^@/]*@/.test(authority);
|
|
299
|
+
},
|
|
300
|
+
};
|
|
301
|
+
/**
|
|
302
|
+
* A bare `host:port` outside a URI.
|
|
303
|
+
*
|
|
304
|
+
* Ports occupy the same 2–5 digit space as many postal codes, and a service
|
|
305
|
+
* address written without a scheme is extremely common in configuration and
|
|
306
|
+
* logs.
|
|
307
|
+
*/
|
|
308
|
+
const hostPort = {
|
|
309
|
+
id: 'host-port',
|
|
310
|
+
appliesTo: ['POSTAL_CODE'],
|
|
311
|
+
action: 'suppress',
|
|
312
|
+
principle: 'A short digit group immediately preceded by a colon and a dotted host name is a network port, not a postal code.',
|
|
313
|
+
risk: 'A postal code written directly after a colon and a dotted token would be suppressed; requiring a host-shaped left side and a value within the valid port range keeps that implausible.',
|
|
314
|
+
test(ctx) {
|
|
315
|
+
const { text } = ctx.line;
|
|
316
|
+
const { start, end } = localSpan(ctx);
|
|
317
|
+
const value = text.slice(start, end);
|
|
318
|
+
// A written port is never zero-padded; short postal codes routinely are
|
|
319
|
+
// (the review executed a Cambridge MA ZIP, 02139, being suppressed).
|
|
320
|
+
if (!/^[1-9]\d{1,4}$/.test(value))
|
|
321
|
+
return false;
|
|
322
|
+
if (Number(value) > MAX_PORT)
|
|
323
|
+
return false;
|
|
324
|
+
if (text[start - 1] !== ':')
|
|
325
|
+
return false;
|
|
326
|
+
// The whitespace-delimited token containing the candidate must be
|
|
327
|
+
// EXACTLY host:port. Testing only the text to the left let a
|
|
328
|
+
// colon-delimited record — `jane.doe@corp.com:8001:Zurich` — read as a
|
|
329
|
+
// host and port and suppress a real postal code, because the left side
|
|
330
|
+
// genuinely ends in a host name.
|
|
331
|
+
let tokenStart = start;
|
|
332
|
+
while (tokenStart > 0 && !/\s/.test(text[tokenStart - 1] ?? ''))
|
|
333
|
+
tokenStart -= 1;
|
|
334
|
+
let tokenEnd = end;
|
|
335
|
+
while (tokenEnd < text.length && !/\s/.test(text[tokenEnd] ?? ''))
|
|
336
|
+
tokenEnd += 1;
|
|
337
|
+
// Normalize the token before requiring the host:port shape. Taking it
|
|
338
|
+
// verbatim was over-tight and gave back most of the errors this rule
|
|
339
|
+
// exists to remove: `db.host=pg.example.net:5432` and
|
|
340
|
+
// `proxy = "gateway.example.com:3128"` are the two commonest config and
|
|
341
|
+
// log shapes, and a `key=` prefix or a quote made both fail.
|
|
342
|
+
const token = text
|
|
343
|
+
.slice(tokenStart, tokenEnd)
|
|
344
|
+
.replace(/^[^\s"'=]*=/, '')
|
|
345
|
+
.replace(/^["'`[]+/, '')
|
|
346
|
+
.replace(/["'`\]]+$/, '')
|
|
347
|
+
.replace(/[:.,;/]+$/, '');
|
|
348
|
+
const hostPort = /^([A-Za-z0-9][A-Za-z0-9.-]*):([1-9]\d{1,4})$/.exec(token);
|
|
349
|
+
if (hostPort === null || hostPort[2] !== value)
|
|
350
|
+
return false;
|
|
351
|
+
return looksLikeHostName(hostPort[1] ?? '');
|
|
352
|
+
},
|
|
353
|
+
};
|
|
354
|
+
/**
|
|
355
|
+
* A bracketed numeric range annotating a measurement.
|
|
356
|
+
*
|
|
357
|
+
* Laboratory results annotate a measured value with its reference interval,
|
|
358
|
+
* and technical documents annotate values with bounds. Both write a numeric
|
|
359
|
+
* range in brackets, which postal-code patterns read as a code with a
|
|
360
|
+
* separator.
|
|
361
|
+
*
|
|
362
|
+
* TIGHTENED after the M7 adversarial safety review (ARCHITECTURE.md D18).
|
|
363
|
+
* The original rule suppressed any bracketed `digits-digits`, which is the
|
|
364
|
+
* exact written form of several national identifiers: the review executed
|
|
365
|
+
* `Borger (010101-1234) er registreret.` and watched a correctly detected
|
|
366
|
+
* Danish CPR number get suppressed — a leak of a national identifier. Three
|
|
367
|
+
* conditions now separate an interval from an identifier:
|
|
368
|
+
*
|
|
369
|
+
* • each side is at most 4 digits — reference intervals are small numbers,
|
|
370
|
+
* whereas national identifier groups are longer (a Danish CPR's first
|
|
371
|
+
* group is 6, a Korean RRN's is 6, a Swedish personnummer's is 8);
|
|
372
|
+
* • the range ascends, because an interval whose low exceeds its high is
|
|
373
|
+
* not an interval;
|
|
374
|
+
* • a measured quantity precedes the bracket, which is the actual reason a
|
|
375
|
+
* reference interval is there at all.
|
|
376
|
+
*/
|
|
377
|
+
const bracketedNumericRange = {
|
|
378
|
+
id: 'bracketed-numeric-range',
|
|
379
|
+
appliesTo: ['POSTAL_CODE', 'NATIONAL_ID', 'TAX_ID'],
|
|
380
|
+
action: 'suppress',
|
|
381
|
+
principle: 'A short, ascending numeric range in brackets that immediately follows a measured quantity is a reference interval, not an identifier.',
|
|
382
|
+
risk: 'A short ascending identifier written as `nnnn-nnnn` in brackets directly after a number could still be suppressed. Identifier groups longer than four digits, descending pairs, and brackets with no preceding measurement are all excluded, which covers the national-identifier formats the review tested.',
|
|
383
|
+
test(ctx) {
|
|
384
|
+
const bracket = bracketedAround(ctx);
|
|
385
|
+
if (bracket === undefined)
|
|
386
|
+
return false;
|
|
387
|
+
const range = /^\s*(\d{1,4})(?:[.,]\d+)?\s*-\s*(\d{1,4})(?:[.,]\d+)?\s*$/.exec(bracket.inner);
|
|
388
|
+
if (range === null)
|
|
389
|
+
return false;
|
|
390
|
+
const lowText = range[1] ?? '';
|
|
391
|
+
const highText = range[2] ?? '';
|
|
392
|
+
// A reference-interval bound is never zero-padded, while short postal
|
|
393
|
+
// codes are zero-padded by definition. The review executed Polish postal
|
|
394
|
+
// codes — `Paczka 3 Warszawa (02-495)` — surviving the size and ascending
|
|
395
|
+
// checks and still being suppressed, because a digit earlier in the line
|
|
396
|
+
// satisfied the measurement test.
|
|
397
|
+
if (/^0\d/.test(lowText) || /^0\d/.test(highText))
|
|
398
|
+
return false;
|
|
399
|
+
if (!(Number(lowText) <= Number(highText)))
|
|
400
|
+
return false;
|
|
401
|
+
return measurementPrecedes(ctx.line.text, bracket.open);
|
|
402
|
+
},
|
|
403
|
+
};
|
|
404
|
+
/**
|
|
405
|
+
* A dotted version number.
|
|
406
|
+
*
|
|
407
|
+
* Release notes, dependency manifests and changelogs are dense with
|
|
408
|
+
* `1.2.3`-shaped values that numeric identifier patterns match.
|
|
409
|
+
*/
|
|
410
|
+
const versionNumber = {
|
|
411
|
+
id: 'version-number',
|
|
412
|
+
appliesTo: NUMERIC_IDENTIFIERS,
|
|
413
|
+
action: 'suppress',
|
|
414
|
+
principle: 'A dotted numeric run of three or more components is a release version when a version introducer sits immediately before it, or it carries an attached pre-release suffix — and only when no detector has claimed the whole run.',
|
|
415
|
+
risk: 'A dotted identifier written directly after a version introducer could be suppressed. The proper-fragment condition means a validated identifier is never suppressed, since a detector that claimed the whole run has already judged it.',
|
|
416
|
+
test(ctx) {
|
|
417
|
+
const { text } = ctx.line;
|
|
418
|
+
const { start, end } = localSpan(ctx);
|
|
419
|
+
let from = start;
|
|
420
|
+
let to = end;
|
|
421
|
+
while (from > 0 && /[\d.]/.test(text[from - 1] ?? ''))
|
|
422
|
+
from -= 1;
|
|
423
|
+
while (to < text.length && /[\d.]/.test(text[to] ?? ''))
|
|
424
|
+
to += 1;
|
|
425
|
+
const run = text.slice(from, to);
|
|
426
|
+
// TIGHTENED TWICE after the M7 safety review (ARCHITECTURE.md D18). Four
|
|
427
|
+
// conditions, each closing an executed leak.
|
|
428
|
+
// (1) Three or more components. Two-component runs are decimals: the
|
|
429
|
+
// review executed an NPI at `1245319599.00` and a routing number at
|
|
430
|
+
// `021000021.00` being read as versions.
|
|
431
|
+
if (!/^\d+(?:\.\d+){2,}$/.test(run))
|
|
432
|
+
return false;
|
|
433
|
+
// An ATTACHED marker — a `-rc.2` suffix, or a `v` with no space before the
|
|
434
|
+
// digits — is conclusive: no identifier is printed that way. A spaced
|
|
435
|
+
// introducer ("version 1.2.3") is weaker, because ordinary words abut
|
|
436
|
+
// numbers all the time.
|
|
437
|
+
const prerelease = PRERELEASE_SUFFIX.test(text.slice(to));
|
|
438
|
+
const attachedV = /[vV]$/.test(text.slice(0, from));
|
|
439
|
+
const conclusive = prerelease || attachedV;
|
|
440
|
+
// (2) Absent a conclusive marker, the candidate must be a PROPER FRAGMENT
|
|
441
|
+
// of the run. If a detector claimed the whole dotted value it has
|
|
442
|
+
// already judged it — usually against a checksum — and this rule has
|
|
443
|
+
// no standing to overrule it. Argentine DNI (20.123.456), Swiss AHV
|
|
444
|
+
// (756.1234.5678.97) and Brazilian CPF are all claimed whole by
|
|
445
|
+
// validating detectors.
|
|
446
|
+
//
|
|
447
|
+
// These two conditions are the whole rule. An earlier revision also
|
|
448
|
+
// required version vocabulary near the run, which was measured to be
|
|
449
|
+
// over-tight: it gave back most of the false positives the rule exists to
|
|
450
|
+
// remove — changelogs, release headings, Docker tags, dependency pins and
|
|
451
|
+
// markdown table cells all stopped being suppressed — while adding no
|
|
452
|
+
// safety, because condition (2) already protects every validated
|
|
453
|
+
// identifier. Fewer conditions, same protection, and the errors die again.
|
|
454
|
+
return from !== start || to !== end || conclusive;
|
|
455
|
+
},
|
|
456
|
+
};
|
|
457
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
458
|
+
// Rules from the M7 error taxonomy (each corrected by the safety review)
|
|
459
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
460
|
+
/** Types whose detector has no checksum — shape and a format table only. */
|
|
461
|
+
const SHAPE_ONLY_TYPES = ['POSTAL_CODE', 'DRIVERS_LICENSE', 'HEALTH_DATA'];
|
|
462
|
+
/**
|
|
463
|
+
* A candidate that is a fragment of a longer delimited token.
|
|
464
|
+
*
|
|
465
|
+
* A fragment guard must be symmetric: if a separator plus a digit immediately
|
|
466
|
+
* BEFORE a candidate proves it is part of something longer, the same shape
|
|
467
|
+
* immediately AFTER proves it too.
|
|
468
|
+
*
|
|
469
|
+
* CORRECTED. The proposed right-edge class included `-`, which collides with
|
|
470
|
+
* the check-digit suffix convention several real schemes use — Chilean RUT
|
|
471
|
+
* `12345678-5`, Argentine CUIT `20-12345678-3`, Brazilian CPF. The hyphen is
|
|
472
|
+
* gone, and the rule is confined to types with no checksum: for a scheme that
|
|
473
|
+
* validates, a PASSING CHECKSUM is positive evidence the characters are the
|
|
474
|
+
* whole identifier, and this rule has no standing against it.
|
|
475
|
+
*/
|
|
476
|
+
const fragmentBoundary = {
|
|
477
|
+
id: 'fragment-boundary',
|
|
478
|
+
appliesTo: SHAPE_ONLY_TYPES,
|
|
479
|
+
action: 'suppress',
|
|
480
|
+
principle: 'A candidate immediately followed by a path or time separator plus a digit, or immediately preceded by one, is a fragment of a longer delimited token rather than a whole identifier.',
|
|
481
|
+
risk: 'An unvalidated identifier written directly against a separator and a digit would be suppressed. The hyphen is excluded because check-digit suffixes use it, and checksummed types are out of scope entirely.',
|
|
482
|
+
test(ctx) {
|
|
483
|
+
const { text } = ctx.line;
|
|
484
|
+
const { start, end } = localSpan(ctx);
|
|
485
|
+
// The left edge requires a DIGIT before the separator, mirroring the right
|
|
486
|
+
// edge. Without that symmetry `/[:/]$/` fired on every colon-delimited
|
|
487
|
+
// field and re-opened postal-code leaks that round two had closed: a ZIP in
|
|
488
|
+
// grep output (`customers.csv:10001`), one under a dotted property path
|
|
489
|
+
// (`kunde.adresse.plz:10115`) and one in a colon-delimited export all carry
|
|
490
|
+
// a colon to their left, and none of them is a fragment of a longer number.
|
|
491
|
+
return /^[/:.]\d/.test(text.slice(end)) || /\d[:/]$/.test(text.slice(0, start));
|
|
492
|
+
},
|
|
493
|
+
};
|
|
494
|
+
/**
|
|
495
|
+
* A short digit group that is one member of a run of digit groups.
|
|
496
|
+
*
|
|
497
|
+
* CORRECTED. The proposal applied this to NATIONAL_ID and TAX_ID as well,
|
|
498
|
+
* which the review identified as a leak for exactly the reason above: a
|
|
499
|
+
* checksum that passes is evidence FOR the candidate, and grouped identifiers
|
|
500
|
+
* (a spaced IBAN, a grouped national number) are written precisely this way.
|
|
501
|
+
* POSTAL_CODE alone — shape-only, and the type the errors were measured on.
|
|
502
|
+
*/
|
|
503
|
+
const digitGroupRunMember = {
|
|
504
|
+
id: 'digit-group-run-member',
|
|
505
|
+
appliesTo: ['POSTAL_CODE'],
|
|
506
|
+
action: 'suppress',
|
|
507
|
+
principle: 'A short digit group flanked by other digit groups separated only by single spaces is one component of a longer grouped number, not a standalone postal code.',
|
|
508
|
+
risk: 'A postal code written with only a space between it and an adjacent number — a house number before it, for instance — would be suppressed. Confined to the one type with no validator.',
|
|
509
|
+
test(ctx) {
|
|
510
|
+
const { text } = ctx.line;
|
|
511
|
+
const { start, end } = localSpan(ctx);
|
|
512
|
+
if (!/^\d{2,5}$/.test(text.slice(start, end)))
|
|
513
|
+
return false;
|
|
514
|
+
return /\d\s$/.test(text.slice(0, start)) && /^\s\d/.test(text.slice(end));
|
|
515
|
+
},
|
|
516
|
+
};
|
|
517
|
+
/** A run of MRZ filler characters, which no natural-language text produces. */
|
|
518
|
+
const MRZ_FILLER = /<{3,}/;
|
|
519
|
+
/**
|
|
520
|
+
* A candidate abutting the delimiters of a different notation.
|
|
521
|
+
*
|
|
522
|
+
* CORRECTED, and this was the most dangerous item in the review. The proposal
|
|
523
|
+
* put `<` and `>` in the generic edge classes to catch passport MRZ filler —
|
|
524
|
+
* but those two characters are the entire syntax of HTML and XML. Executed
|
|
525
|
+
* against the rule as proposed, `<td>943 476 5919</td>`, `<ssn>123456789</ssn>`,
|
|
526
|
+
* `<span>12345</span>`, `<taxId>38694597107</taxId>` and `<td>123-45-6789</td>`
|
|
527
|
+
* were ALL suppressed: five real identifiers un-redacted, in the single most
|
|
528
|
+
* common shape structured data is pasted in. The angle brackets are gone from
|
|
529
|
+
* the generic classes, and MRZ is its own predicate requiring a run of three
|
|
530
|
+
* or more `<`.
|
|
531
|
+
*/
|
|
532
|
+
const notationDelimiter = {
|
|
533
|
+
id: 'notation-delimiter',
|
|
534
|
+
appliesTo: ['POSTAL_CODE', 'SWIFT_BIC', 'NATIONAL_ID', 'TAX_ID'],
|
|
535
|
+
action: 'suppress',
|
|
536
|
+
principle: 'A candidate abutting the delimiters of another notation — a bracketed range, a sexagesimal coordinate, or a run of passport MRZ filler — is a fragment of that notation.',
|
|
537
|
+
risk: 'An identifier deliberately bracketed for emphasis, such as a ticket writing an ID as [NNNNN], would be suppressed. Angle brackets are excluded so that HTML and XML markup cannot trigger it.',
|
|
538
|
+
test(ctx) {
|
|
539
|
+
const { text } = ctx.line;
|
|
540
|
+
const { start, end } = localSpan(ctx);
|
|
541
|
+
const window = text.slice(Math.max(0, start - 40), end + 40);
|
|
542
|
+
if (MRZ_FILLER.test(window))
|
|
543
|
+
return true;
|
|
544
|
+
// Square brackets are deliberately NOT here. `bracketed-numeric-range`
|
|
545
|
+
// already owns them, under conditions the safety review forced it to earn:
|
|
546
|
+
// a real unit, an ascending range, no zero padding. A blanket "anything in
|
|
547
|
+
// brackets" test is strictly weaker, and it suppressed a descending pair
|
|
548
|
+
// that an earlier round established must be kept — while the review itself
|
|
549
|
+
// names bracketing an identifier for emphasis as real usage.
|
|
550
|
+
return /[°′″]$/.test(text.slice(0, start)) || /^[°′″]/.test(text.slice(end));
|
|
551
|
+
},
|
|
552
|
+
};
|
|
553
|
+
/**
|
|
554
|
+
* A high-entropy run inside an inlined binary payload.
|
|
555
|
+
*
|
|
556
|
+
* A data URI declares its own encoding, and everything after the declaration
|
|
557
|
+
* is image or font bytes rather than a credential.
|
|
558
|
+
*/
|
|
559
|
+
const dataUriPayload = {
|
|
560
|
+
id: 'data-uri-payload',
|
|
561
|
+
appliesTo: ['GENERIC_SECRET'],
|
|
562
|
+
action: 'suppress',
|
|
563
|
+
principle: 'A high-entropy run introduced by an explicit content-transfer declaration is an inlined binary payload, not a secret.',
|
|
564
|
+
risk: 'A credential deliberately smuggled inside a data URI, or a secrets file pasted as one, would be missed. The declaration must be an actual base64 content-transfer preamble, which ordinary prose does not contain.',
|
|
565
|
+
test(ctx) {
|
|
566
|
+
const { start } = localSpan(ctx);
|
|
567
|
+
return /;base64,[A-Za-z0-9+/=]*$/i.test(ctx.line.text.slice(0, start));
|
|
568
|
+
},
|
|
569
|
+
};
|
|
570
|
+
/**
|
|
571
|
+
* A vendor-prefixed token whose body carries no information.
|
|
572
|
+
*
|
|
573
|
+
* A credential is a carrier of entropy. `sk_live_XXXXXXXXXXXX` presents a real
|
|
574
|
+
* prefix and then says nothing, which is what documentation does.
|
|
575
|
+
*/
|
|
576
|
+
const uninformativeKeyBody = {
|
|
577
|
+
id: 'uninformative-key-body',
|
|
578
|
+
appliesTo: ['API_KEY'],
|
|
579
|
+
action: 'suppress',
|
|
580
|
+
principle: 'A token carrying a recognised vendor prefix whose remaining body is a single repeated character is a documentation placeholder, not a key.',
|
|
581
|
+
risk: 'A genuine key whose random body happened to be one repeated character. For an 8-character body that is about 62 in 62^8, which is far rarer than the placeholder it removes.',
|
|
582
|
+
test(ctx) {
|
|
583
|
+
const value = ctx.line.text.slice(localSpan(ctx).start, localSpan(ctx).end);
|
|
584
|
+
const body = value.replace(/^[A-Za-z]+[_-]/, '').replace(/^[A-Za-z]{2,4}_/, '');
|
|
585
|
+
if (body.length < 8)
|
|
586
|
+
return false;
|
|
587
|
+
return new Set(body.toLowerCase()).size <= 1;
|
|
588
|
+
},
|
|
589
|
+
};
|
|
590
|
+
/**
|
|
591
|
+
* A commercial or administrative label governing the number after it.
|
|
592
|
+
*
|
|
593
|
+
* CORRECTED to a PENALTY rather than a suppression. The review was explicit
|
|
594
|
+
* that this rule carries the most genuine risk of the set: in healthcare and
|
|
595
|
+
* legal text a "case number" or "claim number" can be exactly the sensitive
|
|
596
|
+
* record identifier, so a hard suppression would remove real findings from
|
|
597
|
+
* precisely the documents where they matter most. As a penalty the evidence
|
|
598
|
+
* still counts and Stage 4 can weigh it.
|
|
599
|
+
*/
|
|
600
|
+
const enumerationLabel = {
|
|
601
|
+
id: 'enumeration-label',
|
|
602
|
+
appliesTo: ['NATIONAL_ID', 'TAX_ID', 'HEALTH_DATA', 'US_ROUTING_NUMBER', 'US_NPI'],
|
|
603
|
+
action: -0.2,
|
|
604
|
+
principle: 'A transaction-sequence noun immediately before a bare digit run governs it: the digits after "order" are an order number.',
|
|
605
|
+
risk: 'In medical and legal documents a case or claim number IS the sensitive record identifier, which is why this reduces confidence rather than suppressing.',
|
|
606
|
+
test(ctx) {
|
|
607
|
+
const { start, end } = localSpan(ctx);
|
|
608
|
+
if (!/^[\d\s.-]+$/.test(ctx.line.text.slice(start, end)))
|
|
609
|
+
return false;
|
|
610
|
+
return ENUMERATION_NOUN.test(ctx.line.text.slice(0, start));
|
|
611
|
+
},
|
|
612
|
+
};
|
|
613
|
+
/**
|
|
614
|
+
* Enumeration nouns across the languages the trigger lexicons cover.
|
|
615
|
+
*
|
|
616
|
+
* `claim` and `case` are deliberately ABSENT: the review named them as the
|
|
617
|
+
* terms whose medical and legal senses are sensitive record identifiers.
|
|
618
|
+
*/
|
|
619
|
+
const ENUMERATION_NOUN = /\b(?:order|invoice|receipt|tracking|shipment|consignment|ticket|reference|ref|purchase order|sku|batch|lot|serial|work order|rma|quote|bestellung|bestellnummer|rechnung|sendungsnummer|auftrag|vorgang|charge|seriennummer|commande|facture|suivi|référence|reference|pedido|factura|seguimiento|referencia|lote|fatura|rastreamento|ordine|fattura|spedizione|riferimento|lotto|bestelling|factuur|zending|zamówienie|faktura|заказ|счёт|накладная|sipariş|fatura|注文|請求書|订单|发票|주문|송장)\s*(?:number|no\.?|nr\.?|num\.?|#|номер|nummer|numéro|número|numero)?\s*[:#-]?\s*$/i;
|
|
620
|
+
/**
|
|
621
|
+
* A value the document itself frames as an illustration.
|
|
622
|
+
*
|
|
623
|
+
* CORRECTED into two rules by action. The review called this risk
|
|
624
|
+
* "substantial and asymmetric": a user writing "for example, my national ID
|
|
625
|
+
* is <real ID>" is handing over a real identifier inside an example frame.
|
|
626
|
+
* So a validated candidate is only PENALIZED, never suppressed — a checksum
|
|
627
|
+
* that passes outweighs a framing word. Shape-only candidates, which have no
|
|
628
|
+
* such evidence, are suppressed.
|
|
629
|
+
*/
|
|
630
|
+
const EXAMPLE_FRAME = /\b(?:for example|e\.?g\.?|example|examples|sample|specimen|demo|sandbox|tutorial|documentation|placeholder|dummy|fake|mock|beispiel|zum beispiel|par exemple|exemple|por ejemplo|ejemplo|per esempio|esempio|por exemplo|exemplo|bijvoorbeeld|voorbeeld|na przykład|przykład|например|пример|örneğin|örnek|例えば|例|例如|예를 들어|예시)\b[^.!?\n]{0,60}$/i;
|
|
631
|
+
const exampleFrameShapeOnly = {
|
|
632
|
+
id: 'example-frame',
|
|
633
|
+
appliesTo: ['POSTAL_CODE', 'DRIVERS_LICENSE'],
|
|
634
|
+
action: 'suppress',
|
|
635
|
+
principle: 'A value the surrounding clause explicitly frames as an example, sample or placeholder is asserted by the document not to be live.',
|
|
636
|
+
risk: 'Someone writing "for example, my postcode is …" gives a real value inside an example frame. Confined to types with no validator, where there is no competing evidence to weigh.',
|
|
637
|
+
test(ctx) {
|
|
638
|
+
return EXAMPLE_FRAME.test(ctx.line.text.slice(0, localSpan(ctx).start));
|
|
639
|
+
},
|
|
640
|
+
};
|
|
641
|
+
const exampleFrameValidated = {
|
|
642
|
+
id: 'example-frame-validated',
|
|
643
|
+
appliesTo: ['NATIONAL_ID', 'TAX_ID', 'CREDIT_CARD', 'IBAN', 'API_KEY', 'GENERIC_SECRET'],
|
|
644
|
+
action: -0.25,
|
|
645
|
+
principle: 'An example frame weakens a validated candidate but does not overturn it: a passing checksum is stronger evidence than a framing word.',
|
|
646
|
+
risk: 'None by construction — this reduces confidence and never suppresses, which is the whole reason it is separate from the shape-only rule.',
|
|
647
|
+
test(ctx) {
|
|
648
|
+
return EXAMPLE_FRAME.test(ctx.line.text.slice(0, localSpan(ctx).start));
|
|
649
|
+
},
|
|
650
|
+
};
|
|
651
|
+
/**
|
|
652
|
+
* The full rule set, in evaluation order.
|
|
653
|
+
*
|
|
654
|
+
* Order is not significant for correctness — every rule is evaluated and the
|
|
655
|
+
* strongest action wins — but keeping the conclusive structural rules first
|
|
656
|
+
* makes traces easier to read.
|
|
657
|
+
*/
|
|
658
|
+
export const NEGATIVE_RULES = [
|
|
659
|
+
phoneNumberInterior,
|
|
660
|
+
uriAuthorityMember,
|
|
661
|
+
hostPort,
|
|
662
|
+
bracketedNumericRange,
|
|
663
|
+
versionNumber,
|
|
664
|
+
fragmentBoundary,
|
|
665
|
+
digitGroupRunMember,
|
|
666
|
+
notationDelimiter,
|
|
667
|
+
dataUriPayload,
|
|
668
|
+
uninformativeKeyBody,
|
|
669
|
+
enumerationLabel,
|
|
670
|
+
exampleFrameShapeOnly,
|
|
671
|
+
exampleFrameValidated,
|
|
672
|
+
];
|
|
673
|
+
/**
|
|
674
|
+
* DELIBERATELY NOT HERE: containment.
|
|
675
|
+
*
|
|
676
|
+
* The M7 error taxonomy proposed four further rules that suppress a candidate
|
|
677
|
+
* because ANOTHER candidate's span covers it — a format-only detector yielding
|
|
678
|
+
* to a validated one, non-sensitivity propagating across schemes, an NER span
|
|
679
|
+
* inside a structured Stage 1 span. Together they account for the largest
|
|
680
|
+
* measured error class in the corpus, and they are all excluded.
|
|
681
|
+
*
|
|
682
|
+
* Two reasons, both ratified rather than assumed. First, ARCHITECTURE.md D19:
|
|
683
|
+
* deciding which of two overlapping type claims wins is Stage 4 resolution,
|
|
684
|
+
* and Stage 3 pre-empting it was exactly the mistake the GENERIC_SECRET
|
|
685
|
+
* measurement exposed. Second, the taxonomy's own highest-priority residual is
|
|
686
|
+
* a SPAN-HYGIENE PREREQUISITE — url-with-credentials and connection-string
|
|
687
|
+
* spans were measured straddling CSV and line boundaries — and containment
|
|
688
|
+
* suppression is only ever as safe as the covering span is correct. Shipping
|
|
689
|
+
* it before that is fixed would let a bad span silently un-redact whatever it
|
|
690
|
+
* wrongly covers.
|
|
691
|
+
*/
|
|
692
|
+
/** True when the rule may act on this entity type. */
|
|
693
|
+
export function ruleApplies(rule, type) {
|
|
694
|
+
return rule.appliesTo === 'all' || rule.appliesTo.includes(type);
|
|
695
|
+
}
|
|
696
|
+
//# sourceMappingURL=negativeRules.js.map
|