Make the preflight work on the server stack, where it was both wrong and unsafe - #6
Merged
Merged
Conversation
…and unsafe The check was written against the laptop stack and gave four wrong answers on a real deployment - including a false PASS, which is the dangerous kind. - It probed http://localhost:3000, which the TLS overlay deliberately does not publish, got HTTP 000, and reported "a visitor can run any PromQL". Refused and unreachable are now both treated as safe; only a 2xx is a failure. - It read the collector's metrics from localhost:9109, which the server stack does not publish either. The empty result made `wc -l` report 1, so it announced "all 1 exported repos are public" having verified nothing. It now asks the collector from inside its own container. - It looked for containers literally named jq-prometheus and jq-collector. The server stack names them jq-monitoring-prometheus-1, so `docker inspect` failed, the grep for 0.0.0.0 found nothing, and it PASSED - it would have passed just as happily with the port wide open. Containers are now resolved by compose project label, and a missing container is a failure rather than a pass. - It read JQ_PUBLIC_ONLY from .env, which only the laptop sets; the server stack fixes it in the compose file. It now reads the running container's environment. Verified against the live laptop stack: 23 repos enumerated and checked against GitHub, anonymous access correctly failed, loopback-published ports correctly warned rather than silently passed. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
check-public-safe.shwas written against the laptop stack. Run against a real deployment it gave four wrong answers, including a false PASS.Actual output from the first production run:
Every line of that is wrong. The deployment was in fact correct — verified independently from outside:
/api/search401, datasource proxy 401,POST /api/ds/query401, ports 3000/9090/9109 all closed, valid Let's Encrypt certificate.The four defects
http://localhost:3000, which the TLS overlay deliberately doesn't publish. Got HTTP 000 and reported "a visitor can run any PromQL" — the opposite of the truth.localhost:9109, unpublished on a server. The empty result madewc -lreport 1, so it announced "all 1 exported repos are public" having checked nothing.jq-prometheus. The server stack names themjq-monitoring-prometheus-1, sodocker inspectfailed, the grep for0.0.0.0found nothing, and it passed — it would have passed identically with the port wide open.JQ_PUBLIC_ONLYfrom.env; only the laptop sets it there, the server stack fixes it in the compose file.The fix
FLEET_DOMAINis set, localhost otherwise.2xxis a failure.JQ_PUBLIC_ONLYis read from the running container's environment.Verified
Against the live laptop stack: 23 repos enumerated and each checked against GitHub, anonymous access correctly failed (that stack genuinely isn't safe to expose), loopback-published ports correctly warned rather than silently passed.
🤖 Generated with Claude Code