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

[Security] Support RSA algorithm signature for OIDC tokens#53682

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

Conversation

@louismariegaborit
Copy link
Contributor

QA
Branch?7.1
Bug fix?no
New feature?yes
Deprecations?no
Issues
LicenseMIT

Add support for RSA signature algorithm for OidcTokenHandler.
Amazon Cognito uses RS256 algorithm for its tokens.

Enz000 reacted with thumbs up emoji
@carsonbotcarsonbot added this to the7.1 milestoneJan 30, 2024
@louismariegaboritlouismariegaboritforce-pushed thesecurity_support_rsa branch 3 times, most recently frombc94265 to9c46285CompareJanuary 30, 2024 12:49
@nicolas-grekasnicolas-grekas changed the title[Security] Support RSA algorithm signature[Security] Support RSA algorithm signature for OIDC tokensJan 30, 2024
@louismariegaboritlouismariegaboritforce-pushed thesecurity_support_rsa branch 3 times, most recently from84e1317 to6b4e728CompareJanuary 30, 2024 13:10
@Spomky
Copy link
Contributor

Hi,

Is it possible to put this PR on hold?
The reason is that algorithms from theweb-token/ suite will be grouped and, very soon, withweb-token/jwt-library you will have all at once (including encryption to help#50441)

vincentchalamon reacted with eyes emoji

@Spomky
Copy link
Contributor

Spomky commentedFeb 1, 2024
edited
Loading

Hi@louismariegaborit,

Can you test with"web-token/jwt-library": "3.3.0@dev" adn"ext-openssl": "*"?
Both web-token/jwt-signature-algorithm-ecdsa andweb-token/jwt-signature-algorithm-rsa dependencies can be removed.

Also, because the newweb-token/jwt-library contains more thanESxxx andRSxxx algorithms, I am wondering if this PR could be renamed to[Security] Support any signature algorithms for OIDC tokens and allow developers picking the algorthims they need.

Note:web-token/jwt-library will be tagged in a couple of days.

@louismariegaborit
Copy link
ContributorAuthor

louismariegaborit commentedFeb 1, 2024
edited
Loading

Hi@Spomky

This seems ok. I removed alsoweb-token/jwt-checker.
For theext-openssl, I added it in the require-dev but it's in suggest like in your repository that you want that be added ?

I will look so that developers picked the algorithms they need.

I will update the PR title when we validate the work.

@louismariegaborit
Copy link
ContributorAuthor

@Spomky I did a try. WDYT ?
I don't know if I can delete old algorithm services without deprecations. And if I keep the services with deprecations, could you tell me how do it ?

@Spomky
Copy link
Contributor

Spomky commentedFeb 2, 2024
edited
Loading

This seems ok. I removed also web-token/jwt-checker.
For the ext-openssl, I added it in the require-dev but it's in suggest like in your repository that you want that be added ?

Indeed, most ofjwt-* packages are now underjwt-library.
OK forext-openssl in therequired-dev section. I'll make sure the algorithms complain if it's missing.


@vincentchalamon do you have any recommendation to have a better algorithm support architecture.
What could be interesting is to allow multiple algorithms

# config/packages/security.yamlsecurity:firewalls:main:access_token:token_handler:oidc:# Algorithms used to sign the JWSalgorithms:                            -'ES256'                            -'RS256'                            -'PS256'# A JSON-encoded JWKkey:'{"kty":"...","k":"..."}'

From my understanding, it will require:

  • If the configuraition keyalgorithm is present: to normaliwe the current configuration fro;["algorithm" => $alg] to["algorithms" => [$alg]]
  • Change theOidcTokenHandler first argument to accept an algorithm manager object instead a single algorithm
  • Use thealgorithm manager factory to create the algorithm manager according to the configuration

Any ideas on this?

@louismariegaborit
Copy link
ContributorAuthor

@vincentchalamon do you have any recommendation to have a better algorithm support architecture. What could be interesting is to allow multiple algorithms

# config/packages/security.yamlsecurity:firewalls:main:access_token:token_handler:oidc:# Algorithms used to sign the JWSalgorithms:                            -'ES256'                            -'RS256'                            -'PS256'# A JSON-encoded JWKkey:'{"kty":"...","k":"..."}'

From my understanding, it will require:

  • If the configuraition keyalgorithm is present: to normaliwe the current configuration fro;["algorithm" => $alg] to["algorithms" => [$alg]]
  • Change theOidcTokenHandler first argument to accept an algorithm manager object instead a single algorithm
  • Use thealgorithm manager factory to create the algorithm manager according to the configuration

Any ideas on this?

@Spomky I started this work in another PR (#51665).
I still need to support an array for the algorithms.
I think, we must decide what is the responsability of each PR.

@vincentchalamon
Copy link
Contributor

@Spomky on an OIDC server (e.g.: Keycloak), is it possible to allow multiple algorithms on a single realm?

If true, multiple algorithms configuration could be interesting, indeed. I'm just wondering if thekey configuration (JWK) shouldn't be associated to the corresponding algorithm, as I think they're linked (cf. JWA).

If false, I don't think we should allow multiple algorithms configuration as multiple realms are not supported.

Copy link
Member

@nicolas-grekasnicolas-grekas left a comment

Choose a reason for hiding this comment

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

LGTM with minor CS fixes

chalasr
chalasr previously approved these changesMar 24, 2024
@chalasrchalasr dismissed theirstale reviewMarch 24, 2024 19:21

Some tests are broken due to this change

Copy link
Member

@chalasrchalasr left a comment

Choose a reason for hiding this comment

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

Can you look at failing tests?

@SpomkySpomkyforce-pushed thesecurity_support_rsa branch 3 times, most recently from949281a tod930172CompareMarch 24, 2024 20:56
@Spomky
Copy link
Contributor

Hi@chalasr,

It seems to be fine now.
I corrected one of the tests without the@group legacy. Other errors are not related to this PR.

@nicolas-grekasnicolas-grekas added the ❄️ Feature FreezeImportant Pull Requests to finish before the next Symfony "feature freeze" labelApr 2, 2024
@chalasr
Copy link
Member

chalasr commentedApr 3, 2024
edited
Loading

Thank you@louismariegaborit and@Spomky.

louismariegaborit and Spomky reacted with hooray emoji

@chalasrchalasr merged commit09437dc intosymfony:7.1Apr 3, 2024
@louismariegaboritlouismariegaborit deleted the security_support_rsa branchApril 3, 2024 19:44
@fabpotfabpot mentioned this pull requestMay 2, 2024
@xabbuhxabbuh mentioned this pull requestMay 24, 2024
xabbuh added a commit that referenced this pull requestMay 24, 2024
This PR was merged into the 7.1 branch.Discussion----------remove empty PHP file| Q             | A| ------------- | ---| Branch?       | 7.1| Bug fix?      | no| New feature?  | no| Deprecations? | no| Issues        | related to#53682| License       | MITCommits-------2e894f8 remove empty PHP file
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

@SpomkySpomkySpomky left review comments

@stofstofstof requested changes

@chalasrchalasrchalasr approved these changes

+2 more reviewers

@GregoireHebertGregoireHebertGregoireHebert left review comments

@vincentchalamonvincentchalamonvincentchalamon approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

FeatureSecurity❄️ Feature FreezeImportant Pull Requests to finish before the next Symfony "feature freeze"Status: Reviewed

Projects

None yet

Milestone

7.1

Development

Successfully merging this pull request may close these issues.

8 participants

@louismariegaborit@Spomky@vincentchalamon@chalasr@nicolas-grekas@stof@GregoireHebert@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp