Malformed Socket API responses allow known-malware test packages through SFW

Open
#65 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
68/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
shell
Domain
api, cli, security

Research direction

Start with the SFW CLI path that handles Socket API alert lookup failures and the wrapped command's exit status. Reproduce the provided lodahs command, then run the blocking assertions referenced in the issue across the supported platforms. Done means the known-malware package is blocked and an alert lookup failure cannot result in a successful download or exit.

Written by the indexing model from the issue text.

Description

SFW allows documented malware test packages to download when alert lookups fail with Malformed Socket API response (Invalid input). The wrapped command exits successfully.

Reproduced with the native release binaries for SFW 1.15.1 and 1.15.2 on macOS ARM64. Our CI also fails its blocking assertions on Linux, macOS, and Windows.

Reproduction

This requests the lodahs security placeholder and discards the download without executing package code:

SFW_DEBUG=true sfw --verbose curl \
  --fail --silent --show-error --max-time 25 \
  https://registry.npmjs.org/lodahs/-/lodahs-0.0.1-security.tgz \
  -o /dev/null
echo $?
Actual behavior

The download succeeds and the exit code is 0. Debug output includes:

Error occurred: error while fetching package alerts
{"errors":["Malformed Socket API response (Invalid input)"],"purlStrings":["pkg:npm/[email protected]"]}

There is no package-block message.

Expected behavior

lodahs should be blocked, as described in Socket's sample-package documentation. Alert lookup failures should clearly indicate that protection failed.

Additional evidence

This resembles #61's successful exit after an internal error, but here the wrapped command completes and downloads the package. I have not confirmed whether the root cause is related.

Dominant language
No language data
Stars
271
Forks
8
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from SocketDev/sfw-free

All issues in SocketDev/sfw-free

Similar issues

More Backend & API Design issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.