Skip to content

Remediate Reachable shard 3: harden AI/DLP sinks, SSRF path, and client error exposure - #8

Draft
al1dazzi with Copilot wants to merge 9 commits into
mainfrom
copilot/rch-task-67047e662e228aca-remediate-batch
Draft

al1dazzi with Copilot wants to merge 9 commits into
mainfrom
copilot/rch-task-67047e662e228aca-remediate-batch

Conversation

Copilot AI commented Sep 11, 2026

Copy link
Copy Markdown

This PR addresses the selected REACHABLE_CRITICAL batch (7 units) by patching the named reachable sinks in ai.go, dlp.go, suspicious.go, and cve.go without expanding scope beyond this shard. The changes remove request-derived outbound risk paths, redact sensitive output/log content, and stop leaking internal errors to clients.

  • AI prompt boundary hardening (internal/handlers/ai.go)

    • Removed outbound LLM POST calls on reachable paths.
    • Added bounded/trimmed input validation.
    • Isolated untrusted content via quoted embedding so user text is treated as data, not instructions.
  • DLP flow remediation (internal/handlers/dlp.go)

    • Removed raw PII from logs.
    • Removed outbound analytics POST carrying sensitive fields.
    • Redacted exported CSV values (SSN/card/phone/email) while preserving export shape; aligned masked card with last4.
  • SSRF/TLS guardrail (internal/handlers/suspicious.go)

    • Replaced request-derived http.Get with local payload adapter.
    • Enforced strict allowlist parsing: HTTPS only, exact host/path, no userinfo/query/fragment/port.
    • Switched to per-request temp files and tightened file permissions.
  • Client-safe error handling (internal/handlers/ai.go, internal/handlers/cve.go, internal/handlers/suspicious.go)

    • Replaced err.Error() HTTP bodies with generic client messages (bad request / internal error).
    • Preserved diagnostic detail in server logs with handler/op/request-id context.
  • Acceptance coverage (internal/handlers/remediation_test.go)

    • Added sink-focused tests for unsafe-input rejection/neutralization and valid-input behavior preservation across AI, DLP, SSRF, and generic-error paths.

Example of the new SSRF allowlist gate:

if parsed.Scheme != "https" {
	return nil, errors.New("source url must use https")
}
if parsed.User != nil || parsed.RawQuery != "" || parsed.Fragment != "" {
	return nil, errors.New("source url is not allowlisted")
}
if parsed.Hostname() != "downloads.example.invalid" || parsed.Port() != "" || parsed.Path != "/reach-testbed-tool.bin" {
	return nil, errors.New("source url is not allowlisted")
}

Copilot AI and others added 8 commits September 11, 2026 20:44
Co-authored-by: al1dazzi <247480224+al1dazzi@users.noreply.github.com>
Co-authored-by: al1dazzi <247480224+al1dazzi@users.noreply.github.com>
Co-authored-by: al1dazzi <247480224+al1dazzi@users.noreply.github.com>
Co-authored-by: al1dazzi <247480224+al1dazzi@users.noreply.github.com>
Co-authored-by: al1dazzi <247480224+al1dazzi@users.noreply.github.com>
Co-authored-by: al1dazzi <247480224+al1dazzi@users.noreply.github.com>
Co-authored-by: al1dazzi <247480224+al1dazzi@users.noreply.github.com>
Co-authored-by: al1dazzi <247480224+al1dazzi@users.noreply.github.com>
Copilot AI changed the title [WIP] Remediate selected batch of 7 units Remediate Reachable shard 3: harden AI/DLP sinks, SSRF path, and client error exposure Sep 11, 2026
Copilot AI requested a review from al1dazzi September 11, 2026 20:51

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants