Skip to content
This repository was archived by the owner on Sep 1, 2026. It is now read-only.

fix(server): bind UI to loopback by default and fail loudly on startup errors - #80

Merged
krotname merged 2 commits into
mainfrom
fix/server-mode-hardening
Aug 18, 2026
Merged

krotname merged 2 commits into
mainfrom
fix/server-mode-hardening

Conversation

@krotname

Copy link
Copy Markdown
Owner

Заменяет отклонённый PR #79 (он был сгенерирован против устаревшей версии файла, откатывал обработку ошибок и виртуальные потоки и ломал Docker жёсткой привязкой к loopback внутри контейнера).

Закрывает пять находок Aardvark по этому репозиторию:

  • Unauthenticated DaData proxy binds to all interfaces
  • Compose exposes unauthenticated DaData proxy
  • Docker image now starts unauthenticated DaData proxy
  • Docker healthcheck ignores configured server port
  • Server startup failures now exit with success
  • English README encourages packaging DaData token

Локально прогнаны MainTest, ContainerHealthCheckTest, CheckerUiServerIntegrationTest — 47 тестов, зелено.

🤖 Generated with Claude Code

…p errors

- CheckerUiServer takes an explicit bind address; the existing constructor now
  defaults to loopback, because /api/check is unauthenticated and every accepted
  request spends the operator's DaData quota.
- Main reads CHECKER_BIND_ADDRESS (default loopback) and CHECKER_PORT, prints the
  address it actually bound, and exits non-zero when the server fails to start
  instead of returning success.
- The container image opts into 0.0.0.0 explicitly (inside a container the
  boundary is the published port) and docker compose publishes 127.0.0.1:8080.
- ContainerHealthCheck derives its default endpoint from CHECKER_PORT instead of
  a hard-coded 8080, so a container on another port is not marked unhealthy.
- README/README.en: prefer DADATA_TOKEN over checker.properties, which Maven
  packages into the JAR and the image, and document the new variables.

Addresses Aardvark findings: unauthenticated DaData proxy binds to all
interfaces, compose/Docker expose it, README encourages packaging the token,
healthcheck ignores the configured port, startup failures exit with success.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c3341a5dbe

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +52 to +55
} catch (UnknownHostException e) {
System.out.printf("Cannot resolve %s: %s%n", BIND_ENV, e.getMessage());
printHelp();
return;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Exit nonzero for invalid server environment configuration

When CHECKER_BIND_ADDRESS is unresolvable, this branch prints an error and returns from main, so the JVM exits with status 0 even though the server never started; the newly added invalid and out-of-range CHECKER_PORT branches behave the same way. This defeats failure detection and on-failure restart policies precisely for configuration mistakes, so these startup-validation failures should follow the nonzero exit path used by runServer failures.

Useful? React with 👍 / 👎.

@codecov

codecov Bot commented Aug 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 54.76190% with 19 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/main/java/com/krotname/checker/Main.java 36.00% 14 Missing and 2 partials ⚠️
...ava/com/krotname/checker/ContainerHealthCheck.java 80.00% 0 Missing and 2 partials ⚠️
.../java/com/krotname/checker/ui/CheckerUiServer.java 85.71% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@krotname
krotname merged commit 42cf0ff into main Aug 18, 2026
10 of 11 checks passed
@krotname
krotname deleted the fix/server-mode-hardening branch August 18, 2026 13:52
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant