feat: add checkMalware API for normalized malware detection#538
Merged
John-David Dalton (jdalton) merged 4 commits intomainfrom Apr 2, 2026
Merged
feat: add checkMalware API for normalized malware detection#538John-David Dalton (jdalton) merged 4 commits intomainfrom
John-David Dalton (jdalton) merged 4 commits intomainfrom
Conversation
Add a high-level checkMalware method to SocketSdk that wraps batchPackageFetch with normalized, policy-aware results. For public tokens, alert actions are derived from the client-side publicPolicy map. For org tokens, server-assigned actions are used as-is. Returns blocked/warned flags per package for easy consumption by hooks, CI scripts, and IDE extensions.
…n/blocked/warned Remove action, blocked, and warned from the result type. Instead, filter alerts by policy so only actionable alerts (error/warn) are returned. Consumers check alerts directly rather than interpreting policy-derived fields.
Route public token requests through the firewall API (firewall-api.socket.dev/purl) which returns full artifact data including score, namespace, alert props, categories, and fix info. Org tokens continue using the batch PURL API. Both paths normalize to the same result shape with richer alert data (category, props, fix) now available for all token types.
Contributor
Author
|
Note: PR #537 ( |
4 tasks
Bill Li (billxinli)
approved these changes
Apr 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
checkMalware(components)method toSocketSdkwith dual-path architecture:firewall-api.socket.dev/purl/{purl}) — returns full artifact data (score, namespace, alert props/categories/fix info) without reshapingapi.socket.dev/v0/purl) — uses org policy, full artifact dataMalwareCheckPackageresult shapeerrorandwarnactions includedMalwareCheckAlert,MalwareCheckPackage,MalwareCheckResult,MalwareCheckScoreSOCKET_FIREWALL_API_URLWhy two paths?
The batch API with public tokens goes through
reshapeArtifactForPublicPolicywhich stripsscore,namespace,props,category, andfixfrom the response. The firewall API returns the sameSocketArtifactdata but unstripped, giving public token users the same rich data that org token users get.Normalized result per package
Test plan
success: false