Skip to content

fix(docker): tolerate malformed entrypoint port env#7560

Open
yyswhsccc wants to merge 1 commit into
Scottcjn:mainfrom
yyswhsccc:codex/docker-entrypoint-port-env-guard
Open

fix(docker): tolerate malformed entrypoint port env#7560
yyswhsccc wants to merge 1 commit into
Scottcjn:mainfrom
yyswhsccc:codex/docker-entrypoint-port-env-guard

Conversation

@yyswhsccc

Copy link
Copy Markdown
Contributor

Problem

docker-entrypoint.py parsed PORT directly in the container startup path. A malformed deployment env value raises ValueError before the Docker entrypoint can start the RustChain dashboard/health endpoint.

Impact

A single bad PORT value can crash the Docker container at startup, making the dashboard and /health endpoint unavailable until the environment is corrected.

Fix

Add a small local _safe_int_env helper and use it for the entrypoint port. Valid numeric values are preserved, while malformed values fall back to the existing 8099 default.

Tests

  • uv run --no-project --with pytest --with flask python -B -m pytest -q tests/test_docker_entrypoint_env.py -> 3 passed
  • python3 -m py_compile docker-entrypoint.py tests/test_docker_entrypoint_env.py -> passed
  • git diff --check -> passed

Boundaries

Related to the general bug bounty surface (#305). This PR does not change payout amounts, wallet crediting, admin secrets, or production wallet behavior.

wallet: RTC47bc28896a1a4bf240d1fd780f4559b242bcd945

@github-actions github-actions Bot added BCOS-L1 Beacon Certified Open Source tier BCOS-L1 (required for non-doc PRs) tests Test suite changes size/M PR: 51-200 lines labels Jun 23, 2026
@yyswhsccc

Copy link
Copy Markdown
Contributor Author

@Scottcjn Please take a look when you have a chance. This is a small Docker startup hardening fix: malformed PORT now falls back to the existing default instead of crashing the container entrypoint before /health can serve.

Validation:

  • uv run --no-project --with pytest --with flask python -B -m pytest -q tests/test_docker_entrypoint_env.py -> 3 passed
  • python3 -m py_compile docker-entrypoint.py tests/test_docker_entrypoint_env.py -> passed
  • git diff --check -> passed

@jaxint jaxint left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Code reviewed - implementation verified.

@jaxint jaxint left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Code reviewed - implementation verified. Good work on the changes.

@jaxint

jaxint commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

This PR looks good! Appreciate the contribution.

Reviewed for Bounty #71
Wallet: AhqbFaPBPLMMiaLDzA9WhQcyvv4hMxiteLhPk3NhG1iG

@jaxint jaxint left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Code reviewed - implementation verified. Per bounty #71.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BCOS-L1 Beacon Certified Open Source tier BCOS-L1 (required for non-doc PRs) size/M PR: 51-200 lines tests Test suite changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants