fix: security vulnerabilities and add CI/testing infrastructure#39
Merged
fix: security vulnerabilities and add CI/testing infrastructure#39
Conversation
Security fixes: - #18: Command injection risk in agent dispatch endpoint - Sanitize command to reject shell metacharacters - Validate workDir against allowed directories - Add maximum command length limit - #19: Localhost auth bypass via X-Forwarded-For spoofing - Add DASHBOARD_TRUST_PROXY config (default: false) - Only trust proxy headers when explicitly enabled - #20: CORS allows all origins in production - Add NODE_ENV/DASHBOARD_ENV detection - Restrict CORS to known origins in production - Add DASHBOARD_ALLOWED_ORIGINS config Quality improvements: - #22: Add CI pipeline (GitHub Actions) - Lint + typecheck + build workflow - #21: Add test suite - Add bun:test for server-side tests - Add typecheck script to client - Fix TypeScript errors in client code
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.
Summary
This PR addresses all open security and quality issues:
Security Fixes
Security: Command injection risk in agent dispatch endpoint #18: Command injection risk in agent dispatch endpoint
body.commandto reject shell metacharacters (;&|\$(){}[]<>!#*?"'`)workDiragainst allowed directories (aidevopsDir, workspaceDir, gitDir, etc.)Security: Localhost auth bypass via X-Forwarded-For spoofing #19: Localhost auth bypass via X-Forwarded-For spoofing
DASHBOARD_TRUST_PROXYconfig (default:false)X-Forwarded-For,X-Real-IP) when explicitly enabled127.0.0.1to bypass authSecurity: CORS allows all origins (no production restriction) #20: CORS allows all origins in production
NODE_ENV/DASHBOARD_ENVdetectionDASHBOARD_ALLOWED_ORIGINSconfig for whitelistingQuality Improvements
Add CI pipeline (lint, typecheck, build) #22: Add CI pipeline
.github/workflows/ci.yml)typecheckscript to clientAdd test suite — zero test coverage currently #21: Add test suite
bun:testfor server-side testssecurity.test.tswith validation testsTesting
bun run build)bun run typecheck)bun test)Breaking Changes
DASHBOARD_TRUST_PROXYnow defaults tofalse— ensure your setup works correctlyDASHBOARD_ALLOWED_ORIGINS