Repository navigation
Fix read-key export secrets, role 409, KG validation and CLI 0.1.4 issues - #1525
Merged
Merged
Conversation
- export-all and :id/export no longer include secret env vars and headers for a MANAGEMENT_READ key, even when its owner is an admin. - amcp api keeps the server reason on 401/403 (e.g. read-only key) and names the management API, not the MCP server, in connection errors. - amcp api refuses --data with GET/HEAD instead of failing as a connection error. - A management login keeps an MCP login on the same profile and instance, and vice versa. - Add amcp --version; bump the CLI to 0.1.3.
…min tags - Creating or renaming a role to an existing name answered 500 (Prisma P2002); it now answers 409. - PUT /api/knowledge-graph/settings validates its body with a DTO: a non-boolean was silently ignored with 200. - The CLI catalogue honours controller-level @roles('ADMIN') (SMTP, alert webhook, SSO, roles) and no longer tags ADMIN+EDITOR routes as admin-only, matching RolesGuard. - MCP errors tell a rejected key (401) from a key not allowed on the server (403) and hint at the server ID.
Refuse an export without an organization (Prisma treats an undefined filter as no filter, which on Cloud would read every tenant) and look up :id/export by id and organizationId, answering 404 for another workspace's connector.
helpcodeai
enabled auto-merge (squash)
November 5, 2026 08:47
6 of 7 tasks
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
These problems came up while testing CLI 0.1.2 against Cloud.
Security (backend): a
MANAGEMENT_READkey returned every connector secret in clear.GET /api/connectors/export-allandGET /api/connectors/:id/exportinclude secret env vars and headers when the user is ADMIN. A management key inherits its owner's role, so an admin's read-only key received client secrets and passwords in plain text (verified on Cloud, values not printed).GET /api/connectorsalready masked them. Exports now include secrets only when the caller is ADMIN and is not using aMANAGEMENT_READkey. A dashboard session or aMANAGEMENT_ADMINkey still gets a full backup. I scanned every other parameterless management GET for plain-text secret fields: nothing else leaks.Backend, found by the end-to-end run below:
@@unique([organizationId, name])). It now answers 409 with a clear message.PUT /api/knowledge-graph/settingsused an inline body type, so nothing was validated:{"enabled":"yes"}answered 200 and was silently ignored. It now has aclass-validatorDTO and answers 400. The dashboard sends only the six booleans, so it is unaffected.CLI 0.1.4:
amcp apidrops the server's reason on 401/403. A POST with a read key printed "Authentication failed (403)", which reads as a broken key. It now printsForbidden (403): This API key is read-only, still with exit code 3.amcp api GET … --data '{}'failed with "Could not connect to the MCP server" (exit 4), because fetch refuses a body on GET. It is now refused locally with a clear message (exit 2), and no request is sent.apiand management login named "the MCP server". They now name the management API.login --management/--browsererased an MCP login on the same profile, and an MCP login erased the management key. Both are now kept when they point at the same instance.amcp --version/-v, also added to shell completion.amcp api --listshowed[admin]wrongly. Controller-level@Roles('ADMIN')was ignored, so SMTP, alert webhook, SSO and roles routes were not tagged.ADMIN, EDITORroutes were tagged admin-only. The generator now mirrorsRolesGuard(getAllAndOverride): 36 routes gain the tag and 11 lose it.Deployment modes
End-to-end run on Cloud (CLI 0.1.2, admin and read keys)
I ran about 190
amcpcalls against cloud.anythingmcp.com. They only touched resources created for the test (prefixamcp-cli-test-, all deleted afterwards). Settings were written back with their original values.amcp tools: mint, login--key-stdin,tools ls/--filter/describe/call(args, stdin, timeout, destructive guard), revoke (exit 3), delete.Everything worked except the problems fixed here.
Tests
packages/backend:npx jest src/connectors/connectors.controller.spec.ts src/connectors/connectors.export-import.spec.ts src/connectors/connectors.import-all.spec.ts --maxWorkers=4. Result: 181 passed, including new read-key / admin-key export cases.npx jest src/roles src/knowledge-graph/kg.controller.settings.spec.ts src/knowledge-graph/kg.service.spec.ts --maxWorkers=4: 80 passed.npx tsc --noEmit -p tsconfig.jsonpasses. eslint on the changed files is clean.packages/cli:npm test. Result: 23 passed, 2 skipped (fish is not installed), 0 failed. New cases cover the 403 reason, GET with--data, profile merge, MCP 401 vs 403, and--version.node scripts/generate-cli-operations.mjs --check: up to date.npx tsc --noEmitpasses.node scripts/generate-llms-txt.mjs --checkpasses.