Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[HttpFoundation] Generate url-safe hashes for signed urls#59022

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 1 commit intosymfony:7.3fromvaltzu:generate-url-safe-signatures
Dec 18, 2024

Conversation

@valtzu
Copy link
Contributor

@valtzuvaltzu commentedNov 27, 2024
edited
Loading

QA
Branch?7.3
Bug fix?no
New feature?yes
Deprecations?no
IssuesFix#52822
LicenseMIT

Generate url-safe signed urls since some clients can't handle parameter encoding correctly and are sending%2B as+ which PHP reads as (space), making the signature invalid.

Backwards-compatibility is included, and planned to be removed in 8.0 – which will mean all signed urls generated with <7.3 are rendered invalid.

OskarStark and efka-9 reacted with thumbs up emoji
@carsonbotcarsonbot added this to the7.3 milestoneNov 27, 2024
@valtzuvaltzuforce-pushed thegenerate-url-safe-signatures branch 2 times, most recently fromec97e3a to93eb218CompareNovember 27, 2024 20:55
@valtzu
Copy link
ContributorAuthor

  1. fabbot failures are not a result of these changes – I can of course fix them here but not sure if I should
  2. Not sure how to fix those tests in other packages as it's only tests that depend on UriSigner from 7.3 🤔

@stof
Copy link
Member

stof commentedNov 28, 2024
edited
Loading

There is 2 errors in fabbot, which need to be treated differently:

  • the coding standard failure is related to your change and must be fixed
  • the exception message formatting should be ignored (this check has some false positives as we have special cases)

@stof
Copy link
Member

Fixing the deps=low tests is probably a matter of bumping the min requirement

],
"require": {
"php":">=8.2",
"ext-sodium":"*",
Copy link
Member

Choose a reason for hiding this comment

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

Making HttpFoundation require ext-sodium is a no-go (especially if only the UriSigner needs it as it is not the main feature of the component)

privatefunctioncomputeHash(string$uri):string
{
returnbase64_encode(hash_hmac('sha256',$uri,$this->secret,true));
returnsodium_bin2base64(hash_hmac('sha256',$uri,$this->secret,true),SODIUM_BASE64_VARIANT_URLSAFE_NO_PADDING);
Copy link
Member

Choose a reason for hiding this comment

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

Introducing a dependency on ext-sodium just to provide URL-safe base64 encoding is clearly not necessary. It is very easy to do it in userland (using the samestrtr you use for the comparison)

@valtzuvaltzuforce-pushed thegenerate-url-safe-signatures branch 3 times, most recently from5782c78 to4b6515eCompareDecember 1, 2024 16:38
@valtzuvaltzuforce-pushed thegenerate-url-safe-signatures branch from4b6515e to8258bc4CompareDecember 14, 2024 10:35
@valtzuvaltzuforce-pushed thegenerate-url-safe-signatures branch from8258bc4 toa533750CompareDecember 14, 2024 10:46
@fabpot
Copy link
Member

Thank you@valtzu.

@fabpotfabpot merged commitdd061aa intosymfony:7.3Dec 18, 2024
10 of 11 checks passed
xabbuh added a commit that referenced this pull requestDec 19, 2024
This PR was merged into the 6.4 branch.Discussion----------[HttpKernel] relax assertions on generated hashes| Q             | A| ------------- | ---| Branch?       | 6.4| Bug fix?      | no| New feature?  | no| Deprecations? | no| Issues        || License       | MITfixes the high deps tests after#59022Commits-------85a5d13 relax assertions on generated hashes
@fabpotfabpot mentioned this pull requestMay 2, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@stofstofstof left review comments

@fabpotfabpotfabpot approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

7.3

Development

Successfully merging this pull request may close these issues.

[HttpFoundation] Usebase64url in theUriSigner service

4 participants

@valtzu@stof@fabpot@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp