Skip to content

Port the sandboxed threat detector and eligibility checks to JavaScript #79609

Todo

Description

@davidslater

Implement the detector and its in-session reporting tool as bundled JS under actions/setup/js. Use threat-detect v0.5.3 as the reference for verdicts and failure policy. Have gh-aw supply the resolved engine launch configuration so the JS runner can supervise a harness with an unfamiliar ID.

Runtime contract

Port artifact loading, static prompt analysis, warning policy, prompt preparation, private result sink, full and publishable results, machine-readable status reasons, retry/turn budgets, cancellation and timeout cleanup. A valid verdict recorded just before timeout wins as in v0.5.3. Reap descendants and preserve the terminal timeout behavior. Exercise all three existing engine launch conventions and a fixture harness with a different executable name.

Structural eligibility is a required false-positive control

  • prompt_injection requires a nonblank untrusted prompt region or comment-memory input. An unavailable template/rendered prompt, indeterminate extraction or unreadable comment memory keeps the relevant channel eligible.
  • secret_leak requires a nonempty safe-output file, patch/bundle, or comment memory. Requested issue/comment/PR text counts through the safe-output file. Preserve the reference behavior for uninspectable channels.
  • malicious_patch requires a patch/bundle channel. Rejected safe-output validation by itself is insufficient. A reported patch that could not be staged is uninspectable and stays eligible.
  • Compute eligibility from artifacts once per assessment. Preserve both enforcement points: the reporting tool gives actionable in-session feedback; the detector validates every sink result against its own authoritative eligibility before accepting it. Reject the whole ineligible report, never silently clear a category. Keep validation warnings and strict warning policy distinct from a finding.

Acceptance

Use v0.5.3 eligibility and detector tests to derive durable fixtures in gh-aw. For each category exercise eligible, provably absent and relevant uninspectable channels, including comment memory as both input and output. Use a scripted engine to exercise in-session correction, mixed valid/ineligible categories, and binding rejection even if advisory metadata is absent or wrong. With zero retries an uncorrected ineligible sink result yields invalid_report_exhausted / exit 2; test configured retries and terminal timeout separately. Run Go/JS parity comparisons during development and commit expected outputs so normal CI needs no detector download. Pass the JS-produced files through the JS conclude from PR 1.

Eligibility specification and two-tier contract · Reference eligibility tests.

Metadata

Metadata

Assignees

Labels

backlog:securitythreat-detection

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions