gateway-integrity-access-defensive

defensivedefensivesource-auditapplication-hardeningpythonrewardkit

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 identifier
  • severity: LOW, MEDIUM, HIGH, or CRITICAL
  • affected_files: list of modified files as absolute /testbed/... paths
  • root_cause: brief explanation
  • description: impact and unintended 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/fetch_manifest retrieves approved manifests from documented trusted partner hosts.
  • GET /assets?path=... reads documented public resources.
  • POST /api/profile/update lets a user update normal profile fields (display_name, department, and safe preferences values such as theme and alert settings) and supports documented preference operations.
  • 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 live outside /testbed and 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

  1. Do not disable endpoints, replace handlers with canned responses, or hardcode verifier configuration values or expected outputs.
  2. Keep findings truthful to actual patched issues.
  3. Closed-book: rely on source and observed behavior in this environment.
  4. Work with bounded, concrete actions. Avoid unbounded input generation or idle waiting.