security: remove wildcard CORS and sanitize error responses - #1
Merged
Conversation
- Remove Access-Control-Allow-Origin: * from web server responses (server binds to 127.0.0.1; wildcard CORS is unnecessary exposure) - Replace raw String(error) in API responses with generic 'Internal error' (prevents info leakage: stack traces, file paths, SQL details) - Log actual errors server-side for debugging while keeping client responses opaque Fixes socket.dev operational security findings: medium-risk CORS and error disclosure issues.
ZeR020
added a commit
that referenced
this pull request
Jun 30, 2026
…late dedup
Dead code removed (graph-confirmed zero callers):
- ensureShardTables, getShardByPath (shard-manager.ts)
- countVectors(containerTag) (vector-search.ts)
- getMessagesByRoleStmt prepared statement + field (ai-session-manager.ts)
- maxProfileItems config field + docs + test ref
- 6 duplicate FTS5 triggers in migrate-v1-to-v2.ts
- 6 dead i18n keys (en + zh)
- sessionIdleSweep speculative 10K-entry LRU guard (index.ts)
Stdlib replacements:
- Hand-rolled UserProfileValidator (107ln) → zod schema with matching error messages
- 3× dynamic `await import("zod")` → static top-level imports
Shrinks:
- fetchWithTimeout() + apiErrorResponse() hoisted to BaseAIProvider
- All 4 providers refactored to use shared HTTP boilerplate
- plugin.ts IIFE wrapper flattened
- Obsolete marked.setOptions headerIds/mangle removed (marked v8+)
- Broken lint-deepsource.sh rules #1 (awk) and #10 (complexity) fixed
22 files changed, net -92 lines (-434/+342)
All 730 tests + typecheck + build + format:check + lint-deepsource pass
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.
Security Fixes
Addresses socket.dev operational security findings:
Changes
Why
Verification