Fail fast when HTTPS is requested but certificates are missing#1638
Closed
Fail fast when HTTPS is requested but certificates are missing#1638
Conversation
- Move cert generation and validation from docker-entrypoint.sh to setup-ssl.sh - Accept CERT_DIR and HOST as environment variables - Use absolute paths with CERT_DIR instead of cd + relative paths - Use portable sed pattern matching instead of hardcoded line numbers - Preserve existing behavior including known bugs (duplicate rootCA.crt check) - Add 7 tests documenting current behavior including bug test case
- 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 - Update tests to expect thrown errors instead of silent fallback Closes #1634
| }; | ||
|
|
||
| try { | ||
| const res = await fetch(url.href, options); |
…forgery' Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Collaborator
Author
|
I'm planning to move the URL validation to its own branch. |
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
Stop silently falling back to HTTP when
PROXY_SERVER_HTTPS_CONNECTION=truebut certificate files are missing. Previously, the server would log a warning and serve over HTTP without any indication to the user that their HTTPS configuration was being ignored.ServerConfigErrorclass inserver-config.tsthat throws when HTTPS is enabled but cert files are missing, reporting the specific missing file pathsServerConfigErrorinnode-server.tswithlogger.fatalandprocess.exit(1)set -etodocker-entrypoint.shsosetup-ssl.shfailures stop the container|| trueto grep forset -ecompatibility when the env var is absentshcompatibility:==→=,[ $HOST ]→[ -n "$HOST" ], quote variablessetup-ssl.sh: addset -e, fix duplicaterootCA.crtcheck that missedserver.key, report each missing file individuallyValidation
pnpm checkspassespnpm testpasses (129 tests in proxy server package)Related Issues
Check List
pnpm checkspasses with no errors.pnpm testpasses with no failures.