Repository navigation
Conversation
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
[Critical impact] Referenced Postman environment secrets now reach the scan agent's API-spec input. The PR appears safe to merge, with snapshot cleanup as a non-blocking follow-up. Findings
Fix with agent prompt### Issue 1
strix/interface/utils.py:1515-1517
`write_fetched_collection` now creates a fresh directory on every fetch, but nothing removes these snapshots after staging or when a scan ends. Repeated scans of the same collection keep every old copy, including environment credentials, instead of replacing one cached file. Add cleanup tied to the scan's lifetime, while preserving files still needed for staging or resume.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.SummaryThe PR carries referenced Postman environment values into the collection given to the agent.
Reviews (1) · Last reviewed commit: "fix(api-spec): preserve referenced Postm..." · Reviewed by Greptile |
| snapshot = Path(tempfile.mkdtemp(prefix="collection-", dir=staging)) | ||
| path = snapshot / f"{sanitize_name(collection_uid)}.postman_collection.json" | ||
| write_secret_text(path, json.dumps(collection, indent=2)) |
There was a problem hiding this comment.
Old snapshots keep accumulating
write_fetched_collection now creates a fresh directory on every fetch, but nothing removes these snapshots after staging or when a scan ends. Repeated scans of the same collection keep every old copy, including environment credentials, instead of replacing one cached file. Add cleanup tied to the scan's lifetime, while preserving files still needed for staging or resume.
Prompt To Fix With AI
This is a comment left during a code review.
Path: strix/interface/utils.py
Line: 1515-1517
Comment:
**Old snapshots keep accumulating**
`write_fetched_collection` now creates a fresh directory on every fetch, but nothing removes these snapshots after staging or when a scan ends. Repeated scans of the same collection keep every old copy, including environment credentials, instead of replacing one cached file. Add cleanup tied to the scan's lifetime, while preserving files still needed for staging or resume.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
postman://collection?env=environmentcurrently uses environment values to authorize base URLs, then stages the unmodified collection. For example, scope includeshttps://one.testwhile the agent receives the collection defaulthttps://default.test, with{{tenant}}and{{token}}still lacking their environment values.Fixes #1633 by carrying enabled, referenced environment values in the staged collection's standard
variableblock. Environment values override collection defaults; request templates, auth configuration and existing variable metadata remain intact. Dependencies of used variables are included with a cycle guard; unrelated environment values and the host's Postman API key are excluded.Each fetch gets a separate snapshot directory, so targeting the same collection with two environments cannot overwrite the first target before staging. Snapshots use the existing private-file writer;
copy2retains the file permissions when staging. Download snapshots are removed only after all staging copies succeed, and pending downloads are cleaned up at normal process exit. The per-run copy remains available for resume; failed staging can be retried.Validation on main
6b7ae2ebe4d47037a927aade23265ff4e4f27e84, Python 3.12.14 and frozen dependencies, with isolated HOME and dotenv loading disabled:make check-allstill stops at the existing Pyright baseline: 941 errors, with no added or removed normalized diagnostics.The CLI documentation states the boundary: this carries
{{name}}template dependencies; variables accessed only through script APIs such aspm.environment.get(...)are not inferred. It does not execute Postman scripts or inline-substitute request contents.Related active work: #1158 validates Postman resource IDs and changes the same writer to use
write_secret_text. This PR leaves its ID-validation scope to that work; its small writer overlap should be reconciled whichever merges first. The private writer here is needed because the staged snapshot now includes environment credentials.