Skip to content

fix(beldex-explorer): prevent unhandled 500 exceptions and enhance input validation in BNS lookup API - #34

Open
malakasaray-del wants to merge 1 commit into
Beldex-Coin:masterfrom
malakasaray-del:malakasaray-del-patch-1
Open

fix(beldex-explorer): prevent unhandled 500 exceptions and enhance input validation in BNS lookup API#34
malakasaray-del wants to merge 1 commit into
Beldex-Coin:masterfrom
malakasaray-del:malakasaray-del-patch-1

Conversation

@malakasaray-del

Copy link
Copy Markdown

Motivation

This PR fixes input validation and error-handling vulnerabilities in the beldex-explorer repository (explorer.py), identified during the Beldex workspace security audit[cite: 36]. Previously, omitting the required name query parameter on the /api/bnslookup endpoint resulted in an unhandled AttributeError leading to a 500 internal server error stack trace disclosure[cite: 36]. Additionally, unbounded string inputs lacked strict length controls before being processed[cite: 36].

Modifications

  • Robust Input Validation (explorer.py):
    • Added missing query parameter checks on /api/bnslookup to safely abort with an explicit HTTP 400 status instead of triggering unhandled server exceptions[cite: 36].
    • Enforced a strict length ceiling (maximum 256 characters) on the name query parameter to prevent unbounded payload processing[cite: 36].

Checklist

  • Format your code according to the Contributor Guide.
  • Add unit tests as outlined in the Contributor Guide.
  • Update documentation as needed, including docstrings or example tutorials.

…put validation in BNS lookup API

## Motivation

This PR fixes input validation and error-handling vulnerabilities in the `beldex-explorer` repository (`explorer.py`), identified during the Beldex workspace security audit[cite: 36]. Previously, omitting the required `name` query parameter on the `/api/bnslookup` endpoint resulted in an unhandled AttributeError leading to a 500 internal server error stack trace disclosure[cite: 36]. Additionally, unbounded string inputs lacked strict length controls before being processed[cite: 36].

## Modifications

* **Robust Input Validation (`explorer.py`)**:
  * Added missing query parameter checks on `/api/bnslookup` to safely abort with an explicit HTTP 400 status instead of triggering unhandled server exceptions[cite: 36].
  * Enforced a strict length ceiling (maximum 256 characters) on the `name` query parameter to prevent unbounded payload processing[cite: 36].

## Checklist

- [x] Format your code according to the Contributor Guide.
- [ ] Add unit tests as outlined in the Contributor Guide.
- [x] Update documentation as needed, including docstrings or example tutorials.
```[cite: 36]
@coderabbitai

coderabbitai Bot commented Aug 30, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 367c91b0-6ce9-4207-9eb6-e838632c0948


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant