Skip to content

OAuth failures show the provider's description to the owner; Show value flags invisible characters (144) - #145

Merged
jerryfane merged 2 commits into
mainfrom
feat/oauth-error-description
Nov 10, 2026
Merged

jerryfane merged 2 commits into
mainfrom
feat/oauth-error-description

Conversation

@jerryfane

Copy link
Copy Markdown
Contributor

Closes 144. For Jarvis 447488: the Gmail service still gets invalid_client although the owner checked the client ID and secret. Google uses that code both for "The OAuth client was not found." and for "Unauthorized" (wrong secret), and only error_description tells them apart. The keyring dropped it.

Change

  • Owner only: the key page's failing status now ends with provider said: "…". The description is kept apart from the error, so agents' 503 bodies and the audit are unchanged (the existing test asserting that still passes). It is dropped if it contains the refresh token, secret or client ID, or anything but printable ASCII, and is cut at 160 bytes.
  • Show value warns when a single-line value contains a non-ASCII character, often an invisible one from copying, naming its code point and position (e.g. U+200B). It also warns when the value is wrapped in quotes. Nothing changes the stored value.

Evidence

  • TestOAuthFailureDescriptionForTheOwnerOnly: invalid_client plus "Unauthorized" appears in the owner status and not in the agent's 503; descriptions that echo a secret, contain a line break or are non-ASCII are dropped.
  • TestShowValueFlagsInvisibleCharactersAndQuotes: a zero-width space is reported as U+200B at character 11, quotes are flagged, a clean value gets no warning.
  • Full race suite green.

…ue flags invisible characters (144)

Google answers invalid_client both for an unknown client and a wrong secret
and tells them apart only in error_description, which the keyring dropped.
It is now kept apart from the error text: plain ASCII, at most 160 bytes, and
dropped if it echoes the refresh token, secret or client ID. It shows in the
owner's failing status on the key page, never in agents' 503 bodies or the
audit. Show value warns when a single-line value holds a non-ASCII (often
invisible) character, naming its code point and position, or is wrapped in
quotes.
@jerryfane

Copy link
Copy Markdown
Contributor Author

test-check prove: TestShowValueFlagsInvisibleCharactersAndQuotes proven; TestOAuthFailureDescriptionForTheOwnerOnly inconclusive only because it also calls the new oauthDescription. Manual old-code run (old oauth2.go + a shim oauthDescription returning ""): it fails with owner status lacking provider said: "Unauthorized". Passes on this head.

@jerryfane

Copy link
Copy Markdown
Contributor Author

Agent: adspower-fleet-review
Runtime: omp
Job: local-review-review-router-18e6b624eae1348d-1

Decision: approved
Summary: Reviewed the full diff from fb5ad33 to exact head 3d4d994. No blocking correctness findings. Frozen prior verdicts contain no findings for PR #145. Local build, vet, focused tests, and Darwin cross-build passed with CGO disabled. Sandbox permissions prevented CGO/race execution; verified successful exact-head CI coverage instead.

Findings

  • Error wrapper depends on an erased concrete type (P3)
    • detail: The new described closure calls fail, unpacks its three-value result, then asserts that its error is *oauthError. This introduces a hidden dependency on fail's concrete return type and duplicates its constructor interface. Prefer constructing the typed OAuth error directly for non-200 responses, including its checked description, without the wrapper and type assertion.
    • id: R1
    • locator: internal/server/oauth2.go:321-326

Tests Run

  • env CGO_ENABLED=0 go build ./... -> passed
  • env CGO_ENABLED=0 go vet ./... -> passed
  • env CGO_ENABLED=0 go test ./internal/server ./internal/dashboard ./internal/instance -count=1 -> passed all three packages
  • env CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build ./... -> passed
  • go build ./... -> blocked: runtime/cgo cannot read /usr/include/stdc-predef.h (Permission denied)
  • go test -race ./internal/server -run '^TestOAuthFailureDescriptionForTheOwnerOnly$' -count=1 -> blocked by the same CGO header permission restriction
  • CI-verified: go build ./... -> success; run 42836871715 job 129901308208
  • CI-verified: go test -race ./... -count=1 -> success; run 42836871715 job 129901308208

Raw runtime output was retained in local Gitmoot state and is not posted here.

@jerryfane
jerryfane merged commit 041c08a into main Nov 10, 2026
3 checks passed
@jerryfane
jerryfane deleted the feat/oauth-error-description branch November 10, 2026 14:52
@jerryfane

Copy link
Copy Markdown
Contributor Author

Agent: adspower-fleet-review
Runtime: omp
Job: local-review-review-router-18e6b67674adf92d-1

Decision: approved
Summary: Reviewed only the delta from 3d4d994 to e4a0d9e. R1 is resolved; no new correctness or design findings. Local build, vet, and all 10 OAuth tests passed with CGO disabled. Sandbox permissions prevented CGO/race checks locally; verified successful exact-head CI coverage.

Findings

  • R1 resolved: concrete-type-dependent wrapper removed (P3)
    • continues_uid: OAuth failures show the provider's description to the owner; Show value flags invisible characters (144) #145-f1
    • detail: The non-200 path constructs *oauthError directly and attaches the checked description without the described wrapper or type assertion. Verified with CGO_ENABLED=0 go build ./internal/server, CGO_ENABLED=0 go vet ./internal/server, and CGO_ENABLED=0 go test ./internal/server -run '^TestOAuth' -count=1 -v; all passed.
    • file: internal/server/oauth2.go
    • line: 321
    • locator: internal/server/oauth2.go:321-330
    • state: answered

Tests Run

  • go build ./internal/server -> blocked: /usr/include/stdc-predef.h: Permission denied
  • go vet ./internal/server -> blocked: /usr/include/stdc-predef.h: Permission denied
  • go test -race ./internal/server -run '^TestOAuth' -count=1 -v -> blocked: /usr/include/stdc-predef.h: Permission denied
  • CGO_ENABLED=0 go build ./internal/server -> passed
  • CGO_ENABLED=0 go vet ./internal/server -> passed
  • CGO_ENABLED=0 go test ./internal/server -run '^TestOAuth' -count=1 -v -> passed; 10 tests
  • CI-verified: go build ./... -> success; run 42837890637 job 129904878585
  • CI-verified: go vet ./... -> success; run 42837890637 job 129904878585
  • CI-verified: go test -race ./... -count=1 -> success; run 42837890637 job 129904878585

Raw runtime output was retained in local Gitmoot state and is not posted here.

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.

1 participant