opencode-v2-guard 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/deps-spec.md +2 -0
- package/package.json +1 -1
- package/src/deps.ts +5 -2
package/docs/deps-spec.md
CHANGED
|
@@ -24,6 +24,8 @@ npm: install|i, yarn: add, pnpm: add|install, pip: install, cargo: add. Флаг
|
|
|
24
24
|
`pkg`, `pkg@1.2.3`, `@scope/pkg@1.0.0` (версия после последнего `@`), pip: `pkg==1.0` (операторы
|
|
25
25
|
стрипаются). Все сегменты проверяются на нарушения (parseSegments), не только первый.
|
|
26
26
|
Прочее (curl, git clone, npx) → null.
|
|
27
|
+
Windows-формы менеджеров нормализуются: `npm.cmd`, `pnpm.cmd`, `yarn.ps1`, `pip.exe` → базовое имя
|
|
28
|
+
(иначе `npm.cmd install lodahs` проходил мимо — найдено живой проверкой опубликованного 1.0.0, фикс в 1.0.1).
|
|
27
29
|
|
|
28
30
|
### 2.2 Blocklist (встроенный список)
|
|
29
31
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-v2-guard",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Security plugin for OpenCode V2 — deterministic secret/PII redaction, sensitive-path blocking, prompt-injection detection in skills, package-install interception (blocklist + typosquat)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
package/src/deps.ts
CHANGED
|
@@ -95,8 +95,11 @@ function parseSegment(segment: string): InstallTarget | null {
|
|
|
95
95
|
}
|
|
96
96
|
break
|
|
97
97
|
}
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
// Windows runners: npm.cmd, pnpm.cmd, pip.exe, yarn.ps1, ... — strip the script/extension suffix
|
|
99
|
+
const raw = tokens[i]
|
|
100
|
+
if (!raw) return null
|
|
101
|
+
const manager = raw.replace(/\.(?:cmd|ps1|exe|bat)$/i, "")
|
|
102
|
+
if (!MANAGERS.has(manager)) return null
|
|
100
103
|
const sub = tokens[i + 1]
|
|
101
104
|
if (!SUBCOMMANDS[manager]?.includes(sub)) return null
|
|
102
105
|
if (manager === "yarn" && tokens[i + 2] === "global") return null
|