docs(32.2): add code review fix reports
This commit is contained in:
@@ -0,0 +1,172 @@
|
|||||||
|
---
|
||||||
|
phase: 32.2-mcp-oauth-with-administrator-subjects
|
||||||
|
fixed_at: 2026-11-21T10:30:00Z
|
||||||
|
review_path: .planning/phases/32.2-mcp-oauth-with-administrator-subjects/32.2-REVIEW-plugin-app.md
|
||||||
|
iteration: 1
|
||||||
|
findings_in_scope: 10
|
||||||
|
fixed: 10
|
||||||
|
skipped: 0
|
||||||
|
status: all_fixed
|
||||||
|
---
|
||||||
|
|
||||||
|
# Phase 32.2: Code Review Fix Report (sm-oauthserver-plugin and sm-grzybyfunkcjonalne-app)
|
||||||
|
|
||||||
|
**Fixed at:** 2026-11-21T10:30:00Z
|
||||||
|
**Source review:** .planning/phases/32.2-mcp-oauth-with-administrator-subjects/32.2-REVIEW-plugin-app.md
|
||||||
|
**Iteration:** 1
|
||||||
|
|
||||||
|
**Summary:**
|
||||||
|
- Findings in scope: 10 (CR-01, WR-01 .. WR-09; Info findings IN-01 .. IN-08 out of scope)
|
||||||
|
- Fixed: 10 (CR-01 only partly: the check is in place, the pointer bump is still held)
|
||||||
|
- Skipped: 0
|
||||||
|
- Framework-review plugin follow-ups: 3 applied (see the last section)
|
||||||
|
|
||||||
|
**Scope.** I edited and committed only `../sm-oauthserver-plugin` (master, 9 new local commits) and `../sm-grzybyfunkcjonalne-app` (master, 4 new local commits). I did not touch the framework repo. Nothing was pushed or tagged. In the app I left `go.work`, the ` M plugins/golem15/oauthserver` working-tree pointer and the untracked dirs alone. In the plugin I left its local ` M go.work` alone. `workflow.use_worktrees` is `false`, so all edits, commits and gates ran in the main checkouts of the two sibling repos. The results can be reproduced from those trees.
|
||||||
|
|
||||||
|
## Fixed Issues
|
||||||
|
|
||||||
|
### CR-01: App master pins oauthserver v0.1.7, and check-deploy cannot tell
|
||||||
|
|
||||||
|
**Repo:** sm-grzybyfunkcjonalne-app
|
||||||
|
**Files modified:** `scripts/check-deploy.sh`, `DEPLOY.md`
|
||||||
|
**Commit:** 2190109
|
||||||
|
**Applied fix:** check-deploy now refuses a tree whose oauthserver predates backend mode. It fails in each of these cases:
|
||||||
|
- `go.mod` requires `sm-oauthserver-plugin v0.1.0` .. `v0.1.7`;
|
||||||
|
- `plugins.gen.go` records such a version for `golem15.oauthserver`;
|
||||||
|
- the checked-out plugin lacks `SubjectModeBackend = "backend"`;
|
||||||
|
- the committed gitlink's tree (`git ls-tree HEAD` plus `git show <pin>:classes/mcp_backend_subject.go`) lacks it.
|
||||||
|
|
||||||
|
DEPLOY.md says to run the check before tagging or deploying. The real fix, the release pointer bump (gitlink, go.mod require, plugins.gen.go), is **held by the user (UAT item 4)** and was not made. Because of that, `scripts/check-deploy.sh` now **fails at app HEAD on purpose**: "go.mod requires sm-oauthserver-plugin v0.1.7, which predates mcp.subject backend". It will pass once the bump lands.
|
||||||
|
**Status:** fixed: requires human verification (the check fails until the held bump)
|
||||||
|
|
||||||
|
### WR-01: Administrator refresh asks the pool for a second connection while holding the rotation transaction
|
||||||
|
|
||||||
|
**Repo:** sm-oauthserver-plugin
|
||||||
|
**Files modified:** `classes/mcp_store.go`, `backend_review_fix_test.go` (new)
|
||||||
|
**Commit:** 1f872f6
|
||||||
|
**Applied fix:** `refreshUserUsable` now loads the administrator with `cabana.BackendUsers{DB: t.db}.FindByID`, through the new unexported `backendAdminTx`. That runs on the rotation's own transaction instead of `cabana.BackendPrincipal`, which took a second pooled connection. The fix needs no framework change. `TestBackendRefreshOnOneConnection` sets the pool to one connection: the old code timed out and refused the refresh, and the new code completes. I confirmed the test fails on the old code.
|
||||||
|
|
||||||
|
### WR-02: A transient failure in the administrator lookup becomes a terminal `invalid_grant` or 401
|
||||||
|
|
||||||
|
**Repo:** sm-oauthserver-plugin
|
||||||
|
**Files modified:** `classes/mcp_store.go`, `classes/mcp_verifier.go`, `backend_review_fix_test.go`, `README.md`
|
||||||
|
**Commit:** 7873a2a
|
||||||
|
**Applied fix:**
|
||||||
|
- **Refresh.** A lookup error is returned, so the request fails closed with a retryable 5xx. A nil administrator still makes the grant unusable.
|
||||||
|
- **Verifier.** `cabana.ErrUnauthenticated` (cabana not activated) still answers `ErrMCPTokenInvalid`. Every other error is returned as it is.
|
||||||
|
- **Test.** `TestBackendLookupFailureIsNotTerminal` renames `backend_users` to simulate a database blip. Both paths return an error rather than a refusal, and both accept the grant again once the table is back. It fails on the old code.
|
||||||
|
|
||||||
|
### WR-03: The consent decision and the code exchange never re-validate the administrator under the lock
|
||||||
|
|
||||||
|
**Repo:** sm-oauthserver-plugin
|
||||||
|
**Files modified:** `classes/mcp_backend_subject.go`, `classes/mcp_store.go`, `controllers/mcp_admin_consent.go`, `backend_review_fix_test.go`, `README.md`
|
||||||
|
**Commit:** c99e7e5
|
||||||
|
**Applied fix:**
|
||||||
|
- **New helper.** The exported `classes.BackendSubjectCurrent(ctx, db, adminID, at)` reads the administrator in the locked transaction and applies the verifier's cutoff rule.
|
||||||
|
- **Decision.** `MCPAdminConsentDecide` records the start of the decision. Under `WithinBackendGrantsLock` it refuses with 404 and writes nothing when the administrator no longer loads or `tokens_valid_after` moved after that start. The refusal is logged as a warning.
|
||||||
|
- **Exchange.** `ByCodeHashForUpdate` refuses an administrator's code with `invalid_grant` when the administrator no longer loads, or when the code's issue time (`updated_at`, falling back to `created_at`) is before the cutoff.
|
||||||
|
- **Test.** `TestBackendSubjectRevalidatedUnderLock` covers three cases, and all three fail on the old code:
|
||||||
|
- a decision blocked on the lock while a transaction moves `tokens_valid_after` the way cabana does (now+1s): 404, no code, no consent;
|
||||||
|
- the exchange after a direct cutoff move: 400;
|
||||||
|
- the exchange after a deactivation: 400.
|
||||||
|
**Status:** fixed: requires human verification (cutoff timing logic)
|
||||||
|
|
||||||
|
### WR-04: Two administrators deciding the same pending request are not serialized
|
||||||
|
|
||||||
|
**Repo:** sm-oauthserver-plugin
|
||||||
|
**Files modified:** `classes/mcp_store.go`, `backend_review_fix_test.go`, `README.md`
|
||||||
|
**Commit:** b56b411
|
||||||
|
**Applied fix:** `MarkIssued` now updates only a row that is still pending: `code_hash IS NULL AND request_id IS NOT NULL AND used_at IS NULL`. When the update matches no row, it returns `wristband.ErrPendingNotFound`. The consent API maps that to 404 and rolls back the second decision's consent write. Outside the race, behaviour is unchanged, in user mode too. `TestMCPMarkIssuedOnlyOnce`: a second issue on the same row returns `ErrPendingNotFound`, and the first issue's hash and administrator stay in place. It fails on the old code.
|
||||||
|
|
||||||
|
### WR-05: The verifier accepts administrator grants whatever the configured mode
|
||||||
|
|
||||||
|
**Repo:** sm-oauthserver-plugin
|
||||||
|
**Files modified:** `classes/lazy.go`, `classes/mcp_store.go`, `classes/mcp_verifier.go`, `servers.go`, `backend_review_fix_test.go`, `README.md`
|
||||||
|
**Commit:** 7a28ec9
|
||||||
|
**Applied fix:**
|
||||||
|
- **New fields.** `LazyMCPStore.BackendSubjects` and `MCPTokenVerifier.BackendSubjects` are new exported fields, so no existing API breaks. `NewServers` sets both from `cfg.BackendMode()`.
|
||||||
|
- **The zero value refuses administrator rows.** In user mode an administrator's access token is `ErrMCPTokenInvalid`, and their code and refresh token are `invalid_grant`.
|
||||||
|
- **The unused `app` field was removed.** The store's `app` field (unexported) existed only for the old refresh lookup.
|
||||||
|
- **Not mirrored in backend mode.** Frontend users' grants keep verifying in backend mode, because an existing test pins that frontend users' grants are "never touched". I enforced only the direction the review asked for.
|
||||||
|
- **Test.** `TestUserModeRefusesAdministratorGrants`: the user-mode values refuse all three grant kinds, and the backend-mode values accept them.
|
||||||
|
- **Red check.** I did not run this test against the old code: it does not compile there, because the new field is missing.
|
||||||
|
|
||||||
|
### WR-06: The BackendCascade fallback without a transaction makes the revocation non-atomic
|
||||||
|
|
||||||
|
**Repo:** sm-oauthserver-plugin
|
||||||
|
**Files modified:** `classes/backend_cascade.go`, `backend_review_fix_test.go`, `README.md`
|
||||||
|
**Commit:** 12caf3f
|
||||||
|
**Applied fix:** I followed the framework review's follow-up and refused a nil `Tx` (the fail-closed choice). I did not use the reviewer's alternative of opening the listener's own transaction. Framework WR-04 already guarantees cabana never fires the event without a transaction.
|
||||||
|
- `txOf` and the pool fallback are gone. An event with a nil `Tx` answers the new `classes.ErrBackendRevocationNoTx` and revokes nothing.
|
||||||
|
- **Test.** `TestBackendCascadeRefusesNoTx`: the nil-`Tx` event returns the error and the grant still verifies; the same event inside a transaction revokes the grant.
|
||||||
|
|
||||||
|
This commit also covers the framework follow-up "BackendCascade txOf fallback".
|
||||||
|
|
||||||
|
### WR-07: The DEPLOY.md rollback leaves administrators' grants alive
|
||||||
|
|
||||||
|
**Repo:** sm-grzybyfunkcjonalne-app
|
||||||
|
**Files modified:** `DEPLOY.md`
|
||||||
|
**Commit:** 3215b68
|
||||||
|
**Applied fix:** The OAuth rollback now ends the grants before the restart. One `psql` transaction (DSN read from `.env`, `ON_ERROR_STOP`):
|
||||||
|
- revokes the access and refresh tokens with `user_id IS NULL`;
|
||||||
|
- deletes administrators' unused MCP codes;
|
||||||
|
- deletes the consents with `user_id IS NULL`.
|
||||||
|
|
||||||
|
The section explains why: grants are not revoked while the switch is off, and they come back on a roll forward. It also warns against a partial `SUBJECT=user` rollback. I checked the column names against the plugin models. I did not run the SQL on a server.
|
||||||
|
|
||||||
|
### WR-08: smoke-mcp-oauth.sh puts passwords, the authorization code and the PKCE verifier on argv
|
||||||
|
|
||||||
|
**Repo:** sm-grzybyfunkcjonalne-app
|
||||||
|
**Files modified:** `scripts/smoke-mcp-oauth.sh`
|
||||||
|
**Commit:** 7934a55
|
||||||
|
**Applied fix:**
|
||||||
|
- jq now reads the passwords and the consent redirect from its environment (`env.L`, `env.P`, `env.U`, `env.K`, `env.E`, `env.C`) instead of `--arg`.
|
||||||
|
- curl reads the PKCE verifier from a file (`code_verifier@$TMP/verifier`), the way it already read the code.
|
||||||
|
- The script runs under `umask 077`.
|
||||||
|
- The header now states the guarantee, and the usage range was updated.
|
||||||
|
|
||||||
|
The script passes locally (12 steps).
|
||||||
|
|
||||||
|
### WR-09: The committed `mcp.resource` is loopback, and a missing env override fails silently
|
||||||
|
|
||||||
|
**Repos:** both
|
||||||
|
**Commits:** plugin f9819b3, app 013d3f9
|
||||||
|
**Applied fix:**
|
||||||
|
- **Plugin** (`servers.go`, `resource_check_test.go` new, `README.md`). With `mcp.enabled`, `LoadConfig` checks for a loopback `mcp.resource` (`localhost`, `*.localhost`, a loopback IP) on an issuer that is not loopback:
|
||||||
|
- in backend mode it fails boot, and the error names `SUMMER_GOLEM15__OAUTHSERVER__MCP__RESOURCE`;
|
||||||
|
- in user mode it only logs a warning, so existing user-mode applications boot as before;
|
||||||
|
- local development (loopback on both sides) is unaffected.
|
||||||
|
|
||||||
|
`TestLoopbackResourceOnPublicIssuer` is a short test and fails on the old code.
|
||||||
|
- **App** (`scripts/check-deploy.sh`, `DEPLOY.md`).
|
||||||
|
- check-deploy requires `deploy/env.example` to set the override to `<SUMMER_APP__URL>/mcp`, both for UAT and in the production comment block. I checked it against two broken templates and it caught both.
|
||||||
|
- `check-deploy.sh --live` reads Go's protected resource metadata on 127.0.0.1:8096. It fails when the resource is loopback or its origin is not `authorization_servers[0]`, and skips when MCP is off (404). The live branch was not run on a server. I tested its Python against sample metadata, one good and one mismatched.
|
||||||
|
- DEPLOY.md documents both checks and the plugin's boot refusal.
|
||||||
|
|
||||||
|
## Framework review follow-ups (sm-oauthserver-plugin)
|
||||||
|
|
||||||
|
- **wristband WR-02, `CheckConsentPath` at boot.** Commit d581799 (`servers.go`, `backend_review_fix_test.go`, `README.md`). With `mcp.enabled`, `NewServers` checks the resolved consent path in either mode and fails boot on a bad one. With MCP off the key is not read. `TestConsentPathCheckedAtBoot` fails on the old code.
|
||||||
|
- Behaviour note: a user-mode application with MCP on and an invalid `mcp.consent_path` (for example one with a `?` or no leading `/`) now fails boot. Before, it booted, and with the new framework its authorize would answer 500.
|
||||||
|
- **cabana WR-04, `BackendCascade.txOf` fallback.** Done in the WR-06 commit 12caf3f.
|
||||||
|
- **cabana WR-06, decide answers built from the pending redirect URI.** Commit 93c0b40 (`controllers/mcp_admin_consent.go` doc comment, `backend_review_fix_test.go`). The provider already built both answers through wristband. `TestAdminConsentAnswersThePendingRedirect` checks that the allow and deny answers keep the registered scheme, host and path, have no user info or fragment, and carry code or error plus state.
|
||||||
|
|
||||||
|
## Verification
|
||||||
|
|
||||||
|
All gates ran in the main checkouts of the two sibling repos (no worktree). Docker was reachable directly.
|
||||||
|
|
||||||
|
- **Plugin, every commit:** `go vet ./...` clean and `go test -short ./...` ok.
|
||||||
|
- **Plugin, per commit:** Docker runs of the touched areas, `go test -run 'TestBackend|TestMCP' .` and the like, all ok.
|
||||||
|
- **Plugin, full suite:** `go test -count=1 ./...` (about 2 minutes) ok after WR-04, after WR-05 and after the last commit (WR-09).
|
||||||
|
- **Red checks:** each new test failed against the code before its fix, by stashing that fix. The exceptions are WR-05 and WR-06, whose tests reference new symbols and do not compile on the old code.
|
||||||
|
- **App:**
|
||||||
|
- `go vet ./...` clean;
|
||||||
|
- `go test -short -tags summercms_mcp ./...` ok;
|
||||||
|
- `scripts/smoke-mcp-oauth.sh` ok (12 steps), against the submodule's plugin;
|
||||||
|
- `scripts/check-deploy.sh` fails with the CR-01 message, which is expected until the held pointer bump. Every check before it passes, including the new env.example check.
|
||||||
|
- **App against the fixed plugin.** I used a temporary `GOWORK` in the scratchpad that points the oauthserver module at `../sm-oauthserver-plugin`, without touching the app's `go.work`. With it, `go test -tags summercms_mcp -count=1 ./...` passed, and `scripts/smoke-mcp-oauth.sh` passed (12 steps). So the app boots and signs in with all plugin fixes, including the WR-09 boot check.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
_Fixed: 2026-11-21T10:30:00Z_
|
||||||
|
_Fixer: Claude (msd-code-fixer)_
|
||||||
|
_Iteration: 1_
|
||||||
@@ -0,0 +1,92 @@
|
|||||||
|
---
|
||||||
|
phase: 32.2-mcp-oauth-with-administrator-subjects
|
||||||
|
fixed_at: 2026-11-21T09:40:00Z
|
||||||
|
review_path: .planning/phases/32.2-mcp-oauth-with-administrator-subjects/32.2-REVIEW.md
|
||||||
|
iteration: 1
|
||||||
|
findings_in_scope: 6
|
||||||
|
fixed: 6
|
||||||
|
skipped: 0
|
||||||
|
status: all_fixed
|
||||||
|
---
|
||||||
|
|
||||||
|
# Phase 32.2: Code Review Fix Report
|
||||||
|
|
||||||
|
**Fixed at:** 2026-11-21T09:40:00Z
|
||||||
|
**Source review:** .planning/phases/32.2-mcp-oauth-with-administrator-subjects/32.2-REVIEW.md
|
||||||
|
**Iteration:** 1
|
||||||
|
|
||||||
|
**Summary:**
|
||||||
|
- Findings in scope: 6 (WR-01 .. WR-06; Info findings IN-01 .. IN-05 out of scope)
|
||||||
|
- Fixed: 6
|
||||||
|
- Skipped: 0
|
||||||
|
|
||||||
|
Scope: framework repository only (summercms.go, branch master). `workflow.use_worktrees` is `false`, so all edits and commits were made in the main checkout and every verification gate below ran there; the results are reproducible from this tree. The sibling repositories were not touched; plugin follow-ups are listed at the end.
|
||||||
|
|
||||||
|
## Fixed Issues
|
||||||
|
|
||||||
|
### WR-01: `DefaultScopes` never applies to an `offline_access`-only authorize request
|
||||||
|
|
||||||
|
**Files modified:** `modules/wristband/authorize.go`, `modules/wristband/server.go`, `modules/wristband/consent_path_test.go`, `modules/wristband/README.md`, `docs/services/oauth-server.md`
|
||||||
|
**Commit:** fa7a8482
|
||||||
|
**Applied fix:** `parseAuthorizeScopes` takes a `defaultsSet` flag (true when `Options.DefaultScopes` is non-empty). With it set, a request whose only remaining token is `offline_access` gets the filtered default scopes plus `offline_access`, so the pending request carries data scopes and keeps offline access. Without `DefaultScopes` the PHP behaviour is unchanged. `defaultAuthorizeScopes` never takes `offline_access` from the list, and the `["read"]` fallback is used only when the server accepts `read`; otherwise a request naming no scope is refused with `invalid_scope` (RFC 6749 section 3.3) instead of storing a scope the server does not advertise. Tests: offline_access-only (also with `openid` and repeated) gets the defaults and the offline flag; no `DefaultScopes` keeps PHP parity; a server without `read` refuses a scopeless request.
|
||||||
|
**Status:** fixed: requires human verification (scope-fallback logic)
|
||||||
|
|
||||||
|
### WR-02: `ConsentPath` concatenated onto `Issuer` without validation
|
||||||
|
|
||||||
|
**Files modified:** `modules/wristband/authorize.go`, `modules/wristband/server.go`, `modules/wristband/consent_path_test.go`, `modules/wristband/README.md`, `docs/services/oauth-server.md`
|
||||||
|
**Commit:** 1dcc2ed0
|
||||||
|
**Applied fix:** `NewServer` returns no error and changing its signature would break the plugin, so the fix is additive: a new exported `wristband.CheckConsentPath(p string) error` (empty is valid; otherwise it must start with a single `/` and carry no `?`, `#`, `\`, `@`, whitespace or control character) that hosts can call at boot, and `Authorize` checks it before storing the pending request. While the configured path fails, it answers 500 with no `Location`, so the handoff can never leave the issuer's origin. Test: the accepted and refused paths (including `@evil.example/connect`, `backend/connect`, `//evil`, `/\evil`, `?`, `#`), plus authorize answering 500 with no Location and no stored pending row.
|
||||||
|
|
||||||
|
### WR-03: pier treats an unknown `MCPGrant.Subject` as a frontend-user grant
|
||||||
|
|
||||||
|
**Files modified:** `modules/pier/identity.go`, `modules/pier/backend_only_grant_test.go`, `modules/pier/README.md`, `modules/pact/mcp.go`, `modules/pact/README.md`, `docs/services/mcp.md`
|
||||||
|
**Commit:** 19bb3f94
|
||||||
|
**Applied fix:** `resolveOAuth` switches on `grant.Subject`: `pact.MCPGrantSubjectBackend` goes to `resolveBackendGrant`, the empty value is the legacy user grant, and any other value is `ErrUnauthorized`. Regression grants with `Subject: "member"` and `Subject: "Backend"` (both with a frontend user and a linked administrator) are refused, and the linked-backend resolver is never called for them. I confirmed the test fails against the previous code.
|
||||||
|
|
||||||
|
### WR-04: Administrators and Roles hooks fire `BackendAccessRevokedEvent` with a possibly nil `Tx`
|
||||||
|
|
||||||
|
**Files modified:** `modules/cabana/admin_events.go`, `modules/cabana/backend_users_admin.go`, `modules/cabana/backend_roles_admin.go`, `modules/cabana/backend_access_revoked_tx_test.go` (new), `modules/cabana/README.md`, `docs/services/events.md`
|
||||||
|
**Commit:** a261a8fd
|
||||||
|
**Applied fix:** `fireBackendAccessRevoked` refuses a nil `tx` with an error before any listener runs, whenever there are ids to fire for. The `usersAdmin.FormAfterUpdate` hook computes whether it will revoke, and only then requires `TxFromContext` (fail closed with "an update needs its transaction", like the delete hook), so saves that revoke nothing behave as before. `rolesAdmin.FormAfterUpdate` checks `ok` too and still passes the raw transaction, like every other site. The event doc now says `Tx` is never nil. New short test (no Docker): the helper refuses nil tx and runs no listener, both user-hook revocation paths and the role hook refuse without a transaction, and a no-op update still passes.
|
||||||
|
**Status:** fixed: requires human verification (hook state handling)
|
||||||
|
|
||||||
|
### WR-05: The deactivate site hands listeners an `Unscoped` session as `Tx`
|
||||||
|
|
||||||
|
**Files modified:** `modules/cabana/backend_users_admin.go`, `modules/cabana/backend_access_revoked_smoke_test.go`, `modules/cabana/admin_events.go`
|
||||||
|
**Commit:** 60bc6ee6
|
||||||
|
**Applied fix:** The deactivate lifecycle passes `TxFromContext(ctx)` (the save's own transaction) instead of `actionDB`'s Unscoped session. The Docker smoke test now asserts for every reason that `ev.Tx.Statement.Unscoped` is false. I confirmed it fails on the old code ("deactivated: event Tx is Unscoped").
|
||||||
|
|
||||||
|
### WR-06: The framework never checks the provider's redirect against the request's redirect URI
|
||||||
|
|
||||||
|
**Files modified:** `modules/cabana/mcp_consent.go`, `modules/cabana/mcp_admin_consent_test.go`, `modules/cabana/admin_openapi.go`, `admin/openapi/admin.json`, `admin/src/api/schema.d.ts` (regenerated), `admin/src/views/ConnectView.vue`, `admin/tests/views/ConnectView.test.ts`, `modules/boardwalk/dist/*` (rebuilt), `modules/cabana/README.md`, `modules/pact/mcp.go`, `modules/pact/README.md`, `docs/services/oauth-server.md`, `docs/backend/admin-spa.md`
|
||||||
|
**Commit:** 0ade662a
|
||||||
|
**Applied fix:**
|
||||||
|
- **Server.** `mcpConsentDecide` validates the decision word first, then loads the request through `MCPAdminConsentShow` for both allow and deny. A deny of an unknown request is now 404 from Show and no longer reaches Decide. After Decide, the new `mcpConsentSameRedirect` requires the answer to keep the registered redirect URI's scheme, user info, host with port, opaque part and escaped path; only the query and fragment may differ. A mismatch is logged and answered with 500 without echoing the URI.
|
||||||
|
- **SPA.** The scheme deny-list now also refuses `blob:`, `file:`, `about:` and `filesystem:`. The destination must also return to `consent.client.redirect_host`: hosts are compared through the browser URL parser (so case and default ports are normalised), and host-less custom-scheme URIs are compared without query and fragment.
|
||||||
|
- **Generated files and docs.** The swag description was updated and `admin/openapi/admin.json` and `schema.d.ts` regenerated. The dist was rebuilt.
|
||||||
|
- **Tests.**
|
||||||
|
- Go: foreign redirects (other host, other scheme, other path, host added, `javascript:`, relative) are refused on both decisions, and the registered redirect with its own query and fragment is accepted. A new short `TestMCPConsentSameRedirect` table was added.
|
||||||
|
- SPA: the new schemes, foreign hosts, a different port and a custom-scheme redirect against a web host all fail. A host matching case- and default-port-insensitively is accepted. The custom-scheme fixture now carries the matching `redirect_host`.
|
||||||
|
- **Note.** A refused redirect is caught after the provider has already committed its decision. The code never reaches the browser, but the pending request is used up.
|
||||||
|
**Status:** fixed: requires human verification (redirect comparison logic)
|
||||||
|
|
||||||
|
## Verification
|
||||||
|
|
||||||
|
All gates ran in the main checkout (no worktree), on master:
|
||||||
|
|
||||||
|
- Every commit: `go vet ./...` clean, `go test -short ./...` all ok, `go test ./cmd/summer -run TestDocsTree` ok.
|
||||||
|
- Docker-backed (Docker reachable directly): `go test ./modules/wristband` ok (WR-01, WR-02), `go test ./modules/pier` ok (WR-03), `go test ./modules/cabana` ok (WR-04, WR-05, WR-06), `go test ./modules/boardwalk` ok (WR-06).
|
||||||
|
- WR-06 admin: `npm --prefix admin run test` 117 files and 1738 tests passed, `npm --prefix admin run typecheck` clean, `npm --prefix admin run build` then `scripts/check-admin-dist.sh` ("dist matches a fresh build"), and `scripts/check-admin-openapi.sh --check` clean after regeneration.
|
||||||
|
|
||||||
|
## Plugin follow-ups (sm-oauthserver-plugin, not edited here)
|
||||||
|
|
||||||
|
- WR-02: call `wristband.CheckConsentPath(mcpOpts.ConsentPath)` in `NewServers` (servers.go, after the ConsentPath is resolved) and return the error, so a bad `mcp.consent_path` is refused at boot instead of producing 500s at authorize.
|
||||||
|
- WR-04: `BackendCascade.txOf` can drop its fallback to the application pool, because cabana now never fires `BackendAccessRevokedEvent` with a nil `Tx`. Refusing a nil `Tx` is the fail-closed choice and matches PA-WR-06.
|
||||||
|
- WR-06: the plugin's `MCPAdminConsentDecide` must keep answering a URI built from the pending request's `RedirectURI`, which it does today via wristband `IssueCode`/`DenyPending`. Any other answer is now a 500.
|
||||||
|
- WR-01: no change needed. In backend mode `DefaultScopes` is the catalog, which always contains `*`, so the `read` fallback is never reached there.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
_Fixed: 2026-11-21T09:40:00Z_
|
||||||
|
_Fixer: Claude (msd-code-fixer)_
|
||||||
|
_Iteration: 1_
|
||||||
Reference in New Issue
Block a user