Skip to content

WKS-2953 - Add AI blocked download explainer BEFORE_DOWNLOAD sample - #81

Merged
ehl-jf merged 1 commit into
mainfrom
feature/WKS-2953-claude-before-download-sample
Oct 12, 2026
Merged

ehl-jf merged 1 commit into
mainfrom
feature/WKS-2953-claude-before-download-sample

Conversation

@ehl-jf

@ehl-jf ehl-jf commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • New sample under samples/artifactory/BEFORE_DOWNLOAD/ai-blocked-download-explainer/: on BEFORE_DOWNLOAD, blocks the download when the artifact's existing Xray scan has more critical security issues than maxCriticalIssues (default 0).
  • The decision is deterministic. Claude (Anthropic Messages API) is only asked to explain a block: it gets the critical CVEs and their affected version ranges from the Xray artifact summary API, and returns a two-sentence explanation with an upgrade recommendation, appended to the block message.
  • Claude is only called on blocked downloads (not on HEAD or checksum requests), with claude-haiku-4-5 and a small max_tokens, since the client is waiting. If the API key is missing or the call fails, the download is still blocked with the static message.
  • Artifactory returns the message in the body of an HTTP 409, which many clients (including jf rt download) don't print, so the message is also posted to Slack when Slack_URL is set.
  • README covers secrets, properties, a Claude walkthrough with a real prompt and response, and an end-to-end run guide.

Jira: WKS-2953

Blocks downloads whose Xray scan exceeds a critical issue threshold and
asks Claude to turn the blocking CVEs into a short, actionable message
returned to the client. The decision stays deterministic; Claude is only
called on blocked downloads (not HEAD/checksum), with a fast model and a
small max_tokens, falling back to the static block message on any failure.

Since many clients only print the HTTP 409 status of a blocked download,
the block message is also posted to Slack when Slack_URL is configured.
@ehl-jf
ehl-jf merged commit 94ffa31 into main Oct 12, 2026
1 check passed
@ehl-jf
ehl-jf deleted the feature/WKS-2953-claude-before-download-sample branch October 12, 2026 07:40
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.

1 participant