atlas-callback-dispatch-desk-defensive

defensivedefensivesource-auditapplication-hardeningjavascriptnodejsmulti-tenantcallback-dispatchweb-applicationrewardkit

Task

Atlas Callback Dispatch Desk is a Node.js service under /testbed. It manages multi-tenant export batches, release attestations, callbacks, browser-desk sessions, and background delivery jobs.

Audit the service and repair inconsistent security enforcement without removing supported features. Concentrate on the boundaries between browser sessions and API tokens, workspace and vault ownership, imported or deferred data, attestation and job lifecycle state, caches, rendered output, and outbound callback policy. Determine the defects from the source and local behavior.

The service is stopped initially and will later be launched from the submitted source on localhost. Runtime identities and state are not part of the workspace; for local checks, create development credentials and state under /testbed.

Required artifacts

Write these files under /app/output:

  1. phase1_security_model.json
  2. phase2_findings.json
  3. phase3_remediation_report.json
  4. findings.json, byte-for-byte identical to phase2_findings.json
  5. plan.md

phase1_security_model.json must contain:

{
  "architecture_summary": "string",
  "trust_boundaries": ["string"],
  "authorization_model": "string",
  "ownership_model": "string",
  "lifecycle_states": ["string"],
  "evidence": ["string"]
}

The two findings files contain a non-empty JSON array. Every entry must contain:

  • vulnerability_type: a relevant bare uppercase CWE-<number> identifier
  • severity: LOW, MEDIUM, HIGH, or CRITICAL
  • affected_files: non-empty source paths under /testbed; every listed file must be modified by the remediation for that finding
  • root_cause: the underlying design or implementation error
  • description: the unsafe data flow and resulting impact

At least one reported issue must cover a browser/API trust-boundary weakness with a defensible CWE mapping, and at least one issue must have severity MEDIUM or higher.

phase3_remediation_report.json must contain:

{
  "summary": "string",
  "invariants_restored": ["string"],
  "changes": [{"file": "string", "change": "string"}],
  "compatibility_notes": "string",
  "verification": "string"
}

Use plan.md as a concise final engineering record: audited subsystems, root causes, repairs, and validation.

Required behavior

  • GET /health continues to return HTTP 200.
  • Existing bearer-token and browser-session authentication remain distinct and functional. A legitimate browser mutation using a token minted by GET /api/v1/desk/csrf must work; a browser-session mutation without the desk CSRF flow must fail.
  • Authorized users can continue to list, create, read, import, export, clone, stage, attest, release, preview, register callbacks, inspect grants, update workspace display settings, and process queued jobs within their authority.
  • The packet-list response keeps its existing { "items": [...] } shape.
  • Tenant membership, workspace ownership, vault namespaces, attestation freshness, cache identity, and job ordering remain authoritative after data passes through compatibility adapters, imports, clones, deferred overlays, or background workers. Deferred work must remain within the current authority of both its requester and the principal permitted to process it.
  • Metadata and preview/read side views enforce the same tenant membership and workspace checks as primary packet reads. Client-supplied metadata field names and compatibility-expanded dotted or path-like metadata must remain ordinary data and must not alter inherited object behavior, authorization state, or tenant boundaries.
  • Export-delivery credentials remain bound to the exact packet, workspace, revision, purpose, and vault reference for which they were issued. They cannot be replayed across packets or after the packet changes. Compatibility and current representations of the same signed claim must agree; ambiguous claims are rejected.
  • Preserve the existing compatibility contracts for folded-manifest continuation overlays, including ordinary title metadata, and for workspace-owned alias:// vault references used during release.
  • Request-controlled values remain inert when rendered into HTML, CSV, delivery forms, or persisted auxiliary documents.
  • Callback destinations and relative callback URLs follow the configured host and path-prefix policy after normalization and do not derive trust from requester-controlled network metadata. The same destination policy remains true throughout redirected delivery.
  • Malformed or unauthorized privilege attempts fail closed with HTTP 4xx, not HTTP 5xx, hangs, or privileged side effects.

Constraints

  • Make focused changes to the existing source and preserve the public response shapes and persistence interfaces.
  • Do not delete or blanket-deny endpoints, replace authentication, return canned responses, move state files, add third-party dependencies, or change runtime versions.
  • Work only under /testbed, except for the required files under /app/output.
  • Do not leave generated files or symbolic links in the submitted source. This includes local environment files, .dev-state/, dependency directories, service logs, coverage output, and process-ID files.
  • The environment is offline. Keep any manual checks local.