Security: Multiple vulnerabilities found via Snyk Code Analysis (XSS, Path Traversal, ReDoS, Open Redirect)
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 25/100
- Issue 类型
- 缺陷
- 描述清晰度
- 需要澄清
- 活跃度
- 冷清
- 技术栈
- node.js, typescript
调研方向
首先针对接近 v4.112.0 的 main branch 重新运行 Snyk Code Analysis,然后检查 src/node/routes/errors.ts、login.ts、vscode.ts、domainProxy.ts、index.ts 和 src/node/app.ts 中报告的位置。将 production 发现与测试文件中的低严重性发现分开,确认每个漏洞,并考虑建议的缓解措施。当已确认的 production 发现得到处理且扫描不再报告这些发现时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
Summary
Snyk Code Analysis identified 65 issues across 92 analyzed files in code-server. The High severity findings affect production deployments.
High Severity (7 issues)
Cross-site Scripting (XSS) — CWE-79, Score 807
src/node/routes/errors.tsline 56src/node/routes/login.tslines 68, 119
User-controlled input may be rendered without proper HTML escaping in error and login responses.
Path Traversal — CWE-23, Score 804
src/node/routes/vscode.tslines 149, 219
User-supplied path components may allow reading files outside the intended directory.
Regular Expression Denial of Service (ReDoS) — CWE-400, Score 752
src/node/routes/domainProxy.tsline 46
A regex pattern may cause catastrophic backtracking with crafted input.
Medium Severity (14 issues)
Open Redirect — CWE-601, Score 557
src/node/routes/login.tslines 62, 99src/node/routes/index.tsline 94
Allocation of Resources Without Limits — CWE-770, Score 555
src/node/routes/errors.tsline 37src/node/routes/vscode.tsline 213
Information Exposure via X-Powered-By — CWE-200, Score 554
src/node/app.tsline 70
Sensitive Cookie Without Secure/HttpOnly Flags — CWE-614/CWE-1004, Score 402
src/node/routes/login.tsline 96
Low Severity (44 issues)
Primarily in test files (hardcoded passwords, cleartext HTTP). Not production concerns.
Reproduction
Scanned with Snyk Code Analysis on code-server main branch (commit near v4.112.0).
Suggested Fixes
- XSS: HTML-encode user input before rendering in error/login templates
- Path Traversal: Resolve and validate paths against intended root directory
- ReDoS: Simplify or replace the vulnerable regex pattern
- Open Redirect: Validate redirect URLs against an allowlist
- X-Powered-By: Disable with
app.disable('x-powered-by') - Cookie flags: Add
SecureandHttpOnlyto session cookies
Happy to submit PRs for any of these if the team confirms the approach.
- 主要语言
- TypeScript
- 星标
- 79.4k
- 派生
- 6.9k
- 平均合并
- 2 天 13 小时
- 30 天内合并 PR
- 39
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
coder/code-server 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 92/100
coder/code-server#8017 · 2 条评论 ·
-
security
难度 2/5 1-3 小时 新手友好度 74/100
coder/code-server#8013 · 4 条评论 ·
-
enhancement
难度 5/5 一周以上 新手友好度 35/100
coder/code-server#7976 · 2 条评论 ·
-
enhancement
难度 5/5 一周以上 新手友好度 35/100
coder/code-server#7962 · 3 条评论 ·
-
bug needs-investigation
难度 4/5 3-5 天 新手友好度 55/100
coder/code-server#7955 · 1 条评论 ·
查看 coder/code-server 的全部 Issue
相似的 Issue
-
blocklist removal
难度 2/5 1-3 小时 新手友好度 65/100
MetaMask/eth-phishing-detect#296544 ·
-
难度 2/5 1-3 小时 新手友好度 70/100
pastelsky/bundlephobia#1122 ·
-
难度 2/5 1-3 小时 新手友好度 70/100
-
category/development priority/P2 scope/file-operations scope/testing type/enhancement
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 75/100