feat: audit MCP server config changes - #27943
Conversation
Docs previewCheck off each page once it's been reviewed. If a page changes in a later push, its checkbox clears automatically so it gets a fresh look. Pages not yet wired into the docs navigation aren't listed here. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0488a81f59
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
0488a81 to
438407c
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 438407ca44
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
79341c1 to
e6bc6f1
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e6bc6f1d49
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
e6bc6f1 to
3c8714b
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Another round soon, please! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
3c8714b to
cc31fdf
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
cc31fdf to
bc79967
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. 🚀 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
bc79967 to
907f16f
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 907f16f568
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
b284e1e to
10ea3c7
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 10ea3c79a5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
10ea3c7 to
d3860fa
Compare
|
@codex review |
fa9d09a to
e0ccadd
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
Create, update, and delete of MCP server configs now produce enterprise audit log entries with field diffs. Secret material (oauth2_client_secret, api_key_value, custom_headers) renders as a redacted change marker and never appears in the diff; dbcrypt key-id bookkeeping columns are excluded entirely. Write-denied mutations on a readable config record an audited 403. Read-denied callers stay concealed with 404 by the param middleware and record nothing.
Migrations 000567 and 000568 were claimed on main and by the parent branch while this stack was in review.
Main claimed 000568, shifting the org-scope migration to 000569.
Require a non-empty display name on create and update so the audit resource target logic needs no ID fallback, link MCP config audit entries to their settings page, trim audit table comment noise, and pin the created-row audit guarantee when the post-discovery credential update fails.
Auditors need to see which endpoint a config points at, and AI provider base URLs are already tracked. Admins should keep credentials in the dedicated secret fields rather than URL query parameters.
Follows the org-scoping migration's move to 000570 after main took 000569.

Adds enterprise audit logging for MCP server config create, update, and delete, with strict secret redaction. MCP configs hold credentials (OAuth2 client secrets, API keys, custom headers), so admin changes to them need an audit trail.
Summary
enterprise/audit/table.gogains anMCPServerConfigentry enumerating every column:oauth2_client_secret,api_key_value, andcustom_headersareActionSecret(never appear in diffs); dbcrypt*_key_idbookkeeping, IDs, and timestamps are ignored; the remaining config fields, including the endpoint URL fields, are tracked so auditors can see which endpoints a config points at.coderd/audit(diff, request, resource target with org attribution),codersdk/audit.go, and aresource_typeenum migration.audit.InitRequest: create recordsNew; update and delete recordOldfrom the param middleware before the write-authorization check, so a readable-but-not-writable caller produces an audited 403 while read-denied callers stay concealed as unaudited 404s./ai/settings/mcp-servers/{id}, audit table comments are trimmed per review, and a fault-injection test pins that a config row surviving a failed post-discovery credential update still gets its creation audit entry.Stacked on #27942 (org-scoped MCP configs). Part of the MCP org-separation stack.
Closes https://linear.app/codercom/issue/CODAGT-717
UAT: verified on a trial-licensed dogfood instance: audit entries for the full CRUD lifecycle with correct actor/org/target, redacted secrets in the update and OAuth2 create diffs, and a full plaintext scan of the audit dump finding zero secret leaks.