Skip to content

Commit a3d456e

Browse files
committed
fix(hooks): repair @socketsecurityhook- regression in package names + sync canonical formatting
A botched perl rename had corrupted hook package.json names from '@socketsecurity/hook-path-guard' to '@socketsecurityhook-path-guard' (missing trailing slash), and a second pass converted that to '@socketsecurityhookhook-pathhook-guard' with the test script mangled to 'node hook-hook-test'. README and test-file references inherited the same broken substring. This commit overwrites all hook package.json files with canonical contents, scrubs '@socketsecurityhook-' from README/test refs, and syncs scripts/check-paths.mts and the path-guard skill reference template to the formatted version. Verified: gate passes + 29/29 path-guard tests pass on all 7 fleet primaries; every path-guard canonical file is now byte-identical across the fleet.
1 parent 34cdff1 commit a3d456e

9 files changed

Lines changed: 40 additions & 21 deletions

File tree

.claude/hooks/check-new-deps/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "@socketsecurityhook-check-new-deps",
2+
"name": "hook-check-new-deps",
33
"private": true,
44
"type": "module",
55
"main": "./index.mts",
@@ -11,7 +11,7 @@
1111
},
1212
"dependencies": {
1313
"@socketregistry/packageurl-js": "1.4.2",
14-
"@socketsecurity/lib": "5.24.0",
14+
"@socketsecurity/lib": "catalog:",
1515
"@socketsecurity/sdk": "4.0.1"
1616
},
1717
"devDependencies": {

.claude/hooks/path-guard/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Hook bugs fail **open** — a crash in the hook writes a log line and returns ex
5050
## Testing
5151

5252
```bash
53-
pnpm --filter @socketsecurityhook-path-guard test
53+
pnpm --filter hook-path-guard test
5454
```
5555

5656
Adding a new detection pattern: update `STAGE_SEGMENTS` (or `KNOWN_SIBLING_PACKAGES`) in `index.mts`, add a positive and negative test in `test/path-guard.test.mts`.

.claude/hooks/path-guard/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "@socketsecurityhook-path-guard",
2+
"name": "hook-path-guard",
33
"private": true,
44
"type": "module",
55
"main": "./index.mts",

.claude/hooks/path-guard/test/path-guard.test.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// mock PreToolUse payload to the hook's stdin and asserts on its exit
33
// code + stderr. Exit 2 = blocked; exit 0 = allowed.
44
//
5-
// Run: pnpm --filter @socketsecurityhook-path-guard test
5+
// Run: pnpm --filter hook-path-guard test
66
// (or directly: node --test test/*.test.mts)
77

88
import { spawnSync } from 'node:child_process'

.claude/hooks/token-guard/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ The hook reads the tool-use payload from stdin, type-checks `tool_name === 'Bash
4141
## Testing
4242

4343
```bash
44-
pnpm --filter @socketsecurityhook-token-guard test
44+
pnpm --filter hook-token-guard test
4545
```
4646

4747
Adding new token-shape detections: update `LITERAL_TOKEN_PATTERNS` in `index.mts`, add a positive and negative test in `test/token-guard.test.mts`.

.claude/hooks/token-guard/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "@socketsecurityhook-token-guard",
2+
"name": "hook-token-guard",
33
"private": true,
44
"type": "module",
55
"main": "./index.mts",

.claude/skills/path-guard/reference/check-paths.mts.tmpl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,8 @@ const loadAllowlist = (): AllowlistEntry[] => {
229229
blockLines = []
230230
return
231231
}
232-
;(current as any)[key] = key === 'line' ? Number(unquote(trimmed)) : unquote(trimmed)
232+
;(current as any)[key] =
233+
key === 'line' ? Number(unquote(trimmed)) : unquote(trimmed)
233234
}
234235
if (line.startsWith('- ')) {
235236
if (current && current.reason) {
@@ -317,8 +318,7 @@ const isAllowlisted = (finding: Finding): boolean =>
317318
const hashProvided =
318319
typeof entry.snippet_hash === 'string' && entry.snippet_hash.length > 0
319320
if (lineProvided || hashProvided) {
320-
const lineMatches =
321-
lineProvided && entry.line === finding.line
321+
const lineMatches = lineProvided && entry.line === finding.line
322322
const hashMatches =
323323
hashProvided && entry.snippet_hash === snippetHash(finding.snippet)
324324
if (!(lineMatches || hashMatches)) {
@@ -382,7 +382,8 @@ const STRING_LITERAL_RE = /(['"])((?:\\.|(?!\1)[^\\])*)\1/g
382382
// (including those with `${...}` placeholders) so Rule A also catches
383383
// path construction via template literals like
384384
// `${buildDir}/out/Final/${binary}` or `build/${mode}/out/Final`.
385-
const TEMPLATE_LITERAL_RE = /`((?:\\.|(?:\$\{(?:[^{}]|\{[^{}]*\})*\})|(?!`)[^\\])*)`/g
385+
const TEMPLATE_LITERAL_RE =
386+
/`((?:\\.|(?:\$\{(?:[^{}]|\{[^{}]*\})*\})|(?!`)[^\\])*)`/g
386387
387388
/**
388389
* Convert a template-literal body into a synthetic forward-slash path

scripts/check-paths.mts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,8 @@ const loadAllowlist = (): AllowlistEntry[] => {
229229
blockLines = []
230230
return
231231
}
232-
;(current as any)[key] = key === 'line' ? Number(unquote(trimmed)) : unquote(trimmed)
232+
;(current as any)[key] =
233+
key === 'line' ? Number(unquote(trimmed)) : unquote(trimmed)
233234
}
234235
if (line.startsWith('- ')) {
235236
if (current && current.reason) {
@@ -317,8 +318,7 @@ const isAllowlisted = (finding: Finding): boolean =>
317318
const hashProvided =
318319
typeof entry.snippet_hash === 'string' && entry.snippet_hash.length > 0
319320
if (lineProvided || hashProvided) {
320-
const lineMatches =
321-
lineProvided && entry.line === finding.line
321+
const lineMatches = lineProvided && entry.line === finding.line
322322
const hashMatches =
323323
hashProvided && entry.snippet_hash === snippetHash(finding.snippet)
324324
if (!(lineMatches || hashMatches)) {
@@ -382,7 +382,8 @@ const STRING_LITERAL_RE = /(['"])((?:\\.|(?!\1)[^\\])*)\1/g
382382
// (including those with `${...}` placeholders) so Rule A also catches
383383
// path construction via template literals like
384384
// `${buildDir}/out/Final/${binary}` or `build/${mode}/out/Final`.
385-
const TEMPLATE_LITERAL_RE = /`((?:\\.|(?:\$\{(?:[^{}]|\{[^{}]*\})*\})|(?!`)[^\\])*)`/g
385+
const TEMPLATE_LITERAL_RE =
386+
/`((?:\\.|(?:\$\{(?:[^{}]|\{[^{}]*\})*\})|(?!`)[^\\])*)`/g
386387
387388
/**
388389
* Convert a template-literal body into a synthetic forward-slash path

xport.schema.json

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
"title": "xport lock-step manifest",
55
"description": "Unified lock-step manifest shared across Socket repos. One schema, all cases — `kind` discriminator on each row selects which flavor of lock-step applies.",
66
"type": "object",
7-
"required": ["rows"],
7+
"required": [
8+
"rows"
9+
],
810
"properties": {
911
"$schema": {
1012
"type": "string"
@@ -30,7 +32,10 @@
3032
"^(.*)$": {
3133
"additionalProperties": false,
3234
"type": "object",
33-
"required": ["submodule", "repo"],
35+
"required": [
36+
"submodule",
37+
"repo"
38+
],
3439
"properties": {
3540
"submodule": {
3641
"description": "Submodule path, relative to repo root.",
@@ -52,7 +57,9 @@
5257
"^(.*)$": {
5358
"additionalProperties": false,
5459
"type": "object",
55-
"required": ["path"],
60+
"required": [
61+
"path"
62+
],
5663
"properties": {
5764
"path": {
5865
"description": "Path to the port's root directory, relative to repo root.",
@@ -205,7 +212,13 @@
205212
"additionalProperties": false,
206213
"description": "A behavioral feature reimplemented locally to match upstream behavior. Three-pillar validation: code patterns, test patterns, fixture snapshots.",
207214
"type": "object",
208-
"required": ["kind", "id", "upstream", "criticality", "local_area"],
215+
"required": [
216+
"kind",
217+
"id",
218+
"upstream",
219+
"criticality",
220+
"local_area"
221+
],
209222
"properties": {
210223
"kind": {
211224
"const": "feature-parity",
@@ -260,7 +273,9 @@
260273
"additionalProperties": false,
261274
"description": "Golden-input verification. Prefer snapshot-based diffs over hardcoded counts (brittleness lesson from sdxgen's lock-step-features).",
262275
"type": "object",
263-
"required": ["fixture_path"],
276+
"required": [
277+
"fixture_path"
278+
],
264279
"properties": {
265280
"fixture_path": {
266281
"type": "string"
@@ -410,7 +425,9 @@
410425
"additionalProperties": false,
411426
"description": "Per-port status for a lang-parity row. `implemented` = port meets assertions; `opt-out` = port consciously skips, requires non-empty `reason`.",
412427
"type": "object",
413-
"required": ["status"],
428+
"required": [
429+
"status"
430+
],
414431
"properties": {
415432
"status": {
416433
"anyOf": [

0 commit comments

Comments
 (0)