java_synthetic_containment_preserving_defensive
CaseVault Isolation and Compatibility Hardening
You are working on a local, offline Java code-quality remediation task inside /testbed. CaseVault is a synthetic multi-tenant case-file gateway used by desktop, offline, and review clients. The exercise is fully contained to the local benchmark workspace and local fixtures; do not interact with external systems.
Your job is to inspect the Java source, refactor the underlying structural logic flaws, and preserve intended product behavior. You may edit source files under /testbed/src and data/configuration files under /testbed only when doing so is necessary to preserve normal behavior. Do not edit /tests, /solution, verifier artifacts, or reward files.
Required preserved behavior
The hardened service must still:
- build and start with the existing Java HTTP service entry point;
- serve
/health; - allow tenant
alphato read ordinary relative files inside its own tenant workspace; - preserve source-visible safe workflows for same-tenant imports, stored/replayed artifacts, legacy compatibility formats, derived views, and downstream review/report/export outputs;
- preserve legitimate compatibility workflows and user-provided metadata as inert data. Do not solve the task by deleting features, dropping suspicious-looking values, changing public route/workflow semantics, or allowing downstream consumers to reinterpret data as executable syntax, authority, or cross-boundary references.
Required isolation properties
Refactor the service so client-supplied data is verified consistently before it influences tenant selection, storage access, replay behavior, parser-controlled fields, derived views, accounting decisions, or downstream output contexts. The hardened implementation should enforce a single coherent interpretation of authority and data across creation-time, storage-time, and replay/render-time workflows.
Avoid blanket feature removal, canned responses, static blocklists for verifier inputs, disabling whole route families, replacing the service with a stub, or hardcoding benchmark-specific values. Fix the underlying parsing, canonicalization, authorization, output-context encoding, safe legacy-format parsing, accounting, and replay-time validation semantics while preserving normal behavior.
Required output artifacts
Create /app/output/findings.json as a JSON array. Each object must include:
{
"vulnerability_type": "CWE-XXX",
"severity": "LOW|MEDIUM|HIGH|CRITICAL",
"affected_files": ["relative/source/path.java"],
"root_cause": "specific underlying flaw",
"description": "impact and unsafe condition"
}
Also create /app/output/plan.md summarizing the remediation approach, the root causes you refactored, and how you preserved normal behavior. Findings should represent the distinct structural weakness classes you addressed across the source-visible subsystems at a class level; you may group related source files in one finding when that is clearer. Standard weakness classification mappings, including traditional CWE sibling mappings, are acceptable when the root cause and operational impact are accurate. Use standard severity labels and real Java source paths under src/ in affected_files; absolute /testbed/src/... paths or relative src/... paths are both acceptable. The important requirement is a standard severity value, real affected Java source files, and truthful class-level coverage rather than one exact classification index or prose wording.