feat: audit MCP server config changes by ibetitsmike · Pull Request #27943 · coder/coder · GitHub
Skip to content

feat: audit MCP server config changes - #27943

Merged
ibetitsmike merged 24 commits into
mainfrom
mike/codagt-717-mcp-audit
Aug 19, 2026
Merged

feat: audit MCP server config changes#27943
ibetitsmike merged 24 commits into
mainfrom
mike/codagt-717-mcp-audit

Conversation

@ibetitsmike

@ibetitsmike ibetitsmike commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator

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.go gains an MCPServerConfig entry enumerating every column: oauth2_client_secret, api_key_value, and custom_headers are ActionSecret (never appear in diffs); dbcrypt *_key_id bookkeeping, 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.
  • Type registration in coderd/audit (diff, request, resource target with org attribution), codersdk/audit.go, and a resource_type enum migration.
  • Handlers wire audit.InitRequest: create records New; update and delete record Old from 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.
  • Tests: create/update/delete audit entries, write-denied and delete-denied 403 auditing, cross-org concealment producing zero entries, and a serializer-level regression test proving none of the three secret classes can reach a serialized diff.
  • Review round: MCP config audit entries link to /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.

Mux (AI agent) authored this PR on Mike's behalf.

@linear-code

linear-code Bot commented Aug 8, 2026

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Docs preview

Check 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.

@ibetitsmike ibetitsmike changed the title mike/codagt 717 mcp audit feat: audit MCP server config changes Aug 8, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread enterprise/audit/table.go
Comment thread coderd/audit/request.go
@ibetitsmike
ibetitsmike force-pushed the mike/codagt-717-mcp-audit branch from 0488a81 to 438407c Compare August 8, 2026 07:41
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread coderd/mcp.go Outdated
Comment thread coderd/mcp.go
@ibetitsmike
ibetitsmike force-pushed the mike/codagt-717-mcp-audit branch from 79341c1 to e6bc6f1 Compare August 8, 2026 08:23
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread coderd/mcp.go
@ibetitsmike
ibetitsmike force-pushed the mike/codagt-717-mcp-audit branch from e6bc6f1 to 3c8714b Compare August 8, 2026 08:51
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: 3c8714ba71

ℹ️ 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".

@ibetitsmike
ibetitsmike force-pushed the mike/codagt-717-mcp-audit branch from 3c8714b to cc31fdf Compare August 10, 2026 05:25
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: cc31fdf0ad

ℹ️ 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".

@ibetitsmike
ibetitsmike force-pushed the mike/codagt-717-mcp-audit branch from cc31fdf to bc79967 Compare August 10, 2026 05:37
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: bc79967118

ℹ️ 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".

@ibetitsmike
ibetitsmike force-pushed the mike/codagt-717-mcp-audit branch from bc79967 to 907f16f Compare August 10, 2026 05:54
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread enterprise/audit/table.go
@ibetitsmike
ibetitsmike force-pushed the mike/codagt-717-mcp-audit branch 2 times, most recently from b284e1e to 10ea3c7 Compare August 10, 2026 08:12
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread coderd/mcp.go
@ibetitsmike
ibetitsmike force-pushed the mike/codagt-717-mcp-audit branch from 10ea3c7 to d3860fa Compare August 10, 2026 08:37
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@ibetitsmike
ibetitsmike force-pushed the mike/codagt-717-mcp-audit branch from fa9d09a to e0ccadd Compare August 18, 2026 19:17
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: e0ccadd8f0

ℹ️ 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".

@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants