Repository navigation
Conversation
|
Thanks for the PR, and for following the dual-implementation workflow. The Node and Python regexes match, the test sets mirror each other, and anchoring on context instead of matching bare 32-hex is the right call. The anchor is narrower than it looks. The pattern allows only non-alphanumeric characters between the keyword and the hex, so any letter in between breaks the match. With made-up keys, Please keep Node and Python identical, and add tests in both for Last, please squash the four commits into one. I'll add the CHANGELOG entry when I merge. |
Use the suggested pattern so DATADOG_API_KEY, lowercase datadog_api_key and the DD-API-KEY header also match; pin the length boundary with a 36-hex negative (replacing the vacuous not-a-real-key negative). Tests added in both Node and Python. Verified: Node secret-patterns.test.ts 60/60 pass; Python Datadog tests pass.
Same Datadog anchor widening in python/rafter_cli/scanners/secret_patterns.py.
Node Datadog tests: DATADOG_API_KEY, lowercase datadog_api_key and DD-API-KEY header detections; 36-hex and bare-MD5 negatives.
Python Datadog tests: DATADOG_API_KEY, lowercase datadog_api_key and DD-API-KEY header detections; 36-hex and bare-MD5 negatives.
|
Thanks for the review! Done:
On squashing: I couldn't rewrite the branch history from here, so the fix landed as separate commits on top — happy for you to squash on merge if that works for you. |
|
Thanks for the quick turnaround. The Python side and both test sets look right. One bug on the Node side, partly our fault for posting the regex raw: in - ...[_.-]?key\b[^a-zA-Z0-9]{0,20}...
+ ...[_.-]?key\\b[^a-zA-Z0-9]{0,20}...The new Node positive tests should fail on CI until that's fixed, which is a good sign that they guard the pattern. Once it's green we'll squash-merge, so no need to squash the commits yourself. |
|
Thanks for catching this — you were right. The pushed file had lost a backslash, so the JS string contained \b (a backspace) instead of a word boundary. Fixed to \b now and verified locally: DD_API_KEY, datadog_api_key and the DD-API-KEY header all match, and the 36-hex negative still does not match. CI should go green on this push; happy for you to squash-merge when ready. |
Fixes #23. Adds a Datadog API key pattern to both implementations (Node secret-patterns.ts, Python secret_patterns.py), following the repo's pattern-addition workflow. Datadog API keys are 32 hex chars and app keys 40 hex chars, normally set as DD_API_KEY / DD_APP_KEY. A bare 32-char hex string is usually an MD5 hash, so the match is anchored on the Datadog context (datadog|DD_API_KEY|DD_APP_KEY) instead of matching any 32-char hex string. Tests in both suites: detects DD_API_KEY= + 32 hex and DD_APP_KEY= + 40 hex; does not match a bare 32-char hex string or a short/non-hex value. Verified: Node secret-patterns.test.ts 56 passed; Python test_regex_scanner.py + test_pattern_engine.py 72 passed (2 pre-existing failures on unreadable-file tests, which also fail on unmodified main when running as root). Feedback welcome — please contact me at ldcuong11@gmail.com, happy to fix any requested changes.