fix(agent-server): remove the unreachable /api/credentials/update endpoint (#2008) - #2014
Open
dolho wants to merge 1 commit into
Open
fix(agent-server): remove the unreachable /api/credentials/update endpoint (#2008)#2014dolho wants to merge 1 commit into
dolho wants to merge 1 commit into
Conversation
…point (#2008) The endpoint had no callers anywhere — backend, MCP server, startup.sh, frontend and the enterprise submodule all verified. Its docstring claimed the backend called it; `routers/files.py` named it as the *sanctioned* alternative to raw `.mcp.json` editing, with both direct-edit blocks resting on that one sentence; and architecture.md listed it as a live agent endpoint. The documented escape hatch for configuring MCP servers did not exist. It was also the one path that would substitute a credential value into `command` — a whole-text `str.replace` over `.mcp.json.template` with no `validate_mcp_config` anywhere on it. That is the RCE-by-config class #590 closed, inert only because nothing called it, while the security comment above invited someone to. Deleted rather than revived, which is the branch the issue anticipated: #2007 put the `.mcp.json.template` renderer where the files actually are — in the container at startup, `env`-only, validated per server. Reviving this would have meant a second renderer with weaker rules. The references it left behind are corrected to name paths that exist: `files.py` now points at the template and at the validated `POST /api/agents/{name}/credentials/inject`; architecture.md, the API test requirements, and both diagrams drop or repoint it. Historical records (`docs/archive/**`, `docs/security-reports/**`, the 2026-06 meta-analysis) are left alone — they were true when written. Closes #2008 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Resolve by running |
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
POST /api/credentials/updatehad no callers. I re-verified the issue's claim acrosssrc/,docker/,scripts/,config/, the.claudesubmodule and the populatedsrc/backend/enterprisesubmodule: the only hits are the definition itself and thefiles.pycomment pointing at it.Meanwhile its docstring said "called by the Trinity backend",
routers/files.pynamed it as the sanctioned alternative to raw.mcp.jsonediting — with both direct-edit blocks resting on that one sentence — andarchitecture.mdlisted it as a live endpoint. The documented escape hatch for configuring MCP servers did not exist.It was also the one path that would substitute a credential value into
command: a whole-textstr.replaceover.mcp.json.template, with novalidate_mcp_configanywhere on it. That is the RCE-by-config class #590 closed — inert only because nothing called it, while the security comment above actively invited someone to call it.Decision: delete
This is the branch the issue anticipated ("if that one is fixed by rendering at creation in the backend, this endpoint should be deleted rather than revived"), reached by a slightly different route: #2007 / PR #2013 puts the
.mcp.json.templaterenderer where the files actually are — in the container at startup,env-only, validated per server, refusing rather than blanking. Reviving this endpoint would mean a second renderer with weaker rules on the same file.Deleted: the route, and its now-unused
CredentialUpdateRequestmodel — a dangling model is how a deleted route quietly comes back.References corrected to name paths that exist
agent_server/routers/files.py/api/credentials/updateflow"POST /api/agents/{name}/credentials/inject(#598)docs/memory/architecture.mddocs/testing/API_TEST_REQUIREMENTS.mdREQ-AS-CRED-001docs/diagrams/03-agent-container.mdPOST /api/credentials/update/api/credentials/injectdocs/diagrams/09-agent-lifecycle-states.mdinject_assigned_credentialsposts there/api/credentials/inject— which is whatcredential_encryption.py:375actually callsdocs/planning/TARGET_ARCHITECTURE.md:297Left alone deliberately:
docs/archive/**,docs/security-reports/**, and the 2026-06 meta-analysis — point-in-time records that were true when written.TARGET_ARCHITECTURE.md:315also mentions it, in a historical sentence explaining why #1089 added a different endpoint in June; rewriting that would be rewriting the record rather than fixing a pointer.Acceptance criteria
files.py:181-186describes a path that existsarchitecture.md:331matches reality${...}incommandrefused${VAR}can reachcommandthrough this pathTest plan
tests/unit/test_2008_dead_credentials_update.py— 7 tests; all 7 fail ondevand pass here (verified by stashing the change)files.pycomment and the test file itself both still contain the string, so a grep-shaped assertion would be self-defeating-k "credential or agent_server or reload_token or 1089 or files")Merge order
update_credentials, which this PR deletes. If #2010 lands first, this branch needs a rebase whose conflict resolution is mechanically "keep the deletion" — the function is gone either way. Merging this first would silently drop #2010'ssync_process_envwiring on that endpoint, so please keep the order.Closes #2008