Reject consecutive hyphen GitHub logins#851
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughGITHUB_LOGIN_RE is tightened to reject logins containing consecutive hyphens ( ChangesGitHub login validation tightening
Possibly related PRs
🚥 Pre-merge checks | ✅ 6✅ Passed checks (6 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
akmhatey-ai
left a comment
There was a problem hiding this comment.
Reviewed current head 3cd1796c481f5d09a3ef3d9e88022142a01ce7fa for Refs #643.
What I checked:
- inspected the shared GitHub login validation change in
app/accounts.py,app/config.py, andapp/ledger/service.py; - checked the affected account, activity, treasury recipient-filter, wallet registration, and deploy-readiness tests;
- compared against the live source report on #798 and the historical PR #480: #480 was closed unmerged because its old bounty path was closed/exhausted, while #851 reapplies the same focused fix on current
origin/mainand adds activity plus treasury filter coverage; - verified current production still accepts the impossible GitHub identity shape before this fix: account, activity, and treasury proposal filter endpoints all return HTTP 200 for
github:a--b, while GitHub's signup check returns 422 fora--b; - checked the three regex definitions are now identical, common valid logins such as
a-b,a1, and a 39-character login still match, anda--b, leading-hyphen, and trailing-hyphen logins no longer match; - checked wallet link/claim payload helpers reject
a--bwithinvalid github login; - confirmed the PR is open, non-draft,
mergeStateStatus=CLEAN,mergeable=MERGEABLE, with hosted quality checks and CodeRabbit successful, and no prior human review existed on #851 before this review.
Validation I ran locally:
PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 uv run --extra dev python -m pytest tests/test_treasury_proposals.py::test_treasury_proposals_list_rejects_invalid_recipient_filter tests/test_account_validation.py::test_account_views_reject_consecutive_hyphen_github_login tests/test_activity.py::test_activity_query_rejects_control_characters tests/test_wallets.py::test_wallet_registration_rejects_consecutive_hyphen_github_login tests/test_deploy_readiness.py::test_deploy_readiness_rejects_consecutive_hyphen_admin_or_labeler_logins -q->8 passed, 1 warningPYTEST_DISABLE_PLUGIN_AUTOLOAD=1 uv run --extra dev python -m pytest tests/test_account_validation.py tests/test_account_routes.py tests/test_activity.py tests/test_wallets.py tests/test_deploy_readiness.py tests/test_treasury_proposals.py -q->167 passed, 1 warninguv run --extra dev ruff check app/accounts.py app/config.py app/ledger/service.py tests/test_account_validation.py tests/test_activity.py tests/test_wallets.py tests/test_deploy_readiness.py tests/test_treasury_proposals.py-> passeduv run --extra dev ruff format --check app/accounts.py app/config.py app/ledger/service.py tests/test_account_validation.py tests/test_activity.py tests/test_wallets.py tests/test_deploy_readiness.py tests/test_treasury_proposals.py->8 files already formatteduv run --extra dev mypy app-> success for 42 source filesuv run --extra dev python scripts/docs_smoke.py-> docs smoke okgit merge-tree --write-tree origin/main HEAD-> clean treebb33dcd5ebaf9e4ca9682b1893968ed03e94e4f3git diff --check origin/main...HEAD-> cleangit diff origin/main...HEAD | gitleaks stdin --no-banner --redact-> no leaks found
I do not see a current-head blocker. No private data, credentials, wallet material, production mutation, payout/proof/ledger execution, exchange, bridge, cash-out, price behavior, or fabricated payout claims were used.
aglichandrap
left a comment
There was a problem hiding this comment.
Review evidence (head SHA: 3cd1796c481f):
- ✅ Regex change:
GITHUB_LOGIN_REupdated from^[a-z0-9](?:[a-z0-9-]{0,37}[a-z0-9])?$to^(?!.*--)[a-z0-9](?:[a-z0-9-]{0,37}[a-z0-9])?$— negative lookahead for--is correct. - ✅ Consistency: Same regex applied in all 3 locations:
app/accounts.py,app/config.py,app/ledger/service.py. - ✅ Tests: 25 new lines testing
github:a--brejection across API, accepted-work page, HTML page, and MCP endpoint. Good coverage. - ✅ Mergeable: state=clean, mergeable=True.
- ✅ Files touched: 8 files, +55/-3 — minimal, focused change.
No blockers found. Approve.
Summary
--) anywhere the shared login shape is validated;to_accountfiltering, wallet registration, and deploy readiness.Bounty #799
Source report: #798 (comment)
Evidence
The live public API currently accepts an uncreatable GitHub username shape as a normal GitHub ledger account:
GitHub's public username validation rejects the same shape because usernames may contain only alphanumeric characters or single hyphens and cannot begin/end with a hyphen. Treating
github:a--bas valid can mislead agents and contributors into routing account, activity, wallet-link, treasury-filter, or payout state through an impossible GitHub identity.Duplicate/current check: historical PR #480 implemented the same direction but was closed unmerged because its old bounty path was closed or exhausted. This PR reapplies the focused fix against current
origin/mainand uses the current #799 implementation lane plus the fresh #798 source report.Validation
uv run --extra dev pytest tests/test_treasury_proposals.py::test_treasury_proposals_list_rejects_invalid_recipient_filter tests/test_account_validation.py::test_account_views_reject_consecutive_hyphen_github_login tests/test_activity.py::test_activity_query_rejects_control_characters tests/test_wallets.py::test_wallet_registration_rejects_consecutive_hyphen_github_login tests/test_deploy_readiness.py::test_deploy_readiness_rejects_consecutive_hyphen_admin_or_labeler_logins -q-> 8 passed, 1 warninguv run --extra dev pytest tests/test_account_validation.py tests/test_account_routes.py tests/test_activity.py tests/test_wallets.py tests/test_deploy_readiness.py tests/test_treasury_proposals.py -q-> 167 passed, 1 warninguv run --extra dev ruff check app/accounts.py app/config.py app/ledger/service.py tests/test_account_validation.py tests/test_activity.py tests/test_wallets.py tests/test_deploy_readiness.py tests/test_treasury_proposals.py-> passeduv run --extra dev ruff format --check app/accounts.py app/config.py app/ledger/service.py tests/test_account_validation.py tests/test_activity.py tests/test_wallets.py tests/test_deploy_readiness.py tests/test_treasury_proposals.py-> 8 files already formatteduv run --extra dev mypy app-> successuv run --extra dev python scripts/docs_smoke.py-> docs smoke okgit diff --check origin/main...HEAD-> cleangit merge-tree --write-tree origin/main HEAD-> clean treef649db024045832619b997f6b472c2d560e3bcecScope and Safety
No auth session behavior, wallet signatures, balances, ledger mutation, bounty lifecycle, proposal execution, payout execution, private data, secrets, bridge, exchange, cash-out, or price behavior is changed.
Summary by CodeRabbit
Bug Fixes
Tests