Skip to content

feat(integration-jfrog): delete XRay issue on withdrawn report (Stage 2) - #51

Merged
KunalSin9h merged 4 commits into
mainfrom
feat/jfrog-stage2-withdrawn-delete
Aug 26, 2026
Merged

feat(integration-jfrog): delete XRay issue on withdrawn report (Stage 2)#51
KunalSin9h merged 4 commits into
mainfrom
feat/jfrog-stage2-withdrawn-delete

Conversation

@KunalSin9h

Copy link
Copy Markdown
Member

Stage 2 of the JFrog integration: act on withdrawn reports by deleting the XRay Custom Issue. Builds on the merged feed migration (#47) and dry-run/cursor work (#49).

What

When the feed re-delivers a report as withdrawn (for example a retracted false positive), delete the matching XRay Custom Issue instead of logging a no-op. Before this, the daemon printed Withdrawn report … retraction handling not yet enabled, skipping.

How

  • Add deleteMaliciousPackage to the xrayClient port: DELETE /xray/api/v1/events/{id}, keyed by the reproducible SD-<report_id> (no stored name-to-id mapping needed).
  • handleRecord routes a withdrawn report to delete, any other malicious report to push.
  • printClient prints Would delete: for dry-run and sends nothing.

Delete semantics

  • 200 → deleted.
  • 404 → benign: the issue is already absent, which is the state a delete aims for. Logged as "already absent", cursor still advances.
  • Over-length id → skipped: it was never pushed (same guard as push).
  • Other non-2xx / transport → best-effort logged failure, never fatal (same posture as push).

Tests

  • Client: delete happy-path (asserts DELETE …/events/SD-… + bearer), 404 benign, 500 error, over-length skip (no call).
  • Print client: dry-run delete previews and never sends; over-length stays quiet.
  • Service routing: withdrawn → delete, live → push, delete failure not fatal, 404 handled.

go build ./..., go test ./..., gofmt, and the cobra convention tests are green.

Docs

  • docs/cmd/integration-jfrog-run.md: withdrawn-report behaviour now describes the delete.
  • docs/integration-jfrog.md: flow diagram, log examples, and the withdrawn-reports section updated.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RS4e9U1L2dP4H5XXeGPe6y


Generated by Claude Code

When the feed re-delivers a report as withdrawn (for example a retracted
false positive), delete the matching XRay Custom Issue instead of logging a
no-op. The issue id is the reproducible SD-<report_id>, so the delete needs
no stored name-to-id mapping.

- Add deleteMaliciousPackage to the xrayClient port: DELETE
  /xray/api/v1/events/{id}. 404 is benign (already absent), an over-length id
  is skipped (never pushed), other non-2xx is a logged best-effort failure.
- handleRecord routes a withdrawn report to delete, any other malicious report
  to push.
- printClient prints "Would delete" for dry-run and sends nothing.
- Docs: run behaviour and the internal design doc updated to reflect delete.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RS4e9U1L2dP4H5XXeGPe6y
@safedep

safedep Bot commented Aug 25, 2026

Copy link
Copy Markdown

SafeDep Report Summary

Green Malicious Packages Badge Green Vulnerable Packages Badge Green Risky License Badge

No dependency changes detected. Nothing to scan.

View complete scan results →

This report is generated by SafeDep GitHub App

…ary as description

The feed title is only the first few words of the feed summary, so mapping the
XRay summary to the feed title produced a truncated, redundant headline. Set the
XRay summary to the synthesized "MALICIOUS PACKAGE: <name> contains malicious
code" instead, and keep the XRay description sourced from the feed summary.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RS4e9U1L2dP4H5XXeGPe6y
arunanshub
arunanshub previously approved these changes Aug 26, 2026
claude added 2 commits August 26, 2026 08:41
…elete 404

XRay does not upsert on a duplicate id, so re-pushing an unchanged report (on
restart or an overlapping --backfill) returns 400 "already exists". That is the
desired end state (issue present), so pushMaliciousPackage now returns it as
benign (id, 400, nil) and the service logs "Already present" at info level,
matching the delete "already absent" (404) handling instead of a yellow
"Push failed" warning. Other 400s remain errors.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RS4e9U1L2dP4H5XXeGPe6y
Change the synthesized XRay Custom Issue summary from
"MALICIOUS PACKAGE: <name> contains malicious code" to
"<name> identified as Malware by SafeDep".

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RS4e9U1L2dP4H5XXeGPe6y
@KunalSin9h
KunalSin9h merged commit e4ce3c0 into main Aug 26, 2026
6 checks passed
@arunanshub
arunanshub deleted the feat/jfrog-stage2-withdrawn-delete branch August 26, 2026 09:09
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.

3 participants