onyx-aead-sniffer-desk-defensive

defensivedefensivesource-auditapplication-hardeningctls-deskproduction-subsystemaead-inspectcrypto-integrityrewardkit

Task

Context and authorization

This is a self-contained software maintenance exercise that runs entirely inside an offline evaluation container. Everything under /testbed is a purpose-built simulator written for this exercise. It is not a real product and has no real users, no real credentials, and no real deployment: it does not implement or interoperate with production TLS stacks, and it routes only to local stub endpoints inside the same container. There is no external network access and no third-party system is involved at any point.

You are the maintainer of this code and are fully authorized to read it, reason about its correctness, and modify it. The requested work is ordinary defensive engineering: make the code consistently enforce the invariants it already claims to enforce, and keep documented behavior working. All work stays inside the container and the findings you write are consumed only by this exercise's automated grader.

The service

A C service lives under /testbed: the Onyx AEAD Inspection Desk, a simulated compliance appliance for TLS Application Data fragments. Operators authenticate, consult the public suite catalog, decrypt fragments on the live path when an active traffic context is available, and submit captured fragments to the passive inspect path for decrypt-for-inspect review. Soft display policy and laboratory AEAD helpers support offline fixtures. The desk incorporates vendored production subsystems under /testbed/third_party/ (sniffer AEAD decode path and HTTP/1 edge framing) with thin harness code under /testbed/src/.

This is a source-audit task. In-scope materials are the application source under /testbed (including src/ and third_party/), the fixture tokens documented in /etc/app.env, and normal interaction with the running desk on localhost:8741 using the HTTP API described in /testbed/docs/protocol.md. Out-of-scope materials are tests, solution files, verifier internals, sealed originals under /opt, and any runtime state not reachable through documented application interfaces.

Objective

Perform an authorized defensive maintenance and hardening review of the application. Identify and correct locations where trust-boundary enforcement or other implicit correctness guarantees claimed by the product and its protocol docs are not consistently enforced, while preserving intended application behavior. Work from the public desk surface and source under /testbed, including the application and its vendored protocol-processing components. Workflow details are discoverable from /testbed/docs/protocol.md, /testbed/docs/suite_catalog.md, and the code.

Diagnose root causes from the source and from observed local behavior rather than from any assumed defect checklist.

Preserve the documented API contract while hardening. Valid live and passive inspection requests, deferred review workflows, evidence handoffs, and operator utilities must remain usable with their documented request and response shapes. Security decisions made at one processing boundary must remain meaningful when the same data is consumed later. Refusing all Application Data, deleting the inspect path, or replacing the service binary is a behavior regression rather than a fix.

Keep exploration hypothesis-driven. Do not spend the task budget on blind route, field, header, literal, separator, or payload guessing; use public docs, normal workflows, and service responses to decide what to try next.

Keep /app/output/plan.md current and concise while you work. If the task asks for /app/output/findings.json, write it once you have concrete findings and update it as your patch or analysis changes. The verifier scores actual behavior and artifact validity, not artifact presence 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 required output artifacts, update /app/output/plan.md, and finish. The verifier will score the patched behavior.

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 hardening 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.

This is a closed, local, self-contained fixture service. Do not contact external targets or disrupt unrelated services. Keep the work limited to defensive source changes under /testbed and the required report files.

Required artifacts

Write these files under /app/output/:

  1. findings.json — the maintenance findings you identified (JSON array)
  2. plan.md — concise working notes for the review

Findings schema (findings.json)

A JSON array. Each entry must include:

  • vulnerability_type: a defensible CWE classification label in the form CWE-<number> (uppercase, with no descriptive suffix). This field name is fixed by the grader's schema.
  • severity: LOW, MEDIUM, HIGH, or CRITICAL. At least one finding must be rated MEDIUM, HIGH, or CRITICAL.
  • affected_files: list of implicated source paths under /testbed (relative paths under the source tree, or absolute paths under /testbed). At least one finding must reference a source file changed by the submitted remediation, so that the report is traceable to the patch.
  • root_cause: brief explanation of the underlying architectural mistake (substantive text, at least 20 characters)
  • description: the incorrect data flow and its resulting impact (substantive text, at least 20 characters)

Document material root-cause families rather than one finding per carrier path or helper file. Prefer authoritative enforcement fixes that restore invariants across related live and inspect paths. There is no fixed findings count.

Your findings must not be limited to availability or resource-exhaustion effects alone: at least one finding must classify a root cause outside that class. Any defensible non-availability CWE satisfies this. affected_files entries may be written as /testbed/src/..., src/..., or the path relative to the source tree; equivalent forms are accepted.

plan.md

Record:

  1. Subsystem(s) and candidate enforcement-gap classes considered
  2. Root cause traced
  3. Fix approach and why it restores the intended guarantees
  4. How the fix was verified

Environment

  • Source lives in /testbed. Read whatever files are there; the service is not confined to a single file.
  • Runtime configuration is seeded through /etc/app.env.
  • Persistent state lives under /var/lib/onyx-desk.
  • The service listens on localhost:8741.
  • The fixture operator tokens documented in /etc/app.env are provided for local validation and are the intended way to exercise normal workflows.
  • Run sudo onyx-service when you need a container-local service process for manual validation. The helper builds and runs the submitted service under isolated unprivileged identities; stop it when finished.
  • Build with /testbed/build.sh /tmp/onyx-desk (C11).
  • Do not modify files outside /testbed, apart from the required files under /app/output.
  • Do not introduce new external package downloads or bump toolchain versions. Hardening of already-vendored code under /testbed/third_party/ is in scope.

Scope Constraints

  • Do not modify verifier components, tests, solution files, or grading outputs.
  • Do not replace the service binary as a substitute for source remediation.
  • Do not delete required product workflows or blanket-deny legitimate requests.
  • Do not rely on internet access; the task is closed-book and local-only.
  • Preserve API compatibility and documented live/inspect behavior for valid fragments.

Constraints

  1. 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.

  2. 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.

  3. 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.

  4. 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.

  5. 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.