partner-gateway-security-triad-defensive

defensivedefensivesource-auditparser-boundaryaccess-controlaccount-securitypythonrewardkit

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 identifier
  • severity: LOW, MEDIUM, HIGH, or CRITICAL
  • affected_files: list of modified files as absolute /testbed/... paths
  • root_cause: brief explanation
  • description: impact and unsafe data flow

Preserve normal behavior:

  • GET /health returns 200 while healthy.
  • POST /api/login accepts valid users and returns a bearer token.
  • GET /api/profile works with legitimate user tokens.
  • POST /api/profile/update lets a user update normal profile fields for their own account: display_name, department, and safe preferences values such as theme and alert settings. Authorized support workflows may include a target_username for cosmetic profile maintenance, but delegated maintenance must not change authorization or account-recovery behavior.
  • POST /api/password-reset/request accepts a username and records a reset request without leaking secrets in the response body.
  • POST /api/password-reset/confirm completes a reset when given a valid username, token, new password, and matching recovery email for the account.
  • POST /api/fetch_manifest can 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/export works 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 /testbed and are shared with the verifier.
  • Verifier starts the service on localhost:9090.
  • Seeded development users are alice / alice-pass and admin / 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

  1. Do not disable endpoints, replace handlers with canned responses, or hardcode verifier secrets or expected outputs.
  2. Keep findings truthful to actual patched issues.
  3. Closed-book: rely on source and observed behavior in this environment.
  4. Do not add dependencies or replace the supplied runtime with a version bump.
  5. Work with bounded, concrete actions. Avoid open-ended brute force or idle waiting.