fix(chat): conceal a missing deployment the way an unreachable one is - #7100
Merged
Conversation
The internal chat error policy rewrites a cross-tenant authorization failure to `Chat not found or access denied`, and says in its own doc that a missing deployment and an unreachable one must stay indistinguishable. The domain answers an absent deployment with its own wording, though, and the policy passed that through — so the editor received `Chat deployment not found` for a deployment that is not there and `Chat not found or access denied` for one it may not reach. Two 404s a caller can tell apart is the existence oracle the concealment exists to close, and because the legacy `code` is derived from the message, it leaked on both fields. Every `not_found` reachable through this policy means the same thing, so the projection now renders all of them as the concealed message. The two existing 404 tests asserted only the status, which is how the bodies drifted apart unnoticed; the new one compares the two responses.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
Greptile SummaryThis PR closes an existence oracle in internal chat deployment routes by giving missing and unauthorized deployments the same response body and legacy error code.
Confidence Score: 5/5The PR appears safe to merge with no actionable correctness or security issues identified. The policy consistently conceals all internal chat deployment not-found outcomes, and the regression test exercises both missing and unauthorized paths through the same response projection.
|
| Filename | Overview |
|---|---|
| apps/sim/app/api/chat/error-policy.ts | Normalizes classified not-found errors before producing both the message and message-derived legacy code. |
| apps/sim/app/api/chat/manage/[id]/route.test.ts | Adds coverage proving missing and unauthorized deployments produce identical concealed 404 responses. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Internal chat request] --> B{Deployment available to caller?}
B -->|Missing| C[Classified not_found]
B -->|Unauthorized workspace| C
C --> D[Concealed message]
D --> E[Identical 404 error and legacy code]
Reviews (1): Last reviewed commit: "fix(chat): conceal a missing deployment ..." | Re-trigger Greptile
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
From the v0.8.12 release review (#7090). The internal chat error policy documents that a missing deployment and one in an unreachable workspace "must stay indistinguishable" — and they were not.
Chat not found or access denied, but the domain answers an absent deployment with its ownChat deployment not found, which the projection passed straight through. Two 404s a caller can tell apart is exactly the existence oracle the concealment exists to close.codeis derived from the message (legacyCode), so the difference leaked on both theerrorandcodefields.not_foundreachable through this policy means the same thing — the deployment is not available to this caller — so all of them now render as the concealed message. None of the alternatives (context.ts,update-chat-deployment.ts, the two undeploy paths) carries a distinction worth preserving at the cost of the one they must not make.Type of Change
Testing
response.status, which is how the bodies drifted apart unnoticed. The new test compares the two responses directly and asserts the concealed wording; it goes red against the unfixed policy.apps/simsuite green: 34,539 tests.bun run lint, all 33 audits (check:audits), andtype-checkpass.Checklist