mirror of
https://github.com/garrytan/gstack.git
synced 2026-09-18 10:52:24 +02:00
fix(security): delete dead exports the ripped chat path left behind
Three-way split by importer class: (a) Zero importers, deleted: the whole attack-attempt logging cluster in security.ts (logAttempt, AttemptRecord, salted hashPayload + device-salt, attempts.jsonl rotation, telemetry spawn plumbing incl. buildTelemetrySpawnCommand/resolveBashBinary — the LIVE attempts.jsonl writer is tunnel-denial-log.ts with its own rotation); the decision-file handshake (writeDecision/readDecision/clearDecision/excerptForReview — written for sidebar-agent's poll loop, which no longer exists); sidebar-utils.ts (whole module — its sanitizeExtensionUrl 'sanitized before embedding in a prompt' for the deleted prompt builder); 8 dead server.ts imports (sanitizeExtensionUrl, generateCanary, injectCanary, writeDecision, rotateRoot, serializeRegistry, restoreRegistry, clearAgentRecord); buildPtyClearCookie + buildSseClearCookie; WEBDRIVER_MASK_SCRIPT (orphaned by the D7 stealth narrowing — applyStealth never used it). (b) Dead-pin tests edited with their exports: the 'still exported' pin in stealth-layer-c, the string-content describe in stealth-webdriver (its live applyStealth behavioral coverage untouched), the clear-cookie assertions, security-review-flow.test.ts deleted whole (all 4 describes exercised the dead decision mechanism, incl. a 'simulated sidebar-agent poll loop'). (c) KEPT deliberately: leaseCount (live behavioral coverage), extractPtyCookie + validatePtySessionToken (extractPtyCookie is adopted by the terminal-agent cookie-parse unification later in this wave), resetSessionMarker + clearContentFilters (test-support API for the live content-security layer). Also fixes two pre-existing red pins found while here, invisible until the free suite got a CI job: the v1.44 spawnClaude->maybeSpawnPty rename in terminal-agent.test.ts, and a cross-file test-isolation bug where content-security.test.ts's clearContentFilters() wiped the auto-registered url-blocklist filter for every later file in the same bun process (security-integration.test.ts failed on co-run; afterAll now restores it). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
44d58aa6ee
commit
ef186cccb3
@@ -124,6 +124,16 @@ describe('Content filter hooks', () => {
|
||||
clearContentFilters();
|
||||
});
|
||||
|
||||
// clearContentFilters() wipes MODULE state shared across every test file in
|
||||
// the same bun process — without restoring the built-in registration,
|
||||
// security-integration.test.ts (which asserts the auto-registered blocklist
|
||||
// pipeline) fails whenever the two files co-run. Pre-existing co-run bug,
|
||||
// invisible until the free suite got a CI job.
|
||||
afterAll(() => {
|
||||
clearContentFilters();
|
||||
registerContentFilter(urlBlocklistFilter);
|
||||
});
|
||||
|
||||
test('URL blocklist detects requestbin', () => {
|
||||
const result = urlBlocklistFilter('', 'https://requestbin.com/r/abc', 'text');
|
||||
expect(result.safe).toBe(false);
|
||||
|
||||
Reference in New Issue
Block a user