Conversation
AmrDab
added a commit
that referenced
this pull request
Mar 19, 2026
Cherry-picked the best of both Codex audit PRs into a unified build: Security: - Log sanitization: API keys, Bearer tokens redacted from task logs (opt-out with CLAWD_DEBUG_RAW_LOGS=1) - Token fingerprinting: startup prints first 8 chars, not full token - Auth on sensitive GET endpoints: /favorites, /task-logs, /logs now require Bearer token (dashboard updated to include auth on all calls) Reliability: - Task execution lock: prevents TOCTOU race on concurrent /task requests - Clipboard fallback: catches a11y bridge failure, falls back to typeText - OCR temp file UUID suffix: prevents collision on concurrent OCR calls Infrastructure: - CDP port DRY: unified to 9223 everywhere (was 9222 in some, 9223 in others — real mismatch causing connection failures) - ESLint: Node.js + vitest globals, relaxed no-explicit-any - Test infra: tsconfig.tests.json, vitest covers tests/, withAuth helper new smoke tests for auth-protected endpoints - Install robustness: verify-install.js checks Node version + native deps with platform-specific fix guidance (addresses Dabbas install failure) 17 files modified, 2 new files. Build passes. 130/131 tests pass (1 pre-existing credential test failure unrelated to these changes). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Description
mountDashboardnow accepts agetTokencallback and sets anHttpOnlySameSite cookie; server parses the cookie andrequireAuthaccepts bearer header or dashboard cookie viaparseCookieTokenandDASHBOARD_AUTH_COOKIE.requireAuthand the dashboard is mounted with() => SERVER_TOKENso the UI receives a cookie onGET /.initServerTokenremains the initializer and token persists to~/.clawdcursor/tokenas before.taskExecutionLockedtoAgent, return busy if locked, settaskExecutionLocked = trueat start and clear it infinally, and setstateearlier when executing tasks.randomUUID()suffix to avoid collisions when multiple OCR calls create temp files concurrently.DEFAULT_CDP_PORTfrombrowser-configand updatedtools/cdp.tsandtools/orchestration.tsto use it (replacing hardcoded ports), and updated human-facing messages accordingly.INCLUDE_RAW_STEP_DETAILSenv gate (CLAWD_DEBUG_RAW_LOGS) andsanitizeLogText/sanitizeLogValuehelpers to redact API keys, bearer tokens, emails, and sensitive fields before writing logs.(this.a11y as any).writeClipboardis a function and falling back todesktop.typeTextif not available.quickTestModelnow callstestVisionModelfor vision roles andtestTextModelfor text roles.*.test.tsfiles.Testing
vitestwhich includedtests/smoke.test.tsandsrc/__tests__/ocr-engine.test.tsand verified updated expectations for cookie auth and macOS OCR availability behavior; tests passed./task,/confirm,/logs) withinitServerToken()and bothAuthorizationheader and dashboard cookie; tests passed.Codex Task