Decide: should socket.yml refuse a bare package name with a version ([email protected]), as the selection filter does?

オープン
#2,297 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
1〜2日
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
rust
領域
cli

調査の方向性

Read CLI_CONTRACT.md and the validation for socket.yml and the selection filter to compare their handling of versioned bare package names. The issue presents three options and recommends refusing these entries in both patches.ignorePackages and patches.packages; a maintainer decision is needed before implementation. Done means the chosen behavior is applied consistently and documented.

索引モデルが issue の本文から書いたものです。

説明

agent:needs-human agent:triaged arch-audit priority:p3

[agent] A decision for a maintainer, from the architecture refactor routine. Found on main at cfc870f while running the socket.yml patch policy. Related: #2294 (the same validator).

The question

Should socket.yml refuse a bare package name written with a version ([email protected]) in patches.ignorePackages and patches.packages, as the selection filter does?

What happens today

A bare name is compared with package names whole, so [email protected] can never match. In a denylist that is a deny that does nothing, with no warning:

$ cat socket.yml
version: 2
patches:
  ignorePackages:
    - [email protected]

$ socket-patch scan --mode agent
Applied 6 patches.
  CRITICAL  [email protected]     CVE-2026-0001
  …
(exit 0)

policy.filtered[] has no entry for lodash, warnings[] has nothing about the spec, and node_modules/lodash/index.js holds the patched content afterwards. In patches.packages the same entry selects nothing, which at least fails closed.

The selection filter refuses the same entry:

$ socket-patch scan --mode agent --dry-run --selection-filter filter.json
Error: selection filter filter.json: skip.packages[0]: a bare name takes no version; write a purl (`pkg:npm/[email protected]`): `[email protected]`
(exit 2)

Why the contract does not settle it

CLI_CONTRACT.md lists what is invalid in socket.yml ("Invalid: empty, or pkg: without a type and a name"), and says of the selection filter that it also refuses an entry "that could never match: a bare package name with a version". So today's behavior is the documented one in both places. The same section says "Because the file only narrows, a file that cannot be honored never means "no policy"", which is the case for refusing it.

Refusing it makes a socket.yml that is accepted today fail every scan with socket_yml_invalid (exit 1) until the entry is rewritten as a purl.

Options

  1. Refuse it in socket.yml with the selection filter's message. Fail closed, one rule in both files. A file that holds such an entry today starts failing scans.
  2. Warn and continue: a run-level warning that the entry can never match (beside socket_yml_ignored_value). No scan starts failing; the deny still does nothing until someone reads the warning.
  3. Leave it, and say in docs/configuration.md that a bare name takes no version.

The routine recommends option 1 for ignorePackages and packages alike: a deny that silently does nothing is the outcome the validation section exists to prevent.

scan --package [email protected] has the same reading (it matches nothing); #2296 covers what that run prints.


Generated by Claude Code

主要言語
Rust
スター
9
フォーク
2
平均マージ
1日 8時間
マージ済み PR(30日)
313

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

SocketDev/socket-patch のほかの issue

SocketDev/socket-patch の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。