Repository navigation
fix(tools): stop a publication ID from simap from sending requests outside /api - #160
Merged
Merged
Conversation
…ng it get_tender_details, called without publicationId, took the ID of the latest publication from simap's project header and put it into the request path. The header schema only checks that it is a string, and the URL parser resolves dot segments, so an ID such as "../../../../../../auth/whoami" sent the request to https://www.simap.ch/auth/whoami: any path of www.simap.ch, outside /api. The answer is parsed with a schema whose fields are all optional, so with fullRaw the tool returned whatever JSON object that path served. The host could not change, and only simap can set this ID, so this is defence in depth: the threat model listed it as a known limit. - The handler holds the ID from the header to the UUID check the publicationId argument already has, and returns an isError result without requesting anything. - buildUrl() refuses an endpoint the URL parser would rewrite (dot segments, "?", "#", a missing leading slash), so the rule holds for every endpoint, not only this caller. The message carries the endpoint and never the query values. SECURITY.md and the threat model no longer list the limit. Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: d9b09c8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
4 tasks done
Merged
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.
Description
When
get_tender_detailsis called withoutpublicationId, it reads the latest publication's ID from simap's project header and puts it into the next request path without checking it. The URL parser then resolves dot segments, so an ID such as../../../../../../auth/whoamisends the request tohttps://www.simap.ch/auth/whoami, outside/api.fullRawreturns what that path answers. This breaks invariant 2 ofSECURITY.md. Only simap can set that ID, so the severity is Low. The threat model already listed it as a known limit.The fix:
publicationIdargument, and returns anisErrorresult without requesting anything;buildUrl()refuses an endpoint that the URL parser would rewrite (dot segments,?,#, a missing leading/), so the rule holds for every endpoint.SECURITY.md(invariant 6), the threat model (the known limit is removed) andARCHITECTURE.mdare updated. This finding comes from a local security review. #161 fixes the other one.Related issue
None, found by a security review.
Type of change
Evidence
Proof of concept with
fetchstubbed, so nothing reaches the network. simap's project header returns a hostilelatestPublication.id:The same proof sends 12 hostile values through 18 tool arguments, and 0 requests leave
https://www.simap.ch/api/, both before and after the fix.Tests: 5 hostile IDs in
tests/tools/get-tender-details.test.ts, 10 cases forbuildUrl()intests/api/client.test.ts. They fail onmainand pass here. All five checks ofAGENTS.mdpass: 444 tests on this branch, 455 merged with #161.Live call with the default path (no
publicationId), against the real simap API:The fix assumes that simap's publication IDs are always UUIDs. In a live
search_tenders(20 results), all 20 publication IDs were UUIDs.Risk
Tier: High, because it touches
src/api/client.ts(the only outbound path) andSECURITY.md/docs/security/threat-model.md.Blast radius: if simap ever returns a publication ID that is not a UUID,
get_tender_detailswithoutpublicationIdfails for that project with a clear error. PassingpublicationIdstill works.buildUrl()only refuses endpoints whose path the parser would change, and none of the endpoints inENDPOINTSdo that.Revert:
git revert. The fix is a patch changeset and adds no new parameter.Checklist
npx changeset)Created with Claude Mythos 5.2 in a sandboxed Claude Code session. Verified, re-signed and filed with Claude Opus 5.5 in Claude Code.
🤖 Generated with Claude Code