Skip to content

Commit f03b832

Browse files
committed
chore(release): bump version to 2.10.1
1 parent 19d2db8 commit f03b832

6 files changed

Lines changed: 22 additions & 52 deletions

File tree

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [2.10.1](https://github.com/SocketDev/socket-lib/releases/tag/v2.10.1) - 2025-10-31
9+
10+
### Fixed
11+
12+
- **Process lock directory creation**: Use recursive mkdir to ensure parent directories exist when creating lock directory
13+
- **Node.js debug flags**: Remove buggy `getNodeDebugFlags()` function that returned debug flags without required argument values
14+
815
## [2.10.0](https://github.com/SocketDev/socket-lib/releases/tag/v2.10.0) - 2025-10-30
916

1017
### Added

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@socketsecurity/lib",
3-
"version": "2.10.0",
3+
"version": "2.10.1",
44
"license": "MIT",
55
"description": "Core utilities and infrastructure for Socket.dev security tools",
66
"keywords": [

src/constants/node.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -121,19 +121,6 @@ export function supportsProcessSend(): boolean {
121121
}
122122

123123
// Node.js flags.
124-
let _nodeDebugFlags: string[]
125-
export function getNodeDebugFlags(): string[] {
126-
if (_nodeDebugFlags === undefined) {
127-
_nodeDebugFlags = [
128-
'--inspect',
129-
'--inspect-brk',
130-
'--inspect-port',
131-
'--inspect-publish-uid',
132-
]
133-
}
134-
return _nodeDebugFlags
135-
}
136-
137124
let _nodeHardenFlags: string[]
138125
export function getNodeHardenFlags(): string[] {
139126
if (_nodeHardenFlags === undefined) {

src/process-lock.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,13 @@ class ProcessLockManager {
256256
}
257257
}
258258

259-
// Atomic lock acquisition via mkdir.
260-
mkdirSync(lockPath, { recursive: false })
259+
// Check if lock already exists before creating.
260+
if (existsSync(lockPath)) {
261+
throw new Error(`Lock already exists: ${lockPath}`)
262+
}
263+
264+
// Atomic lock acquisition via mkdir with recursive to create parent dirs.
265+
mkdirSync(lockPath, { recursive: true })
261266

262267
// Track lock for cleanup.
263268
this.activeLocks.add(lockPath)

test/constants/node.test.ts

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {
77
NODE_SEA_FUSE,
88
getExecPath,
99
getMaintainedNodeVersions,
10-
getNodeDebugFlags,
1110
getNodeDisableSigusr1Flags,
1211
getNodeHardenFlags,
1312
getNodeMajorVersion,
@@ -245,28 +244,6 @@ describe('node constants', () => {
245244
})
246245
})
247246

248-
describe('getNodeDebugFlags', () => {
249-
it('should return array of debug flags', () => {
250-
const flags = getNodeDebugFlags()
251-
expect(Array.isArray(flags)).toBe(true)
252-
expect(flags.length).toBeGreaterThan(0)
253-
})
254-
255-
it('should include inspect flags', () => {
256-
const flags = getNodeDebugFlags()
257-
expect(flags).toContain('--inspect')
258-
expect(flags).toContain('--inspect-brk')
259-
expect(flags).toContain('--inspect-port')
260-
expect(flags).toContain('--inspect-publish-uid')
261-
})
262-
263-
it('should return same instance on multiple calls', () => {
264-
const first = getNodeDebugFlags()
265-
const second = getNodeDebugFlags()
266-
expect(first).toBe(second)
267-
})
268-
})
269-
270247
describe('getNodeHardenFlags', () => {
271248
it('should return array of hardening flags', () => {
272249
const flags = getNodeHardenFlags()
@@ -436,7 +413,6 @@ describe('node constants', () => {
436413
it('should handle all flag getters being called multiple times', () => {
437414
// Call each getter multiple times to ensure caching works
438415
for (let i = 0; i < 3; i++) {
439-
getNodeDebugFlags()
440416
getNodeHardenFlags()
441417
getNodePermissionFlags()
442418
getNodeNoWarningsFlags()
@@ -445,12 +421,10 @@ describe('node constants', () => {
445421
})
446422

447423
it('should verify all flag arrays are non-empty or conditionally empty', () => {
448-
const debugFlags = getNodeDebugFlags()
449424
const hardenFlags = getNodeHardenFlags()
450425
const noWarningsFlags = getNodeNoWarningsFlags()
451426
const sigusr1Flags = getNodeDisableSigusr1Flags()
452427

453-
expect(debugFlags.length).toBeGreaterThan(0)
454428
expect(hardenFlags.length).toBeGreaterThan(0)
455429
expect(noWarningsFlags.length).toBeGreaterThan(0)
456430
expect(sigusr1Flags.length).toBeGreaterThan(0)
@@ -505,7 +479,6 @@ describe('node constants', () => {
505479

506480
it('should verify flag contents are strings starting with --', () => {
507481
const allFlags = [
508-
...getNodeDebugFlags(),
509482
...getNodeHardenFlags(),
510483
...getNodePermissionFlags(),
511484
...getNodeNoWarningsFlags(),

test/process-lock.test.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ describe.sequential('process-lock', () => {
4949
// Second acquire should fail
5050
await expect(
5151
processLock.acquire(testLockPath, { retries: 1, baseDelayMs: 10 }),
52-
).rejects.toThrow(/Lock already exists/)
52+
).rejects.toThrow(/Lock already exists|Failed to acquire lock/)
5353

5454
release1()
5555
})
@@ -246,7 +246,7 @@ describe.sequential('process-lock', () => {
246246
baseDelayMs: 10,
247247
staleMs: 10_000,
248248
}),
249-
).rejects.toThrow(/Lock already exists/)
249+
).rejects.toThrow(/Lock already exists|Failed to acquire lock/)
250250

251251
release()
252252
})
@@ -308,13 +308,11 @@ describe.sequential('process-lock', () => {
308308
'path',
309309
)
310310

311-
// Should work even with nested path
312-
await expect(
313-
processLock.acquire(deepPath, { retries: 1 }),
314-
).rejects.toThrow()
315-
316-
// mkdir with recursive: false should fail for non-existent parent
317-
// This is expected behavior
311+
// Should work with nested path (recursive: true creates parent dirs)
312+
const release = await processLock.acquire(deepPath, { retries: 1 })
313+
expect(existsSync(deepPath)).toBe(true)
314+
release()
315+
expect(existsSync(deepPath)).toBe(false)
318316
})
319317
})
320318
})

0 commit comments

Comments
 (0)