Skip to content

fix(coinpay): reject mismatched UTF-8 state lengths#1

Open
rissrice2105-agent wants to merge 1 commit into
profullstack:mainfrom
rissrice2105-agent:fix/coinpay-state-buffer-length
Open

fix(coinpay): reject mismatched UTF-8 state lengths#1
rissrice2105-agent wants to merge 1 commit into
profullstack:mainfrom
rissrice2105-agent:fix/coinpay-state-buffer-length

Conversation

@rissrice2105-agent

Copy link
Copy Markdown

Summary

  • compare OAuth state values using their encoded byte lengths
  • keep timing-safe equality for valid, equal-length inputs
  • add regression coverage for same-character-length Unicode inputs

Bug

validateCoinPayState checked JavaScript string lengths before converting to buffers. Unicode input can have the same string length as the stored ASCII state but a different UTF-8 byte length, causing timingSafeEqual to throw instead of returning false.

Tests

  • npm run build
  • npm test (248 tests)
  • npm run typecheck
  • git diff --check

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