Skip to content

fix: reject API keys invalid in HTTP headers - #315

Open
NgoQuocViet2001 wants to merge 1 commit into
Anil-matcha:mainfrom
NgoQuocViet2001:fix-api-key-header-validation
Open

fix: reject API keys invalid in HTTP headers#315
NgoQuocViet2001 wants to merge 1 commit into
Anil-matcha:mainfrom
NgoQuocViet2001:fix-api-key-header-validation

Conversation

@NgoQuocViet2001

Copy link
Copy Markdown
Contributor

Summary

  • validate API keys against HTTP header encoding rules before saving them
  • show an inline error for pasted keys containing unsupported characters
  • cover trimming, empty input, zero-width characters, and emoji with unit tests

Why

A malformed pasted key currently reaches fetch or XMLHttpRequest and throws before any network request is sent. Validating at entry makes the error actionable and prevents the invalid value from being persisted.

Closes #301

Testing

  • Ran: node --test tests/apiKeyValidation.test.mjs
  • Ran: npm run build:packages
  • Ran: npm run build

@NgoQuocViet2001
NgoQuocViet2001 force-pushed the fix-api-key-header-validation branch from a0ad362 to af44910 Compare August 9, 2026 03:21
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.

Cannot generate videos - Fetch API fails with "String contains non ISO-8859-1 code point"

1 participant