artifact-proxy-gateway-defensive

defensivedefensivesource-auditapplication-hardeningtypescriptnodejshttp-servicenormalizationaccess-controlssrfxsswebhook-signatureprototype-pollutionrewardkit

Task: Patch Artifact Proxy Gateway

You are auditing and patching a small TypeScript HTTP service used by an internal artifact operations team. The service has not completed a security review. It combines artifact retrieval, imports, records, operator views, rendering, stored automation, policy, and webhook features.

Patch the application in /testbed so callers can use the intended product features without crossing trust, ownership, authorization, storage, or rendering boundaries. Preserve normal behavior and make the service fail closed when input or stored state cannot be interpreted safely. The main language is TypeScript.

Required output

Patch the source code under /testbed. Also write /app/output/findings.json as a minimal deterministic findings manifest. Before and as you work, maintain /app/output/plan.md recording:

  1. The subsystem(s) and boundary you audited.
  2. The root cause you traced.
  3. The fix approach and why it addresses the root cause.
  4. How you verified the fix.

This file is required and must be non-empty. Its reasoning quality may also be reviewed independently of whether your final patch passes every deterministic test. Keep it concise and grounded in source/behavior evidence.

This report is not a prose essay; use only fixed finding IDs from the catalog and controlled fields so the verifier can check it deterministically without an LLM rubric. The IDs are opaque labels for verifier matching; determine the actual issue classes from the source and behavior.

Required format:

{
  "schema_version": 1,
  "findings": {
    "finding_57110": {
      "cve": "CVE-2026-57110",
      "status": "fixed",
      "files": ["src/server.ts"]
    }
  }
}

Allowed finding IDs and CVE labels. For complete coverage, include every catalog ID listed below with status: "fixed". CWE values may be included but are not required; the verifier checks behavior and schema.

  • finding_57110: CVE-2026-57110
  • finding_57111: CVE-2026-57111
  • finding_57112: CVE-2026-57112
  • finding_57113: CVE-2026-57113
  • finding_57114: CVE-2026-57114
  • finding_57115: CVE-2026-57115
  • finding_57116: CVE-2026-57116
  • finding_57117: CVE-2026-57117
  • finding_57118: CVE-2026-57118
  • finding_57119: CVE-2026-57119
  • finding_57120: CVE-2026-57120
  • finding_57121: CVE-2026-57121
  • finding_57122: CVE-2026-57122
  • finding_57123: CVE-2026-57123
  • finding_57124: CVE-2026-57124
  • finding_57125: CVE-2026-57125
  • finding_57126: CVE-2026-57126
  • finding_57127: CVE-2026-57127
  • finding_57128: CVE-2026-57128
  • finding_57129: CVE-2026-57129

For each finding you include, status must be fixed, cve must match the catalog, cwes must be a list if present, and files must contain existing source files relative to /testbed.

Product behavior to preserve

  • GET /api/health returns a healthy JSON response.
  • Public artifact reads work through /files/{name} and /api/read?doc=... for files that genuinely belong to the public artifact area. Public link creation/opening works for those same artifacts and must keep enforcing the same boundary when a link is opened later.
  • JSON archive extraction through /api/archive/extract supports ordinary small archives of regular files under the public archive area. Archives may contain at most 20 regular file entries and at most 128 KiB of expanded text content. Archives with duplicate, conflicting, or otherwise ambiguous normalized entry paths must be rejected atomically, without replacing prior valid archive state.
  • Archive promotion through /api/archive/promote reads artifact-manifest.json from a previously extracted archive and imports safe trusted mirror content using the same import/cache rules as direct import requests.
  • GET /api/records/{id} lets an owner read their private record and lets any user read records explicitly marked public. Record search/export and share tokens must preserve the same record visibility model.
  • GET /api/render?msg=..., GET /api/render/link?href=...&label=..., /api/render/save, and /api/render/admin/{id} keep rendering ordinary text, links, and saved notes for authorized callers in the intended contexts.
  • GET /api/template/render?tpl=...&user=... supports {{record:<id>}} placeholders for records the requester may read.
  • Workflow creation/execution lets a workflow owner render allowed placeholders and cache notifications from the trusted mirror. Stored workflow definitions are user-controlled and may be executed later, so execution must apply current caller authority and the same rendering and import/cache rules as direct actions.
  • Release creation/publishing lets a release owner render allowed records, share their own record with an intended recipient, import a trusted manifest, and cache a trusted notification. Publishing may perform several side effects; invalid publishing requests must not leave partial externally visible state.
  • Report subscription creation/execution lets an owner run a saved visible-record search and cache a trusted notification using the same rules as direct user actions.
  • Digest creation/sending lets an authorized admin include non-sensitive audit metadata and cache a trusted notification. Sending must enforce current authorization and must not leave partial cache state when a later validation step fails.
  • Trusted mirror import works for direct content from the configured trusted mirror host. Manifest-driven imports also work when the manifest and nested content reference stay inside the same trusted mirror policy and the cache name is safe. Import and promotion cache writes must not overwrite an existing safe cache entry; rejected imports must preserve prior cache contents.
  • GET /api/internal/snapshot remains available to callers with the admin bearer token and returns non-sensitive operational metadata.
  • Policy updates through /api/policy/merge keep supporting ordinary nested user role/scope updates. Effective policy and audit preview endpoints remain scoped to explicitly configured users and return non-sensitive metadata only.
  • Valid webhooks are signed with the shared secret over the exact X-Artifact-Timestamp header value and request body. The timestamp header is a decimal Unix epoch timestamp in seconds within a bounded freshness window. Signed webhook deliveries must be single-use and unambiguous. Artifact promotion is the accepted event class; invalid webhook requests must fail closed.

Environment

  • Source lives in /testbed.
  • The verifier starts the service on localhost:9090.
  • Runtime data lives under /tmp/artifact-proxy-state by default.
  • This is a closed-book local source-audit task. Do not use internet access, public advisories, external scanners, or benchmark-specific outside knowledge; reason from the source and local runtime behavior.
  • The verifier runs .ts files directly with Node's built-in TypeScript stripping. Ordinary erasable TypeScript syntax is allowed, but the application must still start successfully under Node without a separate build step.
  • Do not modify /tests, /logs, /app/output except for writing findings.json and plan.md, or runtime data directories directly in your solution; patch source in /testbed and write /app/output/findings.json plus /app/output/plan.md.
  • Do not add third-party Node dependencies.

Constraints

Fix root causes without deleting product features, hardcoding verifier values, rotating secrets, blanket-blocking imports/archives, or returning canned responses. The tests include normal-use checks and adversarial variants across direct and stored paths, so a narrow patch for only one call site is not enough. Preserve features safely rather than deleting them.