fix: block path traversal in /cgi-bin/temp/get (#1304)#1318
Open
echopi wants to merge 3 commits intoavwo:masterfrom
Open
fix: block path traversal in /cgi-bin/temp/get (#1304)#1318echopi wants to merge 3 commits intoavwo:masterfrom
echopi wants to merge 3 commits intoavwo:masterfrom
Conversation
Node.js v17+ (OpenSSL 3.0) rejects EE certificates with keys smaller than 2048-bit. The test certs were 1024-bit, causing ERR_SSL_EE_KEY_TOO_SMALL. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Port 8081 is commonly used by other services (e.g. AliLang), causing EADDRINUSE when running tests. Use a high port to reduce conflicts. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Reject non-temp filenames when no auth is configured, preventing arbitrary file reads (e.g. /etc/passwd). Add test cases covering path traversal, empty filename, and valid temp file scenarios. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
b402cd7 to
7d085d4
Compare
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
/cgi-bin/temp/get可通过filename=/etc/passwd等路径读取任意文件username/password时,仅允许访问合法 temp 文件(64位 hex),其余返回{ forbidden: true }test/units/temp-get.test.js测试用例,覆盖路径穿越、空文件名、合法 temp 文件场景Changes
lib/service/service.js: 在isTempFile检查后增加else if分支,无认证时拒绝非 temp 文件test/units/temp-get.test.js: 4 个测试用例Test plan
/etc/passwd→ 返回{ forbidden: true }../../etc/passwd→ 返回{ forbidden: true }{ forbidden: true }🤖 Generated with Claude Code