[WRONG BRANCH] fix(lab): redact digit-suffixed upstream hosts - #253
[WRONG BRANCH] fix(lab): redact digit-suffixed upstream hosts#253luvs01 wants to merge 1 commit into
Conversation
|
✅ Deterministic PR hygiene checks passed. |
📝 WalkthroughWalkthroughThe change narrows dotted namespace detection in ChangesHostname Sanitization
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
⏳ DRAFT
What to do
Its title has been prefixed with |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 56ddeb8ac3
ℹ️ 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".
| * marker exemption. Under a STRONG marker the marker always decides. | ||
| */ | ||
| const DOTTED_NAMESPACE_RE = /^[a-z]+(?:\.[a-z]+)*\.[a-z]+[0-9]*$/i; | ||
| const DOTTED_NAMESPACE_RE = /^(?:[a-z]+(?:\.[a-z]+)+|[a-z]+(?:\.[a-z]+)*\.metric\.p[0-9]+)$/i; |
There was a problem hiding this comment.
Handle a trailing dot before validating upstream hosts
When a digit-suffixed host ends the diagnostic or uses FQDN root notation, such as upstream api.v2., WEAK_HOST_CONTEXT_RE includes the terminal dot in name; CONTEXTUAL_HOST_TOKEN_RE then rejects the candidate, so this new predicate is never consulted and the raw hostname is persisted. Strip and preserve a terminal punctuation/root dot before applying the predicates, or adjust the capture so the host candidate excludes it, and add this form to the regression test.
AGENTS.md reference: AGENTS.md:L233-L234
Useful? React with 👍 / 👎.
Motivation
upstreamnamespace exemption allowed digit-suffixed final labels (e.g.internal.service1,db.prod1,api.v2) to be treated as namespaces and persisted unredacted, leaking provider-controlled host identifiers.<name>.metric.p<digits>metric form while preventing other digit-suffixed dotted identifiers from escaping redaction.Description
DOTTED_NAMESPACE_REwith a narrower regex that only accepts pure dotted alphabetic namespaces or the explicit*.metric.p<digits>diagnostic form (src/lab/artifacts/sanitize.ts).DOTTED_NAMESPACE_REto document the narrower exemption and rationale (src/lab/artifacts/sanitize.ts).upstream internal.service1 unavailable,upstream db.prod1 unavailable, andupstream api.v2 unavailableare redacted toupstream [host] unavailable(tests/lab-evidence-sanitization.test.ts).Testing
bun run typecheck, which completed successfully.bun run privacy:scan, which completed successfully.bun run test -- tests/lab-evidence-sanitization.test.ts, where the sanitizer-boundary tests including the new regressions passed; two unrelated activation tests in that file failed due to pre-existing synthetic live-result receipts not presenting a trusted execution receipt (these failures are not caused by the sanitizer change).bun run test; the run was not driven to a green full-suite result because of unrelated timeouts and fixture-state failures elsewhere in the suite that predate this change.Codex Task
Summary by CodeRabbit
Bug Fixes
Tests