fix(security): harden command injection, path traversal & auth surfaces - #3018
Open
7feilee wants to merge 2 commits into
Open
fix(security): harden command injection, path traversal & auth surfaces#30187feilee wants to merge 2 commits into
7feilee wants to merge 2 commits into
Conversation
Audit of the backend attack surface and fixes for the web-reachable CRITICAL/HIGH issues. Adds back/shared/security.ts with centralized hardening helpers (shellEscape, assertSafeDependenceName, SUBSCRIPTION_PATTERNS, safeCompare, isSafeSshConfigValue). - Subscription fields (url/branch/whitelist/blacklist/extensions/proxy) are now shell-escaped before reaching spawn() and validated with strict Joi patterns at the API, closing OS command injection and the downstream shell eval/git-arg-injection paths. - Dependency names are validated before interpolation into pnpm/pip/apk/apt commands (incl. the embedded Python source). - SSH config generation rejects newline/metachar injection in host/proxy (prevents injected ProxyCommand execution). - ConfigService.getFile resolves the real path before containment check, fixing data/scripts/../db traversal that leaked the SQLite DB. - /configs/save containment check fixed (sibling-dir write bypass). - Script/env uploads use path.basename, preventing arbitrary file write (crontab.list/env.sh overwrite -> RCE) via multer originalname. - JWT secret is generated and persisted per-install instead of the public default 'whyour-secret'; production refuses to boot without one. - Token comparison is now constant-time (safeCompare). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
@7feilee is attempting to deploy a commit to the hunter wang's projects Team on Vercel. A member of the Team first needs to authorize it. |
whyour
force-pushed
the
develop
branch
6 times, most recently
from
July 1, 2026 16:10
953b68f to
f09ef37
Compare
whyour
force-pushed
the
develop
branch
5 times, most recently
from
July 9, 2026 17:43
509b0d0 to
da6dac8
Compare
whyour
force-pushed
the
develop
branch
8 times, most recently
from
July 24, 2026 14:34
152a9aa to
92e4f26
Compare
whyour
force-pushed
the
develop
branch
3 times, most recently
from
July 25, 2026 05:29
9b37f06 to
0bb41eb
Compare
whyour
force-pushed
the
develop
branch
2 times, most recently
from
August 29, 2026 11:10
de65d7f to
5f6049d
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.
What
Hardens the backend against the web-reachable injection / traversal / auth issues found in a defensive attack-surface audit. Adds
back/shared/security.tswith centralized helpers (shellEscape,assertSafeDependenceName,SUBSCRIPTION_PATTERNS,safeCompare,isSafeSshConfigValue).Fixes
url/branch/whitelist/blacklist/extensions/proxyreachingspawn(...,{shell})name(pnpm/pip/apk/apt + embedded Python)ProxyCommand/host injection (services/sshKey.ts)proxymust behost:portdata/scripts/../db/database.sqliteleaked the SQLite DBoriginalname(overwritecrontab.list/env.sh)path.basename, reject./../configs/savesibling-dir write bypasspath.sepcontainment checkwhyour-secret→ forgeable admin tokenssafeCompare(hash +timingSafeEqual)The API-boundary validation also neutralizes the web-reachable shell
eval/git-arg-injection paths downstream.Notes
host:portproxies). Security logic verified with standalone runtime tests.systemscope, SSRF in notify, error-message leakage, rate-limit, self-update integrity) tracked in Security hardening follow-ups (deferred from injection/traversal/auth audit) #3017.