Fail fast when HTTPS is requested but certificates are missing#1640
Open
Fail fast when HTTPS is requested but certificates are missing#1640
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1640 +/- ##
===========================================
+ Coverage 47.81% 72.58% +24.77%
===========================================
Files 382 408 +26
Lines 8525 12271 +3746
Branches 3159 3517 +358
===========================================
+ Hits 4076 8907 +4831
+ Misses 3070 2344 -726
+ Partials 1379 1020 -359
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
arseny-kostenko
approved these changes
Apr 6, 2026
2914b13 to
96e6ff7
Compare
- Add ServerConfigError and throw when cert files are missing - Catch ServerConfigError in node-server.ts with a clean fatal log - Fix docker-entrypoint.sh: add set -e, fix bracket syntax, fix duplicate check - Fix csr.conf trailing space so sed substitution matches - Add docker-entrypoint.sh integration tests - Add config-pipeline integration tests (shell → dotenv → Zod → server config) - Add ServerConfigError message content tests - Add grep-safe .env output tests for process-environment.sh - Add test for openssl failure propagation in setup-ssl - Read real cert/csr config files in setup-ssl tests Closes aws#1634
96e6ff7 to
4a7023d
Compare
arseny-kostenko
approved these changes
Apr 9, 2026
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.
Description
When
PROXY_SERVER_HTTPS_CONNECTIONistruebut the certificate files are missing, the server silently falls back to HTTP. This is a security concern — the user explicitly requested HTTPS but gets unencrypted traffic with no warning.This PR makes the server fail fast with a clear error message instead of silently downgrading.
Server config
ServerConfigErrorthat is thrown when HTTPS is enabled but cert files are missing, with a message listing exactly which files are absentServerConfigErrorinnode-server.tswith alogger.fatalandprocess.exit(1)Shell scripts
setup-ssl.sh: addset -e, use POSIX[ -n "$HOST" ], fix the duplicaterootCA.crtcheck bug (was missingserver.key), and report each missing file individually to stderrdocker-entrypoint.sh: addset -e, validate.envfile exists, anchor the grep pattern with^to ignore comments and similarly-named vars, and use POSIX=instead of==Tests
docker-entrypoint.test.ts— tests the entrypoint shell script in isolation with stubbed dependenciesconfig-pipeline.test.ts— end-to-end tests from shell script through Zod parsing to server configprocess-environment.test.tsverifying grep-safe.envoutputserver-config.test.tsto assert the new throwing behavior including error messages with specific missing file pathssetup-ssl.test.tsto read real config files instead of duplicating them, and test individual missing file reportingValidation
pnpm run checkspasses with no errorspnpm test— all 70 tests across the 5 affected test files passRelated Issues
Check List
pnpm checkspasses with no errors.pnpm testpasses with no failures.