Skip to content

Commit 0955c7f

Browse files
committed
fix: address security and documentation issues
- Fix complex TOCTOU race in dlx/binary.ts by re-checking binary existence after metadata read - Fix incorrect package name in provenance workflow (@socketregistry/lib → @socketsecurity/lib) - Remove outdated src/index.ts reference from CLAUDE.md (file was removed in previous release) - Update lint.mjs example to use src/logger.ts instead of non-existent src/index.ts
1 parent a76d93c commit 0955c7f

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

.github/workflows/provenance.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ jobs:
2424
uses: SocketDev/socket-registry/.github/workflows/provenance.yml@4709a2443e5a036bb0cd94e5d1559f138f05994c # main
2525
with:
2626
debug: ${{ inputs.debug }}
27-
package-name: '@socketregistry/lib'
27+
package-name: '@socketsecurity/lib'
2828
setup-script: 'pnpm run build'
2929
use-trusted-publishing: true

CLAUDE.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -357,10 +357,9 @@ Use `pnpm run build:watch` or `pnpm run dev` for development with automatic rebu
357357
1. Create utility in appropriate `src/` subdirectory
358358
2. Use path aliases for internal imports
359359
3. Add type definitions
360-
4. Add to `src/index.ts` if public API
361-
5. Update `package.json` exports if direct export needed
362-
6. Add tests in `test/` matching structure
363-
7. Update types and build
360+
4. Update `package.json` exports if direct export needed
361+
5. Add tests in `test/` matching structure
362+
6. Update types and build
364363

365364
### Common Patterns
366365

scripts/lint.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ async function main() {
416416
logger.log(' pnpm lint --fix # Fix issues in changed files')
417417
logger.log(' pnpm lint --all # Lint all files')
418418
logger.log(' pnpm lint --staged --fix # Fix issues in staged files')
419-
logger.log(' pnpm lint src/index.ts # Lint specific file(s)')
419+
logger.log(' pnpm lint src/logger.ts # Lint specific file(s)')
420420
process.exitCode = 0
421421
return
422422
}

src/dlx/binary.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,11 @@ export async function dlxBinary(
302302
computedIntegrity = (metadata as Record<string, unknown>)[
303303
'integrity'
304304
] as string
305+
// Re-check binary exists after reading metadata (TOCTOU protection).
306+
// Prevents race where binary is deleted between validity check and use.
307+
if (!fs.existsSync(binaryPath)) {
308+
downloaded = true
309+
}
305310
} else {
306311
// If metadata is invalid, re-download.
307312
downloaded = true

0 commit comments

Comments
 (0)