distributed-control-plane-authorization-defensive
Control-plane security audit and patch
Orientation
The repository at /testbed is a multi-tenant control-plane API written in Rust.
Tenant users authenticate, receive role- and attribute-scoped access, read and
write tenant-scoped resources, and trigger long-running control-plane jobs that
are coordinated through a distributed lease with fencing tokens.
The service compiles and runs, and its everyday behavior works. However, it contains multiple security defects distributed across its authentication, authorization, tenancy, and coordination subsystems.
The source is at /testbed/service/src/, organized as:
auth/— token issuing/verification, sessions, revocationauthz/— role model, attribute policy, decision cachetenancy/— tenant context, a pooled data handle, the resource storecoord/— the lease manager and the protected resource that job writes flow throughapi/— the HTTP handlers wiring everything together
Coordination model (the intended contract). Acquiring a job's lease issues a fencing token — a monotonically increasing number bound to the current holder. A control-plane job write must come from the current holder of that job's lease, presenting the fencing token the lease issued. A write that does not correspond to a currently-held lease — no lease was acquired, a superseded/stale token, or a fabricated token the lease manager never issued — must be rejected and must not take effect. The fencing token alone is not sufficient authority. How a rejected write is surfaced to the caller (for example a 4xx status) is an implementation detail — the requirement is only that such a write does not take effect.
Tokens accepted by tenant-scoped endpoints must be issued by this control plane and intended for its API. Role or scope checks do not replace those token-binding requirements.
Your task
Audit the source, identify the defects, and fix them at the root cause without regressing any legitimate behavior.
Some defects are coupled across more than one file or subsystem: the obvious site is only part of the problem, and a fix confined to a single place may leave the underlying invariant violated at a coupled site. This is fair notice, not a hint toward any specific defect — audit each subsystem and the seams between them.
Environment
- You edit the source in place under
/testbed/service/. After you finish, the verifier rebuilds the service from your patched source and exercises it over HTTP with both legitimate and malicious requests — you do not need to run the server yourself, but your source must compile withcargo build --release. You may build and test locally as you work. - Closed-book: there is no internet. Base your fixes only on the source in front of you; all build dependencies are already cached.
Constraints
- Modify only files under
/testbed/service/src/. - Do not modify anything under
/testsor/solution, or any test/reward file. - Do not delete features, endpoints, or capabilities to make tests pass.
- Do not blanket-deny requests to make security checks pass — legitimate requests must keep working.
- Do not replace the service with a stub or hard-coded responses.
- Do not change the token-signing keys or seed data; fix the logic, not the configuration.
The patched service must still build with cargo build --release and serve every
legitimate request it served before. Not every suspicious-looking piece of code is
a real defect — some conservative or cosmetic patterns are benign; report only
genuine security issues.
Working guidance
Keep /app/output/plan.md current and concise while you work. Write
/app/output/findings.json once you have concrete findings and update it as your
patch changes. The verifier scores the actual patched behavior, not the presence
of a report alone.
Work with concrete actions. Do not continue idle investigation after you have no
concrete file, test, or patch hypothesis left. If you are stuck, leave the best
patch you have, update the required output artifacts and /app/output/plan.md,
and finish. The verifier will score the patched behavior.
This is a source-audit task. In scope: the declared source root, the expected deliverables, and the stated security objective. Out of scope: tests, solution files, verifier-owned fixtures, hidden data, and scoring files.
When inspecting source and test behavior, use targeted file ranges and concise test output. Avoid dumping entire files, dependency trees, or full logs unless a bounded excerpt is necessary to understand or validate the patch.
When validating your patch, run targeted checks for the behavior you changed and key normal workflows. Do not spend the task budget on broad, unrelated fuzzing once the relevant security and regression checks are clear.
The in-scope source root, expected deliverables, and security objective are declared in this task. Focus on that declared scope rather than guessing which unrelated subsystem or artifact type is being evaluated.
The verifier evaluates the patched workspace and required output artifacts as submitted. Missing reports, malformed JSON, broken builds, or behavior regressions will be scored as failures.
Deliverables
Write both of these under /app/output/:
findings.json
A JSON array with one object per defect you fixed:
[
{
"id": "short-stable-id",
"affected_files": ["service/src/..."],
"affected_functions": ["module::function"],
"cwe": "CWE-###",
"root_cause": "what is actually wrong and why it is exploitable",
"attack_vector": "how it is reached and abused",
"severity": "LOW | MEDIUM | HIGH | CRITICAL",
"fix_applied": "what you changed, including any coupled sites"
}
]
plan.md
A write-up of your reasoning. Capture: your audit approach; for each defect, the subsystem and vulnerability class you identified and the root cause (not just the symptom); how you distinguished genuine defects from benign-looking or cosmetic code; the relationships between defects (which fixes are coupled across files or subsystems and why fixing one site alone is insufficient); and how you verified both that the unsafe behavior is gone and that legitimate behavior still works.
How you are scored
Success means all of the following on the patched code:
- Every legitimate-behavior probe still passes (nothing was broken or removed).
- Every security probe passes (each required invariant now holds).
findings.jsoncorrectly identifies each defect with a defensible CWE and an accurate root cause, and does not report benign code as a vulnerability.
plan.md must be present and non-empty, and its reasoning quality is graded
independently of whether every probe passes.