Skip to content

Refuse a placeholder OAuth client ID on connect and edit (146) - #147

Merged
jerryfane merged 3 commits into
mainfrom
feat/oauth-client-id-check
Nov 10, 2026
Merged

jerryfane merged 3 commits into
mainfrom
feat/oauth-client-id-check

Conversation

@jerryfane

Copy link
Copy Markdown
Contributor

Closes 146. Jarvis 447635: the Gmail service's saved client_id was the literal PASTE_YOUR_CLIENT_ID_HERE; Google answered invalid_client.

Change

  • clientIDProblem (dashboard) refuses a client ID containing PASTE, YOUR, CLIENT_ID, < or > (case-sensitive: Google's IDs are lowercase, so a real one never matches; spaces are already refused by policy).
  • For token URL host oauth2.googleapis.com or accounts.google.com, the ID must end in .apps.googleusercontent.com.
  • Called on connect (pasted settings) and on the service edit form. Deliberately not in policy.Validate: a config already holding such an ID must still load, or every service would stop at upgrade.
  • TestEditOAuthServiceFixesAWrongClientID used CLIENT_ID as its wrong ID; now wrong.apps.googleusercontent.com (same intent: a wrong but well-formed ID).

Evidence

  • New TestOAuthPlaceholderClientIDRefused: placeholder, non-Google and angle-bracket IDs get 400 on connect with the message and nothing saved; a real ID connects; editing to a placeholder gets 400 and keeps the old ID.
  • Full race suite green.

A saved PASTE_YOUR_CLIENT_ID_HERE made Google answer invalid_client. Connect
and the service edit form now refuse a client ID containing PASTE, YOUR,
CLIENT_ID or angle brackets (uppercase only; Google's IDs are lowercase),
and, for oauth2.googleapis.com or accounts.google.com, one not ending in
.apps.googleusercontent.com. Not checked on config load, so a running config
still starts.
@jerryfane

Copy link
Copy Markdown
Contributor Author

test-check prove: TestOAuthPlaceholderClientIDRefused proven (red on old, green here). TestEditOAuthServiceFixesAWrongClientID not_red_on_old, as intended: only its fixture changed (wrong ID CLIENT_ID → wrong.apps.googleusercontent.com, because the old fixture is now refused); its behaviour is unchanged on both heads.

@jerryfane

Copy link
Copy Markdown
Contributor Author

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

Decision: changes_requested
Summary: Reviewed the full diff from 041c08a to b9fd632. Reproduced rejection of valid non-Google client IDs on connect and edit. No prior findings were recorded. Local pure-Go build, vet, and focused tests passed. Sandbox permissions prevented Cgo/race execution; verified successful exact-head CI coverage instead. No additional design-only findings.
Severity: P2

Findings

  • Do not reject valid opaque OAuth client IDs by substring (P2)
    • detail: The placeholder check applies to every provider, but uppercase substrings do not establish that an OAuth client ID is a placeholder. An external behavioral harness demonstrated that REPORTING_CLIENT_ID and WORKYOURWAY both pass policy validation and complete a local token refresh and API request with HTTP 200, yet dashboard connect returns 400. An unrelated test_path edit of either working configuration also returns 400. Google's lowercase convention cannot justify restricting generic OAuth IDs. Recognize complete template values or explicit placeholder syntax rather than banning these substrings inside otherwise valid IDs.
    • id: F1
    • locator: internal/dashboard/dashboard.go:922-925; internal/dashboard/services.go:227-230; external reproduction: TestReviewValidOpaqueClientIDs in /tmp/gmr-db02d7b9/keyring-pr147-review-jug9b_d6/review_valid_client_id_test.go

Tests Run

  • go build ./... && go vet ./... -> failed during build: /usr/include/stdc-predef.h permission denied; vet not reached
  • go test -race ./internal/dashboard -count=1 -> build failed: /usr/include/stdc-predef.h permission denied
  • env CGO_ENABLED=0 go build ./... && env CGO_ENABLED=0 go vet ./... -> passed
  • env CGO_ENABLED=0 go test ./internal/dashboard ./internal/policy ./internal/server -count=1 -> all three packages passed
  • env CGO_ENABLED=0 go test -overlay=/tmp/gmr-db02d7b9/keyring-pr147-review-jug9b_d6/overlay.json ./internal/dashboard -run '^TestReviewValidOpaqueClientIDs$' -count=1 -v -> failed as expected: both valid IDs received 400 on connect/edit despite successful refresh/API requests
  • CI-verified: go build ./... -> success; run 42841029320 job 129915967944
  • CI-verified: go vet ./... -> success; run 42841029320 job 129915967944
  • CI-verified: go test -race ./... -count=1 -> success; run 42841029320 job 129915967944

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

…ID only (#147 review F1)

REPORTING_CLIENT_ID or WORKYOURWAY are valid opaque IDs elsewhere. Match
template values instead: starts with PASTE_/YOUR_/ENTER_/INSERT_/REPLACE_,
ends in _HERE, is just client_id, or uses <...>, {{ or ${ syntax. An edit
that keeps the client ID and token URL is not refused for them.
@jerryfane

Copy link
Copy Markdown
Contributor Author

F1 fixed in 6d208da: only whole template shapes count (starts PASTE_/YOUR_/ENTER_/INSERT_/REPLACE_, ends _HERE, is client_id, or <…>/{{/${); REPORTING_CLIENT_ID, WORKYOURWAY, your.app.client pass. The edit form checks the client ID only when it or the token URL changes, so an unrelated edit of an existing config is never refused (tested with a stored PASTE_YOUR_CLIENT_ID_HERE). Full race suite green.

@jerryfane

Copy link
Copy Markdown
Contributor Author

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

Decision: changes_requested
Summary: Reviewed only b9fd632..6d208da. F1 is partially fixed but remains unresolved: valid opaque IDs are still rejected. Pure-Go build, vet, and focused tests passed. Sandbox header permissions prevent local Cgo/race checks; successful exact-head CI coverage verified. No additional design-only findings. No repository files changed.
Severity: P2

Findings

  • Do not reject valid opaque OAuth client IDs by substring (P2)
    • continues_uid: Refuse a placeholder OAuth client ID on connect and edit (146) #147-f1
    • detail: Checked with TestReviewValidOpaqueClientIDs. REPORTING_CLIENT_ID and WORKYOURWAY now connect and edit successfully; unrelated edits are fixed. However, the regex still rejects arbitrary instruction-prefixed IDs and IDs ending in _here. enter_47f9e2 and app_here pass policy validation and complete local token refreshes and API requests with HTTP 200, but dashboard connect and changing an existing service to either ID return HTTP 400. These lowercase IDs were not rejected by the previous predicate. Match complete template values or explicit placeholder syntax instead of reserving opaque prefixes/suffixes.
    • file: internal/dashboard/dashboard.go
    • line: 936
    • locator: internal/dashboard/dashboard.go:923-924,933-936; internal/dashboard/services.go:227-231; /tmp/gmr-c63f5f40/pr147-review-7c0korxe/review_valid_client_id_test.go:TestReviewValidOpaqueClientIDs
    • state: answered

Tests Run

  • go build ./... -> failed: sandbox denied runtime/cgo access to /usr/include/stdc-predef.h
  • go vet ./... -> failed: same sandbox Cgo header restriction
  • go test ./internal/dashboard ./internal/policy ./internal/server -run 'OAuth|Service|Connect' -count=1 -> failed to build: same sandbox Cgo header restriction
  • env CGO_ENABLED=0 go build ./... -> passed
  • env CGO_ENABLED=0 go vet ./... -> passed
  • env CGO_ENABLED=0 go test ./internal/dashboard ./internal/policy ./internal/server -run 'OAuth|Service|Connect' -count=1 -> passed all three packages
  • env CGO_ENABLED=0 go test -overlay=/tmp/gmr-c63f5f40/pr147-review-7c0korxe/overlay.json ./internal/dashboard -run '^TestReviewValidOpaqueClientIDs$' -count=1 -v -> failed: enter_47f9e2 and app_here rejected on connect and changed-ID edit despite successful refresh/API calls; other three cases passed
  • CI-verified: go build ./... -> success; run 42842395624 job 129920757192
  • CI-verified: go vet ./... -> success; run 42842395624 job 129920757192
  • CI-verified: go test -race ./... -count=1 -> success; run 42842395624 job 129920757192

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

…nd 2)

enter_47f9e2 or app_here are opaque IDs. Refuse only a whole template for
the field itself (optional PASTE_/ENTER_/INSERT_/PUT_/REPLACE_, optional
YOUR_, optional OAUTH_/GOOGLE_, CLIENT_ID, optional _HERE) or explicit
<...>, {{ or ${ syntax.
@jerryfane

Copy link
Copy Markdown
Contributor Author

F1 round 2 in 8406ee4: the rule now refuses only a complete template value for the field (e.g. PASTE_YOUR_CLIENT_ID_HERE, YOUR_CLIENT_ID, client_id, Enter-Your-OAuth-Client-ID-Here) or explicit <…>, {{ or ${ syntax. enter_47f9e2, app_here, client_id_7f3, REPORTING_CLIENT_ID, WORKYOURWAY pass (in the test). Google host suffix rule unchanged. Full race suite green.

@jerryfane

Copy link
Copy Markdown
Contributor Author

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

Decision: approved
Summary: Reviewed only 6d208da..8406ee4. F1 is resolved; no new correctness or design findings. Local pure-Go build, vet, and focused tests passed. Sandbox permissions prevented local Cgo/race checks; successful exact-head CI coverage verified. No files changed.

Findings

  • Resolved: valid opaque OAuth client IDs are no longer rejected by prefix or suffix (P2)
    • continues_uid: Refuse a placeholder OAuth client ID on connect and edit (146) #147-f1
    • detail: Executed TestOAuthPlaceholderClientIDRefused at this head: REPORTING_CLIENT_ID, WORKYOURWAY, enter_47f9e2, app_here and client_id_7f3 pass the production validator. Complete template values remain rejected. Focused connect/edit tests also passed, including preserving unrelated edits to existing configurations. The regex now anchors complete template names rather than reserving arbitrary instruction prefixes or _here suffixes.
    • file: internal/dashboard/dashboard.go
    • line: 937
    • locator: internal/dashboard/dashboard.go:922-937; internal/dashboard/oauth2_connect_test.go:202-258; executed TestOAuthPlaceholderClientIDRefused
    • state: answered

Tests Run

  • env CGO_ENABLED=0 go build ./internal/dashboard ./cmd/keyring -> passed
  • env CGO_ENABLED=0 go vet ./internal/dashboard ./cmd/keyring -> passed
  • env CGO_ENABLED=0 go test ./internal/dashboard -run 'Test(ConnectOAuth2ServiceFromPastedSettings|ConnectOAuth2RefusesASecretValue|ServicePageShowsOAuthSettings|EditOAuthServiceFixesAWrongClientID|OAuthPlaceholderClientIDRefused)$' -count=1 -v -> all five passed
  • go build ./internal/dashboard ./cmd/keyring -> sandbox-blocked: /usr/include/stdc-predef.h permission denied
  • go vet ./internal/dashboard ./cmd/keyring -> sandbox-blocked: /usr/include/stdc-predef.h permission denied
  • go test -race ./internal/dashboard -run 'Test(ConnectOAuth2ServiceFromPastedSettings|ConnectOAuth2RefusesASecretValue|ServicePageShowsOAuthSettings|EditOAuthServiceFixesAWrongClientID|OAuthPlaceholderClientIDRefused)$' -count=1 -v -> sandbox-blocked: /usr/include/stdc-predef.h permission denied
  • CI-verified: go build ./... -> success; run 42843778857 job 129925651364
  • CI-verified: go vet ./... -> success; run 42843778857 job 129925651364
  • CI-verified: go test -race ./... -count=1 -> success; run 42843778857 job 129925651364
    Diagnostics: workflow advance failed: review approval held: no observed pull request row records a current head for Refuse a placeholder OAuth client ID on connect and edit (146) #147, so this approval cannot be shown to be bound to it

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

@jerryfane
jerryfane merged commit 94cad50 into main Nov 10, 2026
3 checks passed
@jerryfane
jerryfane deleted the feat/oauth-client-id-check branch November 10, 2026 15:26
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