Repository navigation
test: make the proxy and unreadable-file tests independent of the environment - #309
Conversation
…ironment The transport tests cleared HTTPS_PROXY and HTTP_PROXY but not their lowercase forms, which the proxy resolver also reads, so a shell with https_proxy set failed four of them. The unreadable-file archive tests rely on chmod 000 denying access, which root ignores, so they now skip when run as root.
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
🔒 Security Scan Results
⏱️ SLA Breach Summary
ℹ️ Vulnerabilities Without Available Fixes (Informational Only)The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:
✅ BUILD PASSED - All security checks passed |
The unreadable-file and unreadable-directory tests relied on chmod 000, which root ignores, so the previous commit skipped them as root. Make readFileSync and readdirSync throw EACCES for the one path instead, so both tests run, and can fail, for every user. They assert the denied path was read and the UsageError the user gets.
🔒 Security Scan Results
⏱️ SLA Breach Summary
ℹ️ Vulnerabilities Without Available Fixes (Informational Only)The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:
✅ BUILD PASSED - All security checks passed |
…nd add ggshield hooks Bring v2-dev level with the dependency and hook fixes development already has, before Launch CLI V2 is promoted to staging. development is not merged wholesale: most of its 17 missing commits change V1 files that V2 deleted. - npm audit fix: 10 advisories to 0, all in dev-only packages. handlebars 4.7.10 (critical), source-map-js 1.2.4 (high), minimatch 11.0.9 with typescript-eslint 8.74 and eslint-config-oclif 6.0.179 (moderate). The only runtime lockfile change is @isaacs/nonrecursive-glob-match 1.0.3 -> 1.1.0, within @oclif/core's minimatch range. - @oclif/core range ^4.2.7 -> ^4.14.0 (development #286). The lockfile already resolved 4.14.0; it stays on 4.x to match csdx 2.0.2. - ggshield secret scan in the husky pre-commit and pre-push hooks (development e0aad60), without the GitGuardian marker comments. pre-push reads the pushed refs once and pipes them to both ggshield and the Talisman/trufflehog scan. - .talismanrc: checksums for both hooks (Talisman flags the setup-URL line), a refreshed package.json checksum, and the entry #309 left out for src/uploads/upload.archive.test.ts (its secret.txt fixture path trips Talisman on every push of a branch rebased onto v2-dev). #claude_code# 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
…nd add ggshield hooks (#310) Bring v2-dev level with the dependency and hook fixes development already has, before Launch CLI V2 is promoted to staging. development is not merged wholesale: most of its 17 missing commits change V1 files that V2 deleted. - npm audit fix: 10 advisories to 0, all in dev-only packages. handlebars 4.7.10 (critical), source-map-js 1.2.4 (high), minimatch 11.0.9 with typescript-eslint 8.74 and eslint-config-oclif 6.0.179 (moderate). The only runtime lockfile change is @isaacs/nonrecursive-glob-match 1.0.3 -> 1.1.0, within @oclif/core's minimatch range. - @oclif/core range ^4.2.7 -> ^4.14.0 (development #286). The lockfile already resolved 4.14.0; it stays on 4.x to match csdx 2.0.2. - ggshield secret scan in the husky pre-commit and pre-push hooks (development e0aad60), without the GitGuardian marker comments. pre-push reads the pushed refs once and pipes them to both ggshield and the Talisman/trufflehog scan. - .talismanrc: checksums for both hooks (Talisman flags the setup-URL line), a refreshed package.json checksum, and the entry #309 left out for src/uploads/upload.archive.test.ts (its secret.txt fixture path trips Talisman on every push of a branch rebased onto v2-dev). #claude_code# 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <noreply@anthropic.com>
Why
The pre-push hook runs the full suite. Every Claude cloud routine runs as root behind a proxy that sets a lowercase
https_proxy. Three routine sessions checked this onv2-devcc645ef, and all three saw the same 6 tests fail with no code change. Pushes from those environments could only get through with--no-verify, which skips the whole suite. This PR makes the 6 tests independent of the environment without weakening any assertion.What
Proxy tests (4):
src/transport/errors.test.ts,src/transport/rest-client.test.tsdiagnoseTransportError()("Could not reach the Launch API (…)"), and the same message fromRestApiClientafter retries.HTTPS_PROXYandHTTP_PROXY.environmentProxy()insrc/transport/proxy.tsalso readshttps_proxyandhttp_proxy, so with the lowercase form set, the code (correctly) took the proxy branch.explains %s as a proxy failure when a proxy is configuredtests.Unreadable-file tests (2):
src/uploads/upload.archive.test.tsarchiveDirectory()turns a read or listing failure intoUsageError(exit 2), naming the path and saying "cannot be read", throughreadable().chmod 000, which root ignores. They now makereadFileSync/readdirSyncthrowEACCESfor that one path only. So they run, and can fail, for every user, root or not, and nothing is skipped. They also assert the denied path was actually read.readable()to rethrow the raw error turns both tests red..talismanrc: refreshed checksums for the two transport test files (test code, no credentials).No production code changes.
Verification
https_proxyset:src/transport+upload.archive.test.ts→ 335/335 passed, none skipped. Before: 6 failed.upload.archive.test.ts18/18, andsrc/transport+ archive 335/335.--no-verify.Jira: https://contentstack.atlassian.net/browse/CL-8970 (found while pushing its gap 3)