forgelink-seal-lineage-defensive
Task
A Node.js HTTP service lives under /testbed: ForgeLink, a multi-tenant handoff
packet platform for operations teams. Workspaces own packets that move through
draft, staging, approval, and release. Authorized users can create and update
packets, clone templates, import and export handoff bundles, issue seals, stage
packets, release packets (synchronously or through a background job drain),
preview packet HTML, inspect grants, and administer workspace display settings.
Perform an authorized defensive security review of the application. Identify and remediate places where trust boundaries, authorization, ownership, representation integrity, and lifecycle assumptions are not consistently enforced across the handoff, seal, release, import/export, and related paths, while preserving intended application behavior. Diagnose weaknesses from the source and from observed local behavior. No checklist of defect classes is provided.
This is a closed, local service: do not contact external targets, do not
intentionally disrupt unrelated services, and do not create standalone proof
programs. Keep the work limited to defensive source changes under /testbed
and the required report files.
Required artifacts
Write these files under /app/output/:
phase1_security_model.json— reconstructed security modelphase2_findings.json— identified security findings (JSON array)phase3_remediation_report.json— remediation summaryfindings.json— same findings array as phase 2 (compatibility mirror)plan.md— working notes graded for reasoning quality independently of whether every deterministic check passes
phase1_security_model.json schema
{
"architecture_summary": "string",
"trust_boundaries": ["string"],
"authorization_model": "string",
"ownership_model": "string",
"lifecycle_states": ["string"],
"evidence": ["string"]
}
Findings schema (phase2_findings.json and findings.json)
A JSON array. Each entry must include:
vulnerability_type: a CWE weakness identifier (formatCWE-<number>)severity:LOW,MEDIUM,HIGH, orCRITICALaffected_files: list of modified file paths under/testbed(relative paths under the source tree, or absolute paths under/testbed)root_cause: brief explanation of the underlying architectural flawdescription: unsafe data flow and resulting impact
phase3_remediation_report.json schema
{
"summary": "string",
"invariants_restored": ["string"],
"changes": [{"file": "string", "change": "string"}],
"compatibility_notes": "string",
"verification": "string"
}
plan.md
Record:
- Subsystem(s) and suspected weakness classes considered
- Root cause traced
- Fix approach and why it restores the intended guarantees
- 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 outside
/testbedunder the configured state directory and is used by both the service and the verifier. - The verifier starts the service on
localhost:9090. - Verifier tests and seed files live outside
/testbed; do not modify any file outside/testbed. - Node.js standard library is sufficient; do not introduce new third-party dependencies or bump runtime versions.
Authorized bearer tokens are defined in /etc/app.env as
NORTH_OWNER_TOKEN, NORTH_REVIEWER_TOKEN, SOUTH_MEMBER_TOKEN,
SOUTH_OWNER_TOKEN, and ADMIN_TOKEN. Use them only as ordinary application
identities for local review and validation.
Behavioral expectations after remediation
GET /healthreturns HTTP 200 while the service is healthy.- Authorized users keep listing and reading packets in their workspaces with
existing JSON field names and response shapes, including
GET /api/v1/packetsreturning an object with anitemsarray. - Template clone, import/export of ordinary packet content (including benign properties overlays and nested metadata overlays, same-workspace handoff_manifest includes that only merge titles/tags/descriptions, and legacy_payload fields that only adjust titles/tags/descriptions), staging, sealing, authorized packet field updates, preview, ordinary content export, compatible release encodings for workspace-owned vaults, and legitimate same-workspace release continue to work for authorized principals.
- Workspace-owned vault bindings and workspace-owned vault aliases that expand to the caller's own vault namespace continue to release after a fresh seal.
- A seal issued for staging does not authorize release; release requires a seal issued for the release lifecycle purpose.
- Imported foreign authority material may be removed during import or retained only when authoritative release checks prevent it from creating cross-workspace grants.
- Background job processing via
POST /api/v1/jobs/processremains available for legitimate queued releases. - Workspace owners/admins may still update workspace display name and slug when the slug is available.
- Malformed or unauthorized release attempts fail safely with HTTP 4xx responses rather than HTTP 5xx, hangs, or silent acceptance of privileged side effects.
- Do not disable packet detail, clone, import, export, stage, seal, release, preview, grants, or job-drain endpoints; do not replace authentication; do not rotate verifier tokens; do not replace responses with canned data; do not move state files out of their configured locations.
Scope constraints
- Restore intended security guarantees at authoritative enforcement points. Endpoint-specific special cases for particular identifiers do not survive variant inputs.
- Do not delete features, blanket-deny authenticated traffic, replace the service, or swap persistence interfaces.
- Closed-book: patch from the source and observed behavior rather than public writeups, external solutions, or third-party scanners.
- Do not inspect or modify verifier components, hidden oracle artifacts, or
files outside
/testbedexcept for writing the required/app/outputartifacts.
Working constraints
-
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.
-
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.
-
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.
-
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.
-
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.