Skip to content

test: add non-base32 and null-byte rejection vectors (partial #292) - #305

Merged
codeZe-us merged 1 commit into
Boxkit-Labs:mainfrom
DrSa7ag3:fix/reject-case-and-non-base32-strkeys
Jul 30, 2026
Merged

test: add non-base32 and null-byte rejection vectors (partial #292)#305
codeZe-us merged 1 commit into
Boxkit-Labs:mainfrom
DrSa7ag3:fix/reject-case-and-non-base32-strkeys

Conversation

@DrSa7ag3

@DrSa7ag3 DrSa7ag3 commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Partially addresses #292. Adds vectors confirming non-base32 characters
(digit substitution, punctuation) and an embedded null byte are safely
rejected during address detection — no panic, no truncation.

Scope note

The issue also requests rejecting lowercase and mixed-case StrKeys.
This conflicts with an existing vector already in this file
("lowercase G accepted with normalization warning", detect module),
which intentionally accepts lowercase and normalizes it with a
NON_CANONICAL_ADDRESS warning rather than an error. I did not change
that behavior here — requesting maintainer clarification on #292 before
touching it, since it's existing designed behavior, not a bug.

Testing

closes #292

Summary by CodeRabbit

  • Tests
    • Added validation coverage for destination strings containing invalid characters, punctuation, and embedded null bytes.
    • Confirmed invalid destinations return no parsed address and report an appropriate validation warning.
    • Standardized test vector formatting for improved readability.

@drips-wave

drips-wave Bot commented Jul 30, 2026

Copy link
Copy Markdown

@DrSa7ag3 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Updated address test vectors by compacting existing tag arrays and adding detect cases for invalid base32 characters and embedded null bytes.

Changes

Address validation vectors

Layer / File(s) Summary
Normalize and extend validation vectors
spec/vectors.json
Existing tags arrays are compacted, and new detect vectors assert null results and INVALID_STRKEY warnings for 0, !, and embedded null bytes.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR covers non-base32 and null-byte cases, but it does not implement the requested lowercase and mixed-case rejection from #292. Add lowercase and mixed-case mutators/tests, and ensure those inputs return decode errors as required by #292.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: adding rejection vectors for non-base32 and null-byte inputs.
Out of Scope Changes check ✅ Passed The changes stay within the vector-test scope and the minor tag formatting edits are incidental.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@spec/vectors.json`:
- Around line 317-319: Add a separate vector in the vectors fixture, preserving
the existing trailing-null case, with \u0000 inserted between valid address
characters rather than at the end. Keep the embedded-null vector’s description
and expected rejection behavior aligned with the stated requirement.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 0bbdb382-63f2-488f-b88f-dc3e513db1a1

📥 Commits

Reviewing files that changed from the base of the PR and between a02e750 and 658958d.

📒 Files selected for processing (1)
  • spec/vectors.json

Comment thread spec/vectors.json
Comment on lines +317 to +319
"description": "embedded null byte must be rejected without crashing or truncating",
"input": {
"address": "GAYCUYT553C5LHVE2XPW5GMEJT4BXGM7AHMJWLAPZP53KJO7EIQADRS\u0000"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Add a truly embedded-null test vector.

The current input places \u0000 at the end of the address, so it verifies trailing-null rejection/truncation but not an embedded null byte as stated in the PR objective. Keep this case and add another vector with the null byte inserted within the address.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@spec/vectors.json` around lines 317 - 319, Add a separate vector in the
vectors fixture, preserving the existing trailing-null case, with \u0000
inserted between valid address characters rather than at the end. Keep the
embedded-null vector’s description and expected rejection behavior aligned with
the stated requirement.

@codeZe-us
codeZe-us self-requested a review July 30, 2026 18:03
@codeZe-us
codeZe-us merged commit b051f55 into Boxkit-Labs:main Jul 30, 2026
3 of 7 checks passed
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.

Implement the case and non-base32 mutators.

2 participants