partner-gateway-boundary-defensive

defensivedefensivesource-auditparser-boundaryaccess-controlaccount-securitypythonrewardkit

Task

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.

Review all externally reachable trust boundaries and remediate every vulnerability you can confirm. You may report additional genuine issues when they are supported by source or runtime evidence.

Limit changes to /testbed and required report artifacts. 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. Stored department values must remain plain organizational labels and must not be interpreted as mailbox or recovery-routing data.
  • 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. Assets under the private tree must not be reachable through that public surface, including through alternate encodings, aliases, or symlinks.
  • 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.
  • Runtime configuration and service state outside /testbed are verifier-owned. Do not read, modify, copy, or regenerate those protected files; scoring uses fresh runtime state.
  • Verifier starts the service on localhost:9090.
  • 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.