Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).

## [Unreleased]

## [1.26.1] - 2026-06-24

### Changed

- **Dropped the Socket scan from `kit check` (#103) — it's cloud-only and can't be local-first or air-gapped.** `checkSocket` ran `socket check`, a command **removed in Socket CLI v1.x** (so it never actually scanned), and Socket's v1.x model (`socket scan create`) uploads your dependency manifest to socket.dev — server-side analysis that breaks kit's zero-network promise and has no offline/self-host path (verified: neither Socket nor Snyk offer an air-gappable analysis engine; their "self-hosted" = your _source_, not their scanner). Socket now surfaces as an informative `skip` ("cloud-only … excluded from kit's local-first check. Local cover: bumblebee + osv-scanner + kit supply-chain") rather than a broken/false-green warn. Removed the now-unused `classifySocketResult`. Run Socket via its own CLI / in CI if you have egress; a local behavioral-malware scanner (GuardDog) is tracked as the local-first replacement.

## [1.26.0] - 2026-06-24

### Changed
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sandstream-kit",
"version": "1.26.0",
"version": "1.26.1",
"description": "developer kit. zero LLM, local-first, multi-vault. one command from git clone to working dev environment.",
"license": "MIT",
"funding": "https://buymeacoffee.com/sandstream",
Expand Down
44 changes: 0 additions & 44 deletions src/check-security.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
parseTrivyMisconfigCount,
parseOsvVulnCount,
parseTrivyVulnCount,
classifySocketResult,
classifyTrufflehogFindings,
} from "./check-security.js";

Expand Down Expand Up @@ -34,49 +33,6 @@ describe("classifyTrufflehogFindings (verified vs unverified)", () => {
});
});

describe("classifySocketResult (fail-closed)", () => {
it("never passes when Socket is not logged in (the false-green guard)", () => {
for (const raw of [
"Please run `socket login` first",
"Error: unauthenticated",
"401 Unauthorized",
"Set SOCKET_API_TOKEN to continue",
]) {
const r = classifySocketResult(raw, false);
assert.strictEqual(r.status, "warn", `expected warn for: ${raw}`);
assert.match(r.detail, /UNVERIFIED|not logged in/);
assert.strictEqual(r.suggestion, "socket login");
}
});

it("passes ONLY on a valid scan result with zero issues", () => {
const r = classifySocketResult(JSON.stringify({ issues: [] }), true);
assert.strictEqual(r.status, "pass");
});

it("fails on critical/high issues, warns on lower issues", () => {
assert.strictEqual(
classifySocketResult(JSON.stringify({ issues: [{ severity: "critical" }] }), false).status,
"fail",
);
assert.strictEqual(
classifySocketResult(JSON.stringify({ issues: [{ severity: "low" }] }), true).status,
"warn",
);
});

it("does NOT pass on unparseable output, even with exit 0 (no proof of scan)", () => {
const r = classifySocketResult("some human-readable banner, not JSON", true);
assert.strictEqual(r.status, "warn");
assert.match(r.detail, /UNVERIFIED/);
});

it("warns (not pass) on non-zero exit with no parseable output", () => {
const r = classifySocketResult("", false);
assert.strictEqual(r.status, "warn");
});
});

describe("parseTrivyMisconfigCount", () => {
it("counts only HIGH/CRITICAL misconfigurations", () => {
const json = JSON.stringify({
Expand Down
114 changes: 17 additions & 97 deletions src/check-security.ts
Original file line number Diff line number Diff line change
Expand Up @@ -646,109 +646,29 @@ async function checkSecretsInCode(): Promise<SecurityCheckResult> {
}

/**
* Classify `socket check --json` output into a result (pure — fixture-tested).
* Socket is intentionally NOT part of kit's local-first security check (#103).
*
* FAIL CLOSED: a `pass` requires POSITIVE proof the scan ran (valid result JSON).
* The dangerous case is a Socket that's installed but NOT authenticated — it can
* appear to "run" yet check nothing, and a fail-open `pass` would give false
* assurance the supply chain is covered. So not-logged-in / unparseable output /
* non-zero exit all surface LOUDLY as "not scanning — UNVERIFIED", never as pass.
* (Same principle as #74 for `kit scan`.)
* Socket is a CLOUD service: its supply-chain analysis runs server-side (the v1.x
* CLI's `socket scan create` UPLOADS your dependency manifest to socket.dev), so it
* (a) breaks kit's local-first / zero-network promise, and (b) cannot run air-gapped
* at all — there is no offline/self-host of the analysis engine (Snyk is the same).
* The legacy `socket check` command kit used was also removed in Socket CLI v1.x.
*
* Local supply-chain coverage is provided by bumblebee, osv-scanner, and
* `kit supply-chain` (#49); a local behavioral/malware-heuristic scanner (GuardDog)
* is the candidate to fill Socket's niche the local-first way. Run Socket via its
* own CLI / in CI if you have egress and want its server-side analysis.
*/
export function classifySocketResult(raw: string, ok: boolean): SecurityCheckResult {
const base = { category: "supply-chain", name: "socket scan" } as const;
if (
/(socket login|log[\s-]?in|unauthenticat|not authenticated|api[\s_-]*token|forbidden|\b401\b|\b403\b)/i.test(
raw,
)
) {
return {
...base,
status: "warn",
detail: "socket NOT scanning — not logged in; supply chain UNVERIFIED",
severity: "medium",
suggestion: "socket login",
};
}

let parsed: { issues?: { severity?: string }[]; alerts?: { severity?: string }[] } | null = null;
try {
parsed = JSON.parse(raw);
} catch {
parsed = null;
}

if (parsed) {
const issues = parsed.issues ?? parsed.alerts ?? [];
const critical = issues.filter((i) => i.severity === "critical" || i.severity === "high");
if (critical.length > 0) {
return {
...base,
status: "fail",
detail: `${critical.length} critical/high supply chain issue(s) -run: socket check`,
severity: "critical",
};
}
if (issues.length > 0) {
return {
...base,
status: "warn",
detail: `${issues.length} supply chain warning(s) -run: socket check`,
severity: "medium",
};
}
// Valid scan result with zero issues — the ONLY path that earns a pass.
return { ...base, status: "pass", detail: "no supply chain issues detected" };
}

// No parseable result (and no recognized auth error): cannot confirm a scan
// happened — never pass on that assumption.
async function checkSocket(): Promise<SecurityCheckResult> {
return {
...base,
status: "warn",
detail: ok
? "socket check returned no parseable result — supply chain UNVERIFIED"
: "socket check failed -verify installation or run: socket login",
severity: "medium",
suggestion: "socket login",
category: "supply-chain",
name: "socket scan",
status: "skip",
detail:
"Socket is cloud-only (uploads manifest; no offline/air-gap) — excluded from kit's local-first check. Local cover: bumblebee + osv-scanner + kit supply-chain",
};
}

/**
* Check for supply chain attacks using Socket CLI.
* Detects behavioral anomalies (obfuscated files, unexpected network calls, install scripts)
* that npm audit misses -catches intentional malware like node-ipc and compromised packages.
*/
async function checkSocket(): Promise<SecurityCheckResult> {
try {
await access(resolve(process.cwd(), "package.json"));
} catch {
return {
category: "supply-chain",
name: "socket scan",
status: "skip",
detail: "no package.json found",
};
}

// Resolve mise-first: kit installs scanners via mise, whose shims aren't on
// kit's PATH. A bare "socket" lookup would miss a mise-installed one.
const socketBin = await resolveToolBin("socket");
if (!socketBin) {
return {
category: "supply-chain",
name: "socket scan",
status: "warn",
detail: "socket not installed -supply chain malware undetected",
severity: "medium",
suggestion: "mise use npm:@socketsecurity/cli (or: npm install -g @socketsecurity/cli)",
};
}

const result = await execFileNoThrow(socketBin, ["check", "--json"], { timeout: 60_000 });
return classifySocketResult(result.stdout || result.stderr, result.ok);
}

/**
* Scan Dockerfile and filesystem for CVEs using Trivy.
* Catches OS-level vulnerabilities that npm audit misses.
Expand Down
Loading