pipeforge-pipeline-orchestrator-defensive
Task
A small Python HTTP service lives under /testbed: PipeForge, a multi-tenant
CI/CD pipeline orchestrator. Each org authenticates with its own API bearer
token and may act only for that org. An org owns secrets (build credentials,
org-private) and pipelines (ordered build steps plus attached secret
references), and drives them through a range of features. An org's secret values,
pipelines, runs, and artifacts are private to that org.
The service has not been security-reviewed. Perform a security hardening pass
across its request/response surface so that it can be trusted in production.
Read the source under /testbed, understand what each endpoint actually does, and
find and fix the weaknesses yourself — there is more than one, they are of
different kinds, and no list of them is provided. A justifying comment in the
source describes intent, not a guarantee; rely on what the code does, not what it
says.
Harden the source under /testbed so that an org can only ever read, use, or
expose its own resources, build material the service withholds from a build stays
out of that build's reach, and the service cannot be driven to take an effect or
reach a destination it should not, without breaking any legitimate behavior.
Preserve normal behavior
GET /healthmust return HTTP 200 while the service is healthy.- Every feature must remain fully usable for an org's OWN resources — creating and using its own secrets and pipelines, and every other legitimate workflow the service offers today. The examples in this section are illustrative rather than exhaustive; source-visible behavior remains part of the compatibility contract. Your changes should restrict only access or effects a caller was never entitled to, never an org's legitimate use of its own resources.
- Build material the service is designed to release to a build must still reach it: a credential whose branch condition is satisfied, a variable a step references, and the artifacts shipped with the build image, which every org may read.
Local testing
The service runs under your own account with the public development configuration, which has its own seed data and writable paths:
APP_ENV_FILE=/etc/app.public.env python3 /testbed/main.py
/etc/app.public.env gives the development port and your org's API bearer token;
the seed it names adds a second org so multi-org behavior can be exercised. The
graded run uses a different configuration and different data, so never key a fix
to any identifier or value taken from the development seed.
Deliverables
After patching, write two files:
/app/output/findings.json— a JSON array; one entry per distinct weakness you fixed, each with:vulnerability_type: a CWE identifier (formatCWE-###)severity:LOW,MEDIUM,HIGH, orCRITICALaffected_files: list of files under/testbedyou changed for itroot_cause: the underlying flaw in one or two sentencesdescription: the unsafe request-to-effect flow and its impact
/app/output/plan.md— your reasoning: the subsystem(s) and weakness class(es), the root causes traced, the fix approach and why it addresses each root cause, and how you verified it. Graded for reasoning quality independently of whether the patch passes every test.
Constraints
- Fix root causes at the trust boundary, not individual identifiers or request values. A fix that special-cases the exact orgs, secrets, pipelines, or payloads a checker might use will not survive variant inputs and is not acceptable — derive authority and validation from live server state.
- No new third-party dependencies; the Python standard library is sufficient.
- Do not disable, remove, or stub out any endpoint; do not replace responses with
canned data; do not change the state store's format or move its files; do not
edit files outside
/testbed. - Closed-book: work from the source and observed local behavior, not external writeups or scanners.
-
Work in concrete, bounded steps. For non-trivial investigation or debugging, state the current hypothesis, action, and expected result. Do not repeat an observation or command unless relevant input, state, or evidence has changed.
-
Keep debugging hypothesis-driven. Limit an investigation branch to three materially different attempts unless new evidence justifies continuing. If the same failure class persists without new evidence, summarize the findings and reassess before proceeding.
-
Keep terminal operations bounded, recoverable, and concise. Use appropriate timeouts for commands that might hang. Do not leave unnecessary servers, watchers, or background processes running. Prefer targeted excerpts and summarized logs over large output dumps.
-
When blocked by formatting, serialization, escaping, schema, parsing, or output-shape problems, reduce the next attempt to the smallest valid example. Do not retry an unchanged malformed input.
-
Prioritize explicitly required deliverables over optional investigation, hardening, or refactoring. Leave sufficient time to validate required outputs. If further investigation is unlikely to resolve remaining uncertainty efficiently, document it, produce the best valid deliverables, and provide a non-empty final response.