Skip to content

[self-care:server-go-logging] Extract token broker policy parsing with diagnostic logging - #20348

Merged
mnkiefer merged 1 commit into
mainfrom
self-care/server-go-logging-tokenbroker-policy-19d0662ce7e04527
Nov 7, 2026
Merged

mnkiefer merged 1 commit into
mainfrom
self-care/server-go-logging-tokenbroker-policy-19d0662ce7e04527

Conversation

@mnkiefer

@mnkiefer mnkiefer commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Splits tokenbroker.Service.authorized into three testable units (readPolicyFile, parseWorkflowRules, ruleAllows) with unchanged fail-closed behavior, and adds cao:tokenbroker debug logging for policy denials.

Action: Reviewer should confirm the refactor preserves authorization semantics; acceptance check is passing go -C server vet ./... and go -C server test ./....

Diagnostic value and privacy

Up to three disabled-by-default log calls, one per denial reason (unreadable, invalid_policy, no_matching_rule with a rule count). No identities, refs, SHAs, paths, policy contents or error text are logged, and control flow is unchanged.

Tests

New policy_rules_test.go uses real values and temp files, no mocks:

  • valid, empty, duplicate, oversized (>128), wildcard, missing-field, non-object, duplicate-member and invalid-UTF-8 policies
  • exact-match requirement per identity field
  • 1 MiB file bound (at and over)
Validation

gofmt, go -C server vet ./... and go -C server test ./... all pass. Diff scanned: no secrets.

Control Plane

Generated by SelfCare / Server Go Logging · copilot · auto · ~42 AIC · ⌖ ~1 AIC · ⊞ 14.9K · ◷

  • expires on Nov 14, 2026, 8:00 AM UTC

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mnkiefer
mnkiefer marked this pull request as ready for review November 7, 2026 14:54
@mnkiefer
mnkiefer requested a review from pelikhan as a code owner November 7, 2026 14:54
@mnkiefer
mnkiefer merged commit 3d406df into main Nov 7, 2026
29 of 30 checks passed
@mnkiefer
mnkiefer deleted the self-care/server-go-logging-tokenbroker-policy-19d0662ce7e04527 branch November 7, 2026 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant