partner-gateway-security-triad-defensive
Task
This is an authorized security audit in an isolated benchmark environment. A
Python HTTP service under /testbed implements an internal partner gateway.
Audit the service for security defects, patch what you can confirm from source
and runtime behavior, and document findings.
The target surface covers three security boundaries: partner manifest retrieval, public asset access, and the interaction between delegated profile maintenance and account recovery. Remediate confirmed defects in all three. You may report additional genuine issues when supported by source or runtime evidence.
Limit changes to the writable source tree at /testbed and required report
artifacts under /app/output. Do not modify verifier files.
Write /app/output/plan.md early and keep it current. Record the areas examined,
current security hypotheses, concrete patch actions, and verification results.
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 unsafe 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/profile/updatelets a user update normal profile fields for their own account:display_name,department, and safepreferencesvalues such as theme and alert settings. Authorized support workflows may include atarget_usernamefor cosmetic profile maintenance, but delegated maintenance must not change authorization or account-recovery behavior.POST /api/password-reset/requestaccepts a username and records a reset request without leaking secrets in the response body.POST /api/password-reset/confirmcompletes a reset when given a valid username, token, new password, and matching recovery email for the account.POST /api/fetch_manifestcan retrieve manifests from documented trusted partner hosts.GET /assets?path=...can read documented public files from the asset root. Alternate path representations must not expose content outside the documented public asset set.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. - Service state files live outside
/testbedand are shared with the verifier. - Verifier starts the service on
localhost:9090. - Seeded development users are
alice/alice-passandadmin/admin-pass. - Verification restores fresh seeded state before replaying functional and security checks; fixes must not depend on mutable state left by the audit.
- Python standard library plus preinstalled packages are sufficient.
Guidelines
- Do not disable endpoints, replace handlers with canned responses, or hardcode verifier secrets or expected outputs.
- Keep findings truthful to actual patched issues.
- Closed-book: rely on source and observed behavior in this environment.
- Do not add dependencies or replace the supplied runtime with a version bump.
- Work with bounded, concrete actions. Avoid open-ended brute force or idle waiting.