fix(security): validate domain parameter in comet_tabs (#26) - #31
Conversation
Add validateDomain() to upload-validator.ts (alongside the existing validateTabId / validateUploadPath validators) and call it in both the switch and close branches of comet_tabs in src/index.ts and src/http-bridge.ts before the domain value reaches findTabByDomain(). Validation rules (RFC 1035 / hostname-safe charset): - 1–253 characters (DNS hostname maximum) - Only ASCII letters, digits, hyphens, and dots [A-Za-z0-9.\-] Error messages intentionally do NOT echo back the caller-supplied value to eliminate the stored-XSS vector identified in PR #14 security review. The "No tab found for domain" messages are similarly changed to static strings so that no attacker-controlled input is reflected in responses.
Security Review — PR #31Reviewed commit: `64cceb7` | Agent: General Security | Domain: Input Validation / XSS Prevention Scope3 files changed: `src/upload-validator.ts`, `src/index.ts`, `src/http-bridge.ts` FindingsSEC-1 (Informational): Prettier formatting was not applied to the original commits. The orchestrator applied `npx prettier --write` and committed a formatting-only follow-up commit (`64cceb7`). This is already resolved before review. All other checks: CLEAN Validation Evidence
VerdictAPPROVED — No security findings. The implementation correctly addresses all three issues from the PR #14 security review. |
|
APPROVED: commit 64cceb7 after context-aware security review (1 agent: General Security). 0 findings. Safe to merge. |
PR Review Summary: #31 — fix(security): validate domain parameter in comet_tabsReview IntegrityReviewed commit: `64cceb7` | Current HEAD: `64cceb7` | Status: CURRENT Verdict: APPROVED ✓Context-Aware ReviewDomains: SECURITY, AUTH_SENSITIVE | Agents: 1 (General Security) Integration Checks (Phase 2.5)Code registration: PASS — validateDomain exported from upload-validator.ts, imported in both index.ts and http-bridge.ts, build clean Risk Matrix
FindingsNone — review clean. Automated Checks
RecommendationMerged to main. No follow-up issues required. Context-aware review complete. 1 agent + integration checks. 0 findings. PR merged. |
Summary
Adds
validateDomain()to the shared validator module and calls it in bothsrc/index.tsandsrc/http-bridge.tsbefore thedomainparameter reachesfindTabByDomain()in the switch/close actions ofcomet_tabs.This addresses the three issues identified in the PR #14 security review:
"No tab found for domain: ${domain}"responseshandleTabs())Changes
src/upload-validator.ts: AddedvalidateDomain()export — max 253 chars (DNS hostname limit), hostname-safe charset[A-Za-z0-9.\-], static error messages that never echo back the inputsrc/index.ts: ImportvalidateDomain; validate beforefindTabByDomain()in switch and close branches; change "not found" errors to static stringssrc/http-bridge.ts: Same import and validation in both domain branches ofhandleTabs()Testing
comet_tabsswitch with valid domain → proceeds normally [type:manual]comet_tabsswitch with >253 char domain → static error, no echo [type:manual]comet_tabsswitch with<script>or control chars → static error, no echo [type:manual]comet_tabsclose with invalid domain → same static error [type:manual]Closes #26
Implementation branch:
fix/validate-domain-comet-tabs-26Base:
main