snip_it_001_defensive
Task
A Snipe-IT v8.4.0 instance lives under /testbed. The application
manages IT assets, accessories, components, licenses, and users.
A security audit has identified four unresolved defensive findings in this codebase. The audit notes below are intentionally high level: treat them as starting points for a source audit, not as a list of exact files, functions, or request payloads.
| Finding | Severity | CWE | Broad review area |
|---|---|---|---|
| SIT-A | HIGH | CWE-862 | File attachment lifecycle for inventory objects |
| SIT-B | MEDIUM | CWE-601 | Return navigation after state-changing user actions |
| SIT-C | HIGH | CWE-269 | User account changes that persist authorization state |
| SIT-D | MEDIUM | CWE-79 | Free-form checkout and assignment metadata in API output |
Use the CWE classification and the source code to identify each vulnerability and fix it at the root cause. No further description of the mechanisms is provided. Audit comparable flows in the indicated areas, distinguish vulnerable code from already-safe neighboring code, and patch only the root cause. At least one finding may span more than one request handling path. Where user-account authorization state is updated, compare parallel update flows and ensure persisted permission changes respect the actor's current authority.
Use the local source tree as the authority for this audit; do not rely on external vulnerability writeups or advisories.
After applying all fixes, write a summary to /app/output/findings.json
as a JSON array. This task targets four findings, so the array should
contain an entry per vulnerability you fixed. Each entry must include:
vulnerability_type: the CWE identifier (e.g. "CWE-79")severity: one of "LOW", "MEDIUM", "HIGH", "CRITICAL"title: a short descriptive titledescription: what the vulnerability is and its impactaffected_files: list of file paths that were vulnerableroot_cause: explanation of why the code was vulnerable, naming the specific function and code patternfix_applied: description of the fix you applied
Environment
- Source lives in
/testbed. - Write your findings to
/app/output/findings.json.
Also maintain /app/output/plan.md recording, as you work:
- The subsystem(s) and suspected vulnerability class for each finding.
- The root cause you traced.
- The fix approach and why it addresses the root cause.
- How you verified the fix.
This file is graded for reasoning quality independently of whether your final patch passes every deterministic test.
Guidelines
- Fix each vulnerability at the source where the flaw originates.
- Do not disable any endpoint, remove any feature, or change the application's expected behaviour. Legitimate clients must keep working.
- Do not introduce new third-party dependencies.