Repository navigation
feat(activity): name the caller on config, quarantine and token-rotation rows - #1842
Merged
Merged
Conversation
…ion rows (#1698) Three audit gaps from #1698, none needing a schema change: - Caller identity on config_change and quarantine_change rows. The authenticated caller rides in the request context (ContextWithActor / RequestActor; the REST door stamps it in a middleware after authentication, the MCP management tools stamp the mcp surface) and the runtime copies it onto the activity event: actor_kind, actor_name, surface and request_id, the profile_change vocabulary. A change with no caller (file reload, admission gate at load) carries none of them. - REST / CLI server changes record a row. POST/PATCH/DELETE /servers, the quarantine toggles, security approve, enable/disable and a restart that re-enables a disabled server write server_added / server_updated (changed fields and their before/after values, computed against the committed entry) / server_removed (with the purge summary) / server_enabled|disabled, through the existing redaction. The MCP tool, which already recorded add/remove, now carries the agent's identity. - Token regenerate records a rotate row. POST /tokens/{name}/regenerate goes through CredentialsService.Regenerate, which writes one profile_change row with change rotate, the actor and the old/new token_prefix (never a secret); the store's refusals keep their sentinels so the 404 / 409 mapping is unchanged. Docs: activity-log.md (doors, actions, "Who changed it"), agent-tokens.md, mcp-credential-lifecycle.md. Co-Authored-By: Claude Fable 5.1 <[email protected]>
1 task done
Deploying mcpproxy-docs with
|
| Latest commit: |
d4ffdcf
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://7eccaaf7.mcpproxy-docs.pages.dev |
| Branch Preview URL: | https://claude-1698-audit-actor-gaps.mcpproxy-docs.pages.dev |
The round-8 door scan (internal/oauth TestNoDoorPublishesARawServerLeaf) flagged serverAddedValues: it copied sc.URL and sc.Command into a payload map and relied on the caller to redact. The two leaves now pass through redactActivityValue as they are read, so the function is a routed door on its own and the caller no longer re-redacts. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Contributor
📦 Build ArtifactsWorkflow Run: View Run Available Artifacts
How to DownloadOption 1: GitHub Web UI (easiest)
Option 2: GitHub CLI gh run download 42487070854 --repo smart-mcp-proxy/mcpproxy-go
|
|
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
2 tasks done
Dumbris
added a commit
that referenced
this pull request
Nov 25, 2026
## Summary Phase two of #1698: a spec, with no implementation, for a fourth audit-log event kind, `admin_action`. Each line records who changed the rules, on the synchronous audit JSONL stream that log shippers read. Phase one (#1842) put the caller on activity rows. This spec lifts that record onto the audit file. Files under `specs/133-admin-action-audit/`: - `spec.md`: user stories in the reporter's priority order (tokens, then approvals, then config), FR-001–FR-023, and assumptions A1–A6. - `contracts/admin-action-line.md`: the line key by key, the full action list mapped to its doors and branches, the exemptions, the caller rules, and how values are redacted. - `inventory.md`: every administrative write door and what it records today, with file:line evidence. It includes the gaps phase one left, such as token hard delete, tool approvals with no actor, keyring secrets, `POST /config/apply`, file-watcher reloads and the server-edition handlers. - `plan.md`: design, the PR slicing (PR-1 to PR-5, each mergeable alone), the tests that pin each door, and five deferred design items, each settled in the PR that implements it. - `research.md`: decisions D1–D9 and the alternatives each one beat. ## Decisions - **Schema**: an additive change within `schema_version: 1`, following the published versioning rule. A shipper filtering on `schema_version == 1` keeps working. A validator holding a cached copy of the v1 schema rejects `admin_action` lines, because `event` and `caller.kind` are closed enums. The spec makes the docs say so. - **Caller**: the audit file's existing `caller` object, built the same way as on `authz` lines. The #1842 keys map onto it. The caller-asserted `surface` goes to `client.surface`. A change with no caller is recorded as `caller.kind: none`, or as `internal` when the proxy itself decided, and carries a closed `trigger`. - **What a line records**: one committed effect, not one HTTP response. A partial failure records what persisted. - **Values**: field names always. Values appear verbatim only for booleans, closed enums, bounded numbers and name lists. Everything else is withheld, with no hash. Secrets, token values and key material never appear. - **Failure**: a failed audit write never refuses the change. - **Readers**: no new read surface. Scoped tokens can read nothing new. - **Editions**: the line is edition-neutral and is written whenever `audit_log` is on. There is no shipping connector; Kubernetes and Loki remain server-edition roadmap work. - **Guard rail**: a door-registry test, built from the live routers, the MCP dispatch tables and the CLI command tree, fails CI when a new write door lands without a record or an exemption. ## Review status The spec was cross-reviewed with opencode `github-copilot/gpt-6.2-sol` (variant high), two chunks per round, for 20 rounds (the maintainer raised the cap to 20). **No round returned a clean verdict.** I checked every finding against the code before applying it. Rounds 1–20 are applied. Round 20's eight findings were applied after the cap and are **not re-reviewed** (the last push is UNREVIEWED): a `scanner_pull` policy value for a scanner re-enabled by a late pull, and no `scanner.disable` for an unsaved enablement lost at restart; `/token_prefix` (active) plus `/pending_token_prefix` on a `client.key_revoke` during a staged rotation; scan settlement written at its effect boundary on either side of the `202` (contract and research D3); `login.cancel` for an approved code consumed by a failed exchange; an explicit exemption for discovery's removal of an absent tool's approval; PR-2 attribution for prompt/skill refreshes triggered by `servers.changed` and `onSkillsConfigChanged`, not only the reload; and `review approve`'s unquarantined branch mapped to `tool.approve`. Merged on the maintainer's decision without a clean verdict; none of the 20 rounds raised a P1. ## Test plan - [x] Spec only: no code change, and `CLAUDE.md` is unchanged. - [x] `git diff --stat origin/main` touches only `specs/133-admin-action-audit/`. refs #1698 🤖 Generated with [Claude Code](https://claude.com/claude-code)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes the three audit gaps that need no schema change, as agreed on #1698: who changed the rules now shows up on the existing activity rows.
config_changeandquarantine_changerows. The authenticated caller travels in the request context (runtime.ContextWithActor/runtime.RequestActor; the REST door stamps it in a middleware after authentication, the MCP management tools stamp themcpsurface) and the runtime copies it onto the activity event, so the stored row carriesactor_kind,actor_name,surfaceandrequest_idunder the same keys aprofile_changerow already uses. A change with no caller behind it (config file edited on disk, admission gate at load) carries none of them: an absent actor means "no request", never an unknown one.POST /servers,PATCH /servers/{id},DELETE /servers/{id}, the quarantine toggles, security approve, enable/disable and the restart that re-enables a disabled server writeserver_added/server_updated(withchanged_fieldsand the before/after values of those fields only, computed against the committed entry so an admission-gate quarantine in the same commit is part of the delta) /server_removed(with the purge summary) /server_enabled|disabled. Values go through the existingredactActivityConfigValuesredaction. The MCP tool, which already recorded add/remove, now carries the agent's identity too.POST /api/v1/tokens/{name}/regenerate(mcpproxy token regenerate) goes throughCredentialsService.Regenerate, which writes oneprofile_changerow withchange: rotate, the actor and the old/newtoken_prefix(never a secret), the shape client rotation already has. The store's refusals keep their sentinels, so 404 / 409 mapping is unchanged.No new dependencies. Docs:
docs/features/activity-log.md(Config Change Events: doors, actions, "Who changed it"),docs/features/agent-tokens.md(regenerate),docs/features/mcp-credential-lifecycle.md.Verification
internal/runtime/activity_actor_test.go,credentials_regenerate_test.go,internal/server/activity_actor_rest_test.go,internal/httpapi/actor_middleware_test.go,tokens_regenerate_record_test.go, scanner and management tests).go test -raceon runtime, server, httpapi, management, security/scanner: green../scripts/test-api-e2e.sh: 70 passed, 0 failed.golangci-lint(CI config, bare and--build-tags server,--new-from-rev=origin/main): 0 issues.github-copilot/gpt-6.1-sol, three rounds. Round 1: 5 attribution gaps (MCP enable/registry-add surface, security approve, restart-enables, add row vs committed state, patch delta vs admission gate). Round 2: 6 more (add row read the live config instead of the create commit's snapshot, restart retry loop, MCP restart surface, scanEnsureConnected, secret-change restarts, legacy REST fallbacks). All fixed with tests; round 3:VERDICT: CLEAN.Out of scope (next step on #1698)
A fourth audit file event kind (
admin_action) for log shippers. This PR puts the actor on the activity rows so that spec has one vocabulary to lift.Refs #1698 (first phase; the issue stays open for the
admin_actionspec).🤖 Generated with Claude Code