Title: fix(mcp): audit the columns an MCP server update wrote, not the params it got by waleedlatif1 · Pull Request #6598 · simstudioai/sim · GitHub
Open Graph Title: fix(mcp): audit the columns an MCP server update wrote, not the params it got by waleedlatif1 · Pull Request #6598 · simstudioai/sim
X Title: fix(mcp): audit the columns an MCP server update wrote, not the params it got by waleedlatif1 · Pull Request #6598 · simstudioai/sim
Description: Summary
Every PATCH /api/mcp/servers/[id] audit row listed oauthClientId, oauthClientIdProvided and oauthClientSecretProvided — including renames and URL edits that never touched credentials — and omitted the connectionStatus/lastConnected/lastError resets the write actually performed
The route always sends oauthClientId: body.oauthClientId || null and *Provided: ... !== undefined, so null and false both survive the value !== undefined filter. All three appear on every PATCH regardless of what the client sends — no modal-side condition needed. The two *Provided flags aren't even columns; they're control params
Regression from #5273 (263e3ca67e), which split performUpdateMcpServer into a writer that owns updateData and a thin audit wrapper with no access to it. main derived the list from Object.keys(updateData); the wrapper fell back to the params it could see
Only the writer knows which columns a write touched, so updateMcpServer now returns updatedFields and both the internal wrapper and the v2 use case record it. Net −9 lines of derivation logic
Audit fidelity only — .map(([key]) => key) records names, never values. No credential value was or is exposed
Why this shape
This is the pattern the repo already uses: workflow-mcp-lifecycle.ts:96,552,939 and credentials/orchestration/index.ts:159,339 both carry updatedFields?: string[] on the result and populate it from the writer's updateData. This makes server-lifecycle.ts the third instance rather than a new convention. The v2 twin shared the flaw in a different form (Object.keys(input) with no filter at all) and now reads the same result.updatedFields.
Intentional change to audit output
Rows now include connectionStatus/lastConnected/lastError on an auth or credential change, include authType when it is implicitly promoted to oauth, and stop including oauthClientIdProvided/oauthClientSecretProvided. I grepped for downstream consumers keyed on the old strings (EE audit-log UI, v1 export, dashboards) and found none.
Type of Change
Bug fix
Testing
Two new tests in server-lifecycle.test.ts: one asserting a rename records exactly ['name'], one asserting an auth-type flip records the reset columns
Verified they can fail: against the old params-derived logic they go red with expected [ 'name', 'oauthClientId', …(2) ] to deeply equal [ 'name' ] and expected [ 'authType' ] to deeply equal ArrayContaining{…}
875 tests pass across lib/mcp, app/api/mcp, app/api/v2/mcp, lib/credentials
check:openapi unchanged and check:api-validation:strict pass — confirms no updatedFields key leaks into a wire response (no caller spreads the result; the v2 projection re-wraps picked fields)
Follow-ups (not in this PR)
performCreateMcpServer's upsert branch rewrites an existing server (name, URL, headers, OAuth creds, auth-type flip, same connection reset) but gates its audit on if (!result.updated), so an upsert-rewrite emits no MCP_SERVER_UPDATED row at all. That's a behavior change, and it needs updateValues tightened from Record
Open Graph Description: Summary Every PATCH /api/mcp/servers/[id] audit row listed oauthClientId, oauthClientIdProvided and oauthClientSecretProvided — including renames and URL edits that never touched credentials — and...
X Description: Summary Every PATCH /api/mcp/servers/[id] audit row listed oauthClientId, oauthClientIdProvided and oauthClientSecretProvided — including renames and URL edits that never touched credentials — and...
Opengraph URL: https://github.com/simstudioai/sim/pull/6598
X: @github
Domain: github.com
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:ee440447-667f-3475-d7de-601fa6d6c5ae |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | CC7C:600EE:19B76:25678:6AFB4335 |
| html-safe-nonce | c24da0fcf0240ca113438d55f80080fa1913e80999a94b266ef96d64769b1e8e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQzdDOjYwMEVFOjE5Qjc2OjI1Njc4OjZBRkI0MzM1IiwidmlzaXRvcl9pZCI6IjMyMzE3NDE3Mzk4NzM4MTMzMDEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | ae7c2977958d7663b295f97e4f5b24d93b4404761b2541755afef212fa47d4c2 |
| hovercard-subject-tag | pull_request:4259164097 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/simstudioai/sim/pull/6598/files |
| twitter:image | https://avatars.githubusercontent.com/u/40672544?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/40672544?s=400&v=4 |
| og:image:alt | Summary Every PATCH /api/mcp/servers/[id] audit row listed oauthClientId, oauthClientIdProvided and oauthClientSecretProvided — including renames and URL edits that never touched credentials — and... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | d849b928f455c800985398e7f1b659425adb312a5fa14fba5d9a14e62e9fe5dd |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/simstudioai/sim git https://github.com/simstudioai/sim.git |
| octolytics-dimension-user_id | 199344406 |
| octolytics-dimension-user_login | simstudioai |
| octolytics-dimension-repository_id | 912559512 |
| octolytics-dimension-repository_nwo | simstudioai/sim |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 912559512 |
| octolytics-dimension-repository_network_root_nwo | simstudioai/sim |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | a6c2f87cbcb6414452377b4967858ed6a66f1109 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width