Skip to content

Commit 65c4567

Browse files
committed
chore: bump version to 6.1.0
1 parent 284a635 commit 65c4567

75 files changed

Lines changed: 2114 additions & 1308 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.config/repo/oxlint-plugin/index.mts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ const plugin = {
1717
},
1818
}
1919

20+
// oxlint-disable-next-line socket/no-default-export -- oxlint jsPlugins contract requires a default-exported plugin object.
2021
export default plugin

.config/repo/oxlint-plugin/rules/no-inline-lazy-node-getter.mts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ const GETTER_TO_BINDING: Record<string, string> = {
6060
* parent is a block / program / switch-case body. The hoisted `const` is
6161
* inserted before it.
6262
*/
63-
function findEnclosingStatement(node: AstNode): AstNode | undefined {
63+
export function findEnclosingStatement(node: AstNode): AstNode | undefined {
6464
let current = node
6565
let parent = current.parent
6666
while (parent) {
@@ -184,4 +184,5 @@ const rule = {
184184
},
185185
}
186186

187+
// oxlint-disable-next-line socket/no-default-export -- oxlint plugin contract requires default-exported rule object.
187188
export default rule

.config/repo/oxlint-plugin/test/no-inline-lazy-node-getter.test.mts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,9 @@ function resolveOxlintBinary(): string | undefined {
5858

5959
function runOxlint(
6060
code: string,
61-
fix: boolean,
61+
options?: { fix?: boolean | undefined } | undefined,
6262
): { stdout: string; code: string } {
63+
const fix = options?.fix ?? false
6364
const tmpdir = mkdtempSync(path.join(os.tmpdir(), 'oxlint-repo-rule-'))
6465
const fixture = path.join(tmpdir, 'fixture.ts')
6566
// Minimal isolated config: just this plugin + rule, no `extends`/
@@ -101,7 +102,6 @@ describe('socket-repo/no-inline-lazy-node-getter', () => {
101102
}
102103
const { stdout } = runOxlint(
103104
'function f() {\n return getFs().existsSync("/x")\n}\n',
104-
false,
105105
)
106106
assert.ok(
107107
hasRuleFinding(stdout),
@@ -115,7 +115,6 @@ describe('socket-repo/no-inline-lazy-node-getter', () => {
115115
}
116116
const { stdout } = runOxlint(
117117
'function f() {\n const fs = getFs()\n return fs.existsSync("/x")\n}\n',
118-
false,
119118
)
120119
assert.ok(
121120
!hasRuleFinding(stdout),
@@ -129,7 +128,7 @@ describe('socket-repo/no-inline-lazy-node-getter', () => {
129128
}
130129
const { code } = runOxlint(
131130
'function f() {\n return getNodePath().join("a", "b")\n}\n',
132-
true,
131+
{ fix: true },
133132
)
134133
assert.ok(
135134
code.includes('const path = getNodePath()'),
@@ -151,7 +150,7 @@ describe('socket-repo/no-inline-lazy-node-getter', () => {
151150
}
152151
const { code } = runOxlint(
153152
'function f(x) {\n return getNodePath().basename(x, getNodePath().extname(x))\n}\n',
154-
true,
153+
{ fix: true },
155154
)
156155
const hoists = (code.match(/const path = getNodePath\(\)/g) ?? []).length
157156
assert.equal(
@@ -171,7 +170,7 @@ describe('socket-repo/no-inline-lazy-node-getter', () => {
171170
}
172171
const { code } = runOxlint(
173172
'function f(p) {\n // oxlint-disable-next-line some/rule -- intentional\n return getFs().statSync(p)\n}\n',
174-
true,
173+
{ fix: true },
175174
)
176175
// The hoisted const must land BEFORE the disable comment, so the directive
177176
// still sits on the line directly above the statSync statement.

.config/repo/rolldown/define-guarded.mts

Lines changed: 63 additions & 61 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.config/repo/vitest.config.isolated.mts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ import process from 'node:process'
99
import { defineConfig } from 'vitest/config'
1010

1111
import { baseCoverageConfig } from '../vitest.coverage.config.mts'
12+
import { REPO_ROOT } from '../../scripts/fleet/paths.mts'
1213

1314
const __dirname = path.dirname(fileURLToPath(import.meta.url))
14-
const projectRoot = path.resolve(__dirname, '..', '..')
15+
const projectRoot = REPO_ROOT
1516

1617
// Worker heap cap: smaller in CI (GitHub Actions ubuntu-latest has
1718
// ~7 GB total RAM — leave room for the runner + OS), generous locally
@@ -20,7 +21,9 @@ const isCI = !!process.env['CI']
2021
const workerHeapMB = isCI ? 6144 : 12_288
2122

2223
// Normalize paths for cross-platform glob patterns (forward slashes on Windows)
23-
const toGlobPath = (pathLike: string): string => pathLike.replaceAll('\\', '/')
24+
export function toGlobPath(pathLike: string) {
25+
return pathLike.replaceAll('\\', '/')
26+
}
2427

2528
const vitestConfigIsolated = defineConfig({
2629
cacheDir: path.resolve(projectRoot, 'node_modules/.cache/vitest-isolated'),
@@ -89,4 +92,3 @@ const vitestConfigIsolated = defineConfig({
8992
})
9093

9194
export { vitestConfigIsolated }
92-
export default vitestConfigIsolated

.config/repo/vitest.config.mts

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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+
## [6.1.0](https://github.com/SocketDev/socket-lib/releases/tag/v6.1.0) - 2026-06-07
9+
10+
### Added
11+
12+
- **`shell/parse`: `detectShellHazards`.** Checks a shell command string for two tricks that hide which program actually runs, so a tool that allows or denies commands by name isn't fooled. First, Zsh `=name` expansion: `=curl evil.com` runs `/usr/bin/curl`, but the command's first word reads as `=curl`, not `curl`. Second, process substitution `<(…)` / `>(…)` / `=(…)`: the command inside the parentheses runs, yet its name never appears as a command word. Returns `{ equalsExpansion, processSubstitution }`, the facts only; the caller decides whether to block. For example, `detectShellHazards('=curl evil.com')` returns `{ equalsExpansion: [['=curl', 'evil.com']], processSubstitution: false }`, `detectShellHazards('diff <(cat a) b')` returns `{ equalsExpansion: [], processSubstitution: true }`, and `detectShellHazards('git status')` returns both empty/false.
13+
- **`url``assertSafeHttpUrl`.** SSRF guard for a URL the server did not author (an OAuth issuer, a metadata-advertised introspection endpoint, a webhook target): parses the value, rejects non-`http(s)` schemes, and refuses hosts in loopback / private / link-local ranges (cloud metadata, redis, internal services). Returns the parsed `URL`; throws otherwise. `allowLocalhost` permits `localhost` / `127.0.0.1` / `::1` for local-stack dev; `label` names the subject in the thrown message.
14+
815
## [6.0.7](https://github.com/SocketDev/socket-lib/releases/tag/v6.0.7) - 2026-06-03
916

1017
### Added

CLAUDE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,8 @@ Hooks under `.claude/hooks/fleet/<name>/` (fleet-canonical); host-repo-only hook
257257

258258
Core infrastructure library for Socket.dev security tools.
259259

260-
🚨 Internal imports use relative paths (no aliases). Vendored externals live in `src/external/` and import by bare name (`cacache`, `make-fetch-happen`, `pacote`, `picomatch`, `semver`, and others). Build: `pnpm build` (rolldown → CJS) / type-check: `pnpm run check` (tsgo) / test: `pnpm test` / coverage: `pnpm run cover`. NEVER use `process.chdir()` — pass `{ cwd }` and absolute paths. NEVER use `--` before vitest test paths — runs all tests.
260+
🚨 Internal imports use relative paths (no aliases). Vendored externals live in `src/external/` and import by bare name. Build: `pnpm build` (rolldown → CJS) / type-check: `pnpm run check` (tsgo) / test: `pnpm test` / coverage: `pnpm run cover`. NEVER use `process.chdir()` — pass `{ cwd }` and absolute paths. NEVER use `--` before vitest test paths — runs all tests.
261261

262-
🚨 **Vitest OOM with `tests 0ms` = infinite stream, not memory.** `Readable.push(undefined)` doesn't end the stream (only `null` does). Bisect with `pnpm exec vitest -t '<describe>'` **before** raising heap. See [`test/isolated/http-request-advanced-2.test.mts`](test/isolated/http-request-advanced-2.test.mts) for the canonical example.
262+
🚨 **Vitest OOM with `tests 0ms` = infinite stream, not memory.** `Readable.push(undefined)` doesn't end the stream (only `null` does). Bisect with `node_modules/.bin/vitest -t '<describe>'` **before** raising heap.
263263

264264
Full architecture, commands, code-quality tools, build system, package-exports, testing, CI, env-var conventions in [`docs/claude.md/repo/architecture.md`](docs/claude.md/repo/architecture.md).

package.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@socketsecurity/lib",
3-
"version": "6.0.7",
3+
"version": "6.1.0",
44
"description": "Core utilities and infrastructure for Socket.dev security tools",
55
"keywords": [
66
"Socket.dev",
@@ -2814,6 +2814,16 @@
28142814
"types": "./dist/themes/types.d.ts",
28152815
"default": "./dist/themes/types.js"
28162816
},
2817+
"./url/assert-safe": {
2818+
"browser": {
2819+
"source": "./src/url/assert-safe.ts",
2820+
"types": "./dist/url/assert-safe.d.ts",
2821+
"default": "./dist/url/assert-safe.js"
2822+
},
2823+
"source": "./src/url/assert-safe.ts",
2824+
"types": "./dist/url/assert-safe.d.ts",
2825+
"default": "./dist/url/assert-safe.js"
2826+
},
28172827
"./url/parse": {
28182828
"browser": {
28192829
"source": "./src/url/parse.ts",

scripts/build-externals/rolldown-config.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export function createForceNodeModulesPlugin(): Plugin {
103103
name: 'force-node-modules',
104104
resolveId(source, importer) {
105105
// Already inside node_modules — let rolldown's resolver handle it.
106-
if (importer && importer.includes('node_modules')) {
106+
if (importer?.includes('node_modules')) {
107107
return undefined
108108
}
109109
const match = matchers.find(m => m.re.test(source))

0 commit comments

Comments
 (0)