Skip to content

feat(core): add test_accounts_captcha for staging CAPTCHA bypass#417

Merged
k9ert merged 10 commits intomainfrom
kn/test-accounts-captcha
Jan 22, 2026
Merged

feat(core): add test_accounts_captcha for staging CAPTCHA bypass#417
k9ert merged 10 commits intomainfrom
kn/test-accounts-captcha

Conversation

@k9ert
Copy link
Copy Markdown

@k9ert k9ert commented Jan 19, 2026

Summary

  • Adds test_accounts_captcha config option to allow specific phone numbers to bypass CAPTCHA validation
  • Enables automated agents to authenticate on staging without solving Geetest challenges

Related blink-mobile PR: blinkbitcoin/blink-mobile#3588

Why This Is Important

Currently, there's no difference between production and staging CAPTCHA requirements. Automated agents (e.g., for testing, monitoring, or CI) cannot authenticate via phone because they cannot solve Geetest CAPTCHA challenges. This blocks agent-based workflows on staging environments.

How It Works

  1. New config option test_accounts_captcha - an array of phone numbers that skip CAPTCHA validation
  2. When requestPhoneCodeWithCaptcha is called, it checks if the phone is in the list
  3. If matched, CAPTCHA validation is skipped entirely; otherwise normal Geetest validation proceeds
  4. All other checks (rate limits, SMS sending) still apply
Phone in test_accounts_captcha? 
  → YES: Skip CAPTCHA, proceed to rate limits & SMS
  → NO:  Validate CAPTCHA first, then rate limits & SMS

How To Use

Add phone numbers to your staging config (e.g., custom.yaml):

test_accounts_captcha:
  - phone: "+1234567890"
  - phone: "+1987654321"

Agents call /auth/phone/code with dummy CAPTCHA values:

{
  "phone": "+1234567890",
  "challengeCode": "bypass",
  "validationCode": "bypass",
  "secCode": "bypass",
  "channel": "sms"
}

Note: CAPTCHA params are still required by the API schema—just pass any string values.

Security Considerations

  • Production should keep this list empty — only populate in staging/dev
  • Does NOT bypass SMS verification — agents still need valid phone or should combine with test_accounts for full bypass
  • Rate limits still apply

Test plan

  • Build passes (pnpm build in core/api)
  • Verify phone in test_accounts_captcha can request code without valid CAPTCHA
  • Verify phone NOT in list still requires valid CAPTCHA

🤖 Generated with Claude Code

Allow specific phone numbers to skip CAPTCHA validation, enabling
automated agents to authenticate on staging without solving Geetest.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings January 19, 2026 16:00
@github-actions github-actions Bot added the core label Jan 19, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a new test_accounts_captcha configuration option to allow specific phone numbers to bypass CAPTCHA validation during authentication on staging environments. This enables automated agents to authenticate without solving Geetest challenges, while maintaining all other security checks like rate limiting and SMS verification.

Changes:

  • Adds test_accounts_captcha configuration schema and getter function to support phone number-based CAPTCHA bypass
  • Modifies requestPhoneCodeWithCaptcha to skip Geetest validation for phones in the bypass list
  • Sets default empty array in galoy.yaml to ensure production safety by default

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
core/api/src/config/schema.types.d.ts Adds type definition for test_accounts_captcha as array of phone objects
core/api/src/config/schema.ts Defines JSON schema for test_accounts_captcha configuration with validation rules
core/api/src/config/yaml.ts Implements getTestAccountsCaptcha getter to extract phone numbers from config
core/api/src/app/authentication/request-code.ts Adds conditional CAPTCHA bypass logic for phones in test_accounts_captcha list
core/api/galoy.yaml Sets empty default array ensuring no phones bypass CAPTCHA by default

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread core/api/src/app/authentication/request-code.ts
Comment thread core/api/src/app/authentication/request-code.ts
k9ert added a commit to blinkbitcoin/blink-mobile that referenced this pull request Jan 20, 2026
On Local/Staging, call API with dummy CAPTCHA values instead of
skipping the request entirely. Server-side test_accounts_captcha
handles bypass while SMS still gets sent.

Requires backend PR blinkbitcoin/blink#417

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@k9ert
Copy link
Copy Markdown
Author

k9ert commented Jan 20, 2026

Mobile companion PR: blinkbitcoin/blink-mobile#3588

- Add info logging when CAPTCHA validation is skipped
- Add tracing attributes for observability
- Add unit tests for test_accounts_captcha config

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@k9ert
Copy link
Copy Markdown
Author

k9ert commented Jan 20, 2026

Addressed Copilot review feedback:

  • Added logging when CAPTCHA validation is skipped (info log + tracing attributes)
  • Added unit tests for test_accounts_captcha config

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings January 20, 2026 16:25
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread core/api/test/unit/app/auth/test-accounts-captcha.spec.ts
k9ert added a commit to blinkbitcoin/blink-mobile that referenced this pull request Jan 20, 2026
On Local/Staging, call API with dummy CAPTCHA values instead of
skipping the request entirely. Server-side test_accounts_captcha
handles bypass while SMS still gets sent.

Requires backend PR blinkbitcoin/blink#417

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@k9ert
Copy link
Copy Markdown
Author

k9ert commented Jan 21, 2026

Copilot review comments addressed in commit 0aaec67:

  1. Logging/tracing - Added baseLogger.info and addAttributesToCurrentSpan when CAPTCHA validation is skipped
  2. Test coverage - Added unit tests in test/unit/app/auth/test-accounts-captcha.ts
  3. Behavioral tests - Tests verify config loading and phone matching behavior

Comment thread core/api/test/unit/app/auth/test-accounts-captcha.spec.ts
Comment thread core/api/test/unit/app/auth/test-accounts-captcha.spec.ts
github-actions Bot and others added 7 commits January 22, 2026 11:48
Co-authored-by: dolcalmi <2079600+dolcalmi@users.noreply.github.com>
…03fe109f9a290ba517d2dffd05ac92ab78bc303b2f57975601a5a
Co-authored-by: dolcalmi <2079600+dolcalmi@users.noreply.github.com>
…e1d76053c691df1d2cc76055441af708bbfa75ff862db94345327
Co-authored-by: dolcalmi <2079600+dolcalmi@users.noreply.github.com>
…85ca5b073646d51eca8c22097124b83715039ffc5021120bef0ac
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 11 out of 13 changed files in this pull request and generated no new comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@grimen grimen marked this pull request as ready for review January 22, 2026 11:59
Copy link
Copy Markdown

@grimen grimen left a comment

Choose a reason for hiding this comment

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

LGTM

@k9ert k9ert merged commit 72bf848 into main Jan 22, 2026
22 checks passed
dolcalmi added a commit that referenced this pull request Jan 24, 2026
dolcalmi added a commit that referenced this pull request Jan 24, 2026
@openoms openoms deleted the kn/test-accounts-captcha branch January 29, 2026 11:07
blink-claw-bot added a commit to blink-claw-bot/blink that referenced this pull request Feb 11, 2026
Allows specific phone numbers (configured in galoy.yaml) to bypass
Geetest CAPTCHA validation. Enables automated agents to authenticate
on staging without solving challenges.

Changes:
- Add test_accounts_captcha config option (schema + types + yaml parser)
- Skip CAPTCHA in requestPhoneCodeWithCaptcha when phone is in list
- Add logging and tracing when CAPTCHA is skipped
- Integration tests with mocked dependencies verify bypass logic
- Unit tests for config parsing

Recreates blinkbitcoin#417 (reverted in blinkbitcoin#424) with:
- No quickstart changes (auto-generated)
- No unrelated dependency bumps
- Proper integration tests with mocking
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants