Repository navigation
fix(security): linear-time email redaction and read-only CI token - #31
Conversation
redactSensitiveText's email pattern restarted at every offset of a long run with no '@' (CodeQL js/polynomial-redos): 50,000 '+' took ~1.6 s. A lookbehind now anchors each match at the start of a run. Regression test included. CI gets permissions: contents: read (actions/missing-workflow-permissions). Closes Digitizers/digitizer-tasks#192 (with the PR merged). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2d2e03237a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| .replace(/[\w.+-]+@[\w.-]+/g, "[REDACTED]") | ||
| // The lookbehind anchors each match at the start of a run, so a long run of | ||
| // local-part characters with no "@" is scanned once instead of once per offset. | ||
| .replace(/(?<![\w.+-])[\w.+-]+@[\w.-]+/g, "[REDACTED]") |
There was a problem hiding this comment.
Preserve redaction of adjacent email matches
When free text contains addresses joined by +, such as first@example.com+second@example.com, the first match consumes first@example.com, but the new lookbehind prevents the next match from starting because its preceding character belongs to the consumed domain. The result is [REDACTED]+second@example.com, whereas the previous pattern redacted both addresses. This also exposes the second address through redactSumitPayload when it appears in diagnostic text. Preserve matching at the end of a previously consumed match while retaining the linear-time behavior.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in a041e6f: dropped the lookbehind and capped the local part at 64 characters (RFC 5321) instead. first@example.invalid+second@example.invalid now gives [REDACTED][REDACTED], and the test covers it. 50,000 + now take ~9 ms, 200,000 a ~32 ms. One trade-off: a local part longer than 64 characters keeps its first characters visible; real addresses can't exceed 64.
The lookbehind stopped a second address from matching right after the first
one's domain (first@a.com+second@b.com left the second unredacted; Codex P2).
A {1,64} bound on the local part (RFC 5321 limit) keeps the scan linear and
redacts adjacent addresses. Test covers the adjacent case.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
@codex review |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Fixes the two open CodeQL alerts (digitizer-tasks#192).
js/polynomial-redos(src/index.ts):redactSensitiveTextrestarted at every offset of a long run of[\w.+-]with no@, so input from the library's callers could take quadratic time. 50,000+characters took about 1.6 s.(?<![\w.+-])anchors each match at the start of a run. Matches and output are unchanged.actions/missing-workflow-permissions: CI now runs withpermissions: contents: read.Local:
pnpm typecheckclean,pnpm test38/38.🤖 Generated with Claude Code