Skip to content

fix: redact dashboard health exception details#5457

Closed
minyanyi wants to merge 1 commit into
Scottcjn:mainfrom
minyanyi:codex/dashboard-health-redaction-5442
Closed

fix: redact dashboard health exception details#5457
minyanyi wants to merge 1 commit into
Scottcjn:mainfrom
minyanyi:codex/dashboard-health-redaction-5442

Conversation

@minyanyi
Copy link
Copy Markdown
Contributor

Fixes #5442.

Summary

  • Stop returning raw database, Solana RPC, and wRTC mint exception text from /bridge/dashboard/health.
  • Log full exception details server-side with logger.exception(...).
  • Add regression tests that inject private paths/RPC tokens and assert the response uses generic client-facing detail strings.

Verification

  • python -m pytest bridge/test_dashboard_api.py::TestBridgeHealth -q -> 7 passed
  • python -m pytest bridge/test_dashboard_api.py -q -> 25 passed
  • python -m py_compile bridge\dashboard_api.py bridge\test_dashboard_api.py
  • git diff --check

Wallet for accepted bounty payout: RTC0197a0573c0239ab6a4483108b27769317d3490b

Signed-off-by: minyanyi <109479933+minyanyi@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

Welcome to RustChain! Thanks for your first pull request.

Before we review, please make sure:

  • Non-doc PRs have a BCOS-L1 or BCOS-L2 label
  • Doc-only PRs are exempt from BCOS tier labels when they only touch docs/**, *.md, or common image/PDF files
  • New code files include an SPDX license header
  • You've tested your changes against the live node

Bounty tiers: Micro (1-10 RTC) | Standard (20-50) | Major (75-100) | Critical (100-150)

A maintainer will review your PR soon. Thanks for contributing!

@github-actions github-actions Bot added BCOS-L1 Beacon Certified Open Source tier BCOS-L1 (required for non-doc PRs) size/M PR: 51-200 lines labels May 16, 2026
Copy link
Copy Markdown
Contributor

@kekehanshujun kekehanshujun left a comment

Choose a reason for hiding this comment

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

Reviewed the dashboard health redaction changes.

The patch now keeps raw database/RPC/mint exception text out of the client-facing details payload while preserving server-side diagnostic context via logger.exception(...). The added tests cover sensitive filesystem paths, private RPC URLs, and mint lookup errors, and the existing health response shape remains intact.

Verification run locally on the PR version:

  • python -m pytest bridge\test_dashboard_api.py::TestBridgeHealth -q -o addopts='' -> 7 passed
  • python -m pytest bridge\test_dashboard_api.py -q -o addopts='' -> 25 passed
  • python -m py_compile bridge\dashboard_api.py bridge\test_dashboard_api.py -> passed

Copy link
Copy Markdown
Contributor

@jaxint jaxint left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for contributing. Approved.

@yui-stingray
Copy link
Copy Markdown

I took a look at the failing test check because the patch itself is small and already has targeted validation.

The CI failure does not appear to come from the dashboard health redaction changes. The failing step is the broad pytest tests/ ... collection phase, and it stops on missing dependencies from unrelated test modules:

  • tests/test_agent_economy_sdk.py -> ModuleNotFoundError: No module named 'aiohttp'
  • tests/test_faucet_service_wallet_validation.py -> ModuleNotFoundError: No module named 'flask_cors'
  • tests/test_hardware_visualizer.py -> ModuleNotFoundError: No module named 'matplotlib'
  • tests/test_pse_analyze_results.py -> ModuleNotFoundError: No module named 'matplotlib'

The earlier CI steps passed, including lint, the security scan, and the attestation fuzz gate. The targeted bridge dashboard tests reported in the PR body are the right scope for this change, so this looks like a repo-wide CI dependency/setup issue rather than a regression introduced by #5457.

Copy link
Copy Markdown
Contributor

@HCIE2054 HCIE2054 left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Copy Markdown
Contributor

@HCIE2054 HCIE2054 left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Copy Markdown

@ZacharyZhang-NY ZacharyZhang-NY left a comment

Choose a reason for hiding this comment

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

Reviewed PR #5457 at head 0894074.

Validation performed:

  • Checked issue #5442. The scoped bug is raw exception detail disclosure from /bridge/dashboard/health for database, Solana RPC, and configured wRTC mint checks.
  • git fetch origin pull/5457/head:review-pr-5457 --force
  • git diff --check origin/main...review-pr-5457 -- bridge/dashboard_api.py bridge/test_dashboard_api.py -> passed.
  • python -m py_compile bridge/dashboard_api.py bridge/test_dashboard_api.py on an extracted PR-head tree -> passed.
  • python -m pytest bridge/test_dashboard_api.py::TestBridgeHealth -q --confcutdir= -> 7 passed.
  • python -m pytest bridge/test_dashboard_api.py -q --confcutdir= -> 25 passed.

The health endpoint now reports degraded component status with stable client-facing detail strings for database, Solana RPC, and wRTC mint failures, while preserving full exception details in server-side logs through logger.exception(...). The regression coverage injects private paths/tokens/account text and confirms those values stay out of the HTTP response. Approving.

Copy link
Copy Markdown
Contributor

@HCIE2054 HCIE2054 left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Copy Markdown
Contributor

@HCIE2054 HCIE2054 left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Copy Markdown

@TJCurnutte TJCurnutte left a comment

Choose a reason for hiding this comment

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

Approved. I focused on the /bridge/dashboard/health failure paths that previously returned raw exception text.

Validation run against head 0894074db7c1071f8575fc58e8d66552bee9b9a2:

git diff --check origin/main...HEAD -- bridge/dashboard_api.py bridge/test_dashboard_api.py
PYTHONPATH=. python3 -B -m py_compile bridge/dashboard_api.py bridge/test_dashboard_api.py
PYTHONPATH=. uv run --no-project --with pytest --with flask --with requests python -B -m pytest -q bridge/test_dashboard_api.py --noconftest

Results: diff-check and py_compile passed; the focused dashboard API test file passed with 25 passed in 1.64s.

The patch keeps the health endpoint useful while avoiding disclosure: database exceptions now return Database unavailable, Solana RPC exceptions return RPC unavailable, and mint lookup exceptions return Mint check unavailable, while the detailed exception still goes to the server log via logger.exception(...). The added tests exercise each failure class with secret-looking values and assert those values are not present in the HTTP response body.

@BossChaos
Copy link
Copy Markdown
Contributor

Code Review — Bounty #73

PR: fix: redact dashboard health exception details by @minyanyi
Files changed: 2 (+105/-6)

  • ✅ Bug fix or input validation
  • ✅ Input validation present
  • ✅ Error handling present

Summary

This is a bug fix PR. Changes appear consistent with project patterns.

Wallet: 0xdaE5d307339074A24F579dB48e7c639359D94904

Reviewing under Bounty #73 — Code Review Bounty Program

Copy link
Copy Markdown
Contributor

@HCIE2054 HCIE2054 left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Copy Markdown
Contributor

@HCIE2054 HCIE2054 left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Copy Markdown
Contributor

@HCIE2054 HCIE2054 left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Copy Markdown
Contributor

@508704820 508704820 left a comment

Choose a reason for hiding this comment

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

Redact dashboard health exception details. Good - health checks can expose service topology. Verify redaction is consistent across all health endpoints. - Xeophon (security review)

Copy link
Copy Markdown
Contributor

@HCIE2054 HCIE2054 left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Copy Markdown
Contributor

@HCIE2054 HCIE2054 left a comment

Choose a reason for hiding this comment

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

LGTM!

@minyanyi
Copy link
Copy Markdown
Contributor Author

CI follow-up: I opened #5587 to fix the current blocking pytest tests/ collection failure caused by missing test dependencies (aiohttp, flask_cors, and matplotlib). This matches the red CI seen here and looks unrelated to the dashboard health redaction patch.

Focused validation for this PR remains the relevant signal for the changed files; the branch is still mergeable and already has review coverage.

@Scottcjn
Copy link
Copy Markdown
Owner

Closing as duplicate of #5443 by @hungle123-dev (first-posted 90 min earlier on the same issue).

Per first-poster rule, only the original submitter gets bounty credit on a given issue. The fix in #5443 addresses the same root cause and is already under review.

Appreciate the effort — for next time, please check open PRs against the same issue before filing. Thanks for the contribution.

@Scottcjn Scottcjn closed this May 18, 2026
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Dashboard health leaks internal component exception details

10 participants