Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include a useful error message when a null byte is found in the URL path #1811

Merged
merged 2 commits into from
Feb 5, 2025

Conversation

xavdid-stripe
Copy link
Member

Why?

There are reports of cryptic 400 errors when PHP users include null bytes in API urls. We're not sure why this happens with PHP more often than other languages, but it seems to be the case.

Because we can't customize the error on the server side, we raise a more proactive error in the SDK to help users self-debug their issues.

What?

  • throw error if there's a null byte in $absUrl right before making a request
  • add tests

See Also

@xavdid-stripe xavdid-stripe enabled auto-merge (squash) February 5, 2025 01:25
@xavdid-stripe xavdid-stripe merged commit 067658d into master Feb 5, 2025
22 checks passed
@xavdid-stripe xavdid-stripe deleted the RUN_DEVSDK-1474 branch February 5, 2025 03:44
@xavdid-stripe xavdid-stripe changed the title Raise a more descriptive error if null bytes are found in the path Raise a more descriptive error if a byte is found in the URL path Feb 5, 2025
@xavdid-stripe xavdid-stripe changed the title Raise a more descriptive error if a byte is found in the URL path Include a useful error message when a null byte is found in the URL path Feb 5, 2025
xavdid-stripe added a commit that referenced this pull request Feb 7, 2025
* Update generated code (#1793)

* Update generated code for v1399

* Update generated code for v1409

* Update generated code for v1412

---------

Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>

* Bump version to 16.4.0

* Added pull request template (#1797)

* Add justfile, remove coveralls, and fix AUTOLOAD in CI (#1801)

* add justfile and tweak CI + readme

* debug test

* Debugging

* further debugging

* restore original composer json

* add more logging

* maybe fix ci

* Fix typo

* fix test naming and pass autoload directly to recipe as arugment

* Remove unused logline and fix typo

* restore composer

* remove extra log line

* update justfile

* add comments

* update ci

* revert to gh action

* ensure dependencies are installed for format and test recipes (#1802)

* Added CONTRIBUTING.md file (#1806)

* minor justfile fixes (#1807)

* made v2 event class concrete, and changed convertToStripeObject to use it if we cannot find the identified event subclass (#1805)

* Update generated code for v1461

* Update generated code (#1804)

* Update generated code for v1441

* Update generated code for v1452

* Update generated code for v1455

---------

Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
Co-authored-by: helenye-stripe <[email protected]>

* Bump version to 16.5.0

* Make `httpClient()` a public, static method (#1810)

* Make `httpClient()` a public, static method

* Make `streamingHttpClient()` a public, static method

* Update generated code for v1467

* Raise a more descriptive error if null bytes are found in the path (#1811)

* raise a more descriptive error if null bytes are found in the path

* formatting

* change error thrown for null byte issues (#1813)

* Update generated code for v1472

---------

Co-authored-by: stripe-openapi[bot] <105521251+stripe-openapi[bot]@users.noreply.github.com>
Co-authored-by: Jesse Rosalia <[email protected]>
Co-authored-by: David Brownman <[email protected]>
Co-authored-by: helenye-stripe <[email protected]>
Co-authored-by: Helen Ye <[email protected]>
Co-authored-by: Johan de Jager <[email protected]>
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.

2 participants