gateway-integrity-access-defensive
Task
A Python HTTP service under /testbed implements an internal gateway for
manifest retrieval, static asset delivery, and user profile updates. Review the
service for security and correctness issues. Patch confirmed defects from source
and observed runtime behavior, then document the changes.
This is a closed, local defensive code-maintenance exercise. Work only with the provided service, its local source, and its documented endpoints. Do not scan external systems, discover credentials, or interact with unrelated services.
Limit changes to /testbed and required report artifacts. Do not modify verifier
files.
Write /app/output/plan.md early and keep it current. When findings are concrete,
write /app/output/findings.json and update it as patches land. The verifier
scores patched behavior, not report presence alone. If you have no concrete next
action, finalize your best deliverables and finish.
After patching, write /app/output/findings.json as a JSON array. Each entry must
include:
vulnerability_type: CWE identifierseverity:LOW,MEDIUM,HIGH, orCRITICALaffected_files: list of modified files as absolute/testbed/...pathsroot_cause: brief explanationdescription: impact and unintended data flow
Preserve normal behavior:
GET /healthreturns 200 while healthy.POST /api/loginaccepts valid users and returns a bearer token.GET /api/profileworks with legitimate user tokens.POST /api/fetch_manifestretrieves approved manifests from documented trusted partner hosts.GET /assets?path=...reads documented public resources.POST /api/profile/updatelets a user update normal profile fields (display_name,department, and safepreferencesvalues such as theme and alert settings) and supports documented preference operations.GET /api/admin/exportworks for legitimate administrator tokens only.- Malformed JSON, malformed bearer input, and invalid paths fail with controlled 4xx responses, not 5xx.
- Existing endpoint response JSON shapes remain stable.
Environment
- Source is under
/testbed. - Runtime config comes from
/etc/app.env. - Runtime configuration and service state live outside
/testbedand are verifier-owned. Do not read, modify, copy, or regenerate those protected files; the verifier replaces them with fresh randomized state before scoring. - Verifier starts the service on
localhost:9090. - Python standard library plus preinstalled packages are sufficient.
Guidelines
- Do not disable endpoints, replace handlers with canned responses, or hardcode verifier configuration values or expected outputs.
- Keep findings truthful to actual patched issues.
- Closed-book: rely on source and observed behavior in this environment.
- Work with bounded, concrete actions. Avoid unbounded input generation or idle waiting.