Skip to content

Fix: validate account_id as StrKey G-address - #1202

Open
TheShnider wants to merge 1 commit into
ancore-org:mainfrom
TheShnider:fix/indexer-account-id-validation
Open

Fix: validate account_id as StrKey G-address#1202
TheShnider wants to merge 1 commit into
ancore-org:mainfrom
TheShnider:fix/indexer-account-id-validation

Conversation

@TheShnider

@TheShnider TheShnider commented Aug 1, 2026

Copy link
Copy Markdown

Description

Closes #1117

Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📝 Documentation update
  • 🔧 Configuration change
  • ♻️ Code refactoring
  • ⚡ Performance improvement
  • ✅ Test addition/improvement

Security Impact

  • This change involves cryptographic operations
  • This change affects account validation logic
  • This change modifies smart contracts
  • This change handles user private keys
  • This change affects authorization/authentication
  • No security impact

Testing

  • Unit tests added/updated
  • Integration tests added/updated
  • Manual testing performed
  • E2E tests added/updated (if applicable)

Test Coverage

  • Current coverage: __%
  • New/modified code coverage: __%

Manual Testing Steps

Breaking Changes

  • This PR introduces breaking changes

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings or errors
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published
  • Any flaky-test quarantine entry includes a linked follow-up issue, owner, expiry, and stable failure signature

For High-Security Changes

  • I have documented all security assumptions
  • I have considered attack vectors
  • I have added security-focused test cases
  • I have reviewed against the threat model

Related Issues

Closes #
Related to #

Additional Context

Reviewer Notes


Summary by CodeRabbit

  • Bug Fixes

    • Improved account ID validation to accept only valid Stellar Ed25519 public keys.
    • Invalid or malformed account identifiers are now rejected more reliably.
  • Tests

    • Updated account activity API tests to use valid Stellar public keys.

@drips-wave

drips-wave Bot commented Aug 1, 2026

Copy link
Copy Markdown

@TheShnider 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 Aug 1, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Changes

Account ID validation

Layer / File(s) Summary
Stellar account ID validation
services/indexer/Cargo.toml, services/indexer/src/api/account_activity.rs
The indexer adds stellar-strkey and validates account IDs by parsing Stellar StrKeys. Only Ed25519 public keys are accepted.
Account activity test inputs
services/indexer/tests/account_activity_api_test.rs
Integration tests use a valid Stellar public key for account activity listing, pagination, filtering, lookup, and validation cases.

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

Suggested reviewers: wheval

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR adds StrKey parsing, but tests only replace IDs and do not cover invalid inputs or confirm stable 400 behavior before database access. Add tests for malformed account_id values and verify the handler returns the stable 400 response before querying the database.
✅ 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: validating account_id as a Stellar StrKey G-address.
Out of Scope Changes check ✅ Passed All dependency, validation, and test changes directly support issue #1117.
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

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.

Warning

⚠️ This pull request shows signs of AI-generated slop (redundant_comments). It has been flagged by CodeRabbit slop detection and should be reviewed carefully.

@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 `@services/indexer/src/api/account_activity.rs`:
- Around line 64-69: Update the invalid-account test in the account activity API
tests to use a 56-character G-prefixed account value with an invalid checksum
instead of "invalid", ensuring it reaches the
stellar_strkey::Strkey::from_string validation path. Assert that the response
error field equals "invalid_filter", while preserving the existing
invalid-account request flow.
🪄 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: 3dbd7419-5276-4e76-a9cd-c917a0b3b004

📥 Commits

Reviewing files that changed from the base of the PR and between 4f8d69c and 4ac76c6.

📒 Files selected for processing (3)
  • services/indexer/Cargo.toml
  • services/indexer/src/api/account_activity.rs
  • services/indexer/tests/account_activity_api_test.rs

Comment thread services/indexer/src/api/account_activity.rs
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.

[INDEXER] Validate account_id path parameter as a Stellar G-address and return 400 on malformed input

1 participant