Skip to content

pm-aggregator: log every Access write denial with the presented claim - #11465

Merged
dezren39 merged 1 commit into
mainfrom
fix/9603-access-denial-logging
Nov 18, 2026
Merged

dezren39 merged 1 commit into
mainfrom
fix/9603-access-denial-logging

Conversation

@dezren39

@dezren39 dezren39 commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

Closes #9603

Before: with Cloudflare Access configured, the aggregator's write routes (comments, annotations, actions, the actions batch) refused bad or contradictory callers with 401/403 but wrote nothing to the log, so a denied write left no record of who tried or why. That was the remaining acceptance gap on #9603 (the JWT validation itself landed in PR #8645).

After: every denial writes one line like
[access] denied POST /api/comments status=403 reason="asserted drew author contradicts the verified Access identity" claim=sub="access|member-17" email="member@example.com" (verified) asserted="drew:drew".
For a token that fails verification the claim is decoded without trusting it and marked (unverified); with no token it reads claim=none. The token itself is never logged. Claim text is JSON-quoted and capped at 120 characters, so a crafted sub cannot split or forge a log line. A batch logs its shared 401 once and each per-entry 403 separately. Allowed writes and deployments without Access log nothing.

How: the logging lives in createAccessAuthorEnforcer, which every write route already goes through, so no route needed its own change. The logger is an optional parameter (default console.warn) so tests can capture it. presentedAccessClaim() is exported for the unverified decode.

Not in this PR: default-deny for identities with no registry mapping. Per the triage note on #9603 that belongs to split 2, #9604.

Testing: six new tests in test/access-identity.test.ts cover each denial path, the never-log-the-token rule, the no-log-on-success case, batch log counts and log-line injection. Full aggregator bun test: 2907 pass.


Generated by Claude Code


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…#9603)

The Access author enforcer returned 401/403 to the write routes but
logged nothing, so a refused write left no trace of who tried. Each
denial now writes one [access] line naming the method, path, status,
reason, the asserted author and the claim the caller presented: the
verified sub/email for a 403, the unverified decoded sub/email for a
token that failed verification, and "none" when no token was sent.
The token itself is never logged, claim text is JSON-quoted and capped
so it cannot split a line, and a batch logs its shared 401 once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dezren39
dezren39 marked this pull request as ready for review November 18, 2026 01:06
@dezren39
dezren39 requested a review from a team as a code owner November 18, 2026 01:06
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-18T01:08:00.028158Z 970300b Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@dezren39
dezren39 merged commit 06f6fae into main Nov 18, 2026
@dezren39
dezren39 deleted the fix/9603-access-denial-logging branch November 18, 2026 01:06
@coderabbitai

coderabbitai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

impl(pm-stack): aggregator Access JWT validation middleware + default-deny role check on write routes (#1253 split 1)

2 participants