Skip to content

Conversation

@samuelcostae
Copy link
Contributor

@samuelcostae samuelcostae commented Nov 2, 2023

Description

Allow admins to configure additional_properties to be sent on to OpenID providers.

Category

Enhancement

Why these changes are required?

In certain cases OpenID provider expects additional request parameter with a particular value.

What is the old behavior before changes and new behavior after changes?

Issues Resolved

#1066

Testing

Manuel testing so far

Check List

  • New functionality includes testing
  • New functionality has been documented
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@codecov
Copy link

codecov bot commented Nov 2, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (8f1334e) 67.06% compared to head (46e9d40) 67.06%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1637   +/-   ##
=======================================
  Coverage   67.06%   67.06%           
=======================================
  Files          94       94           
  Lines        2402     2402           
  Branches      318      318           
=======================================
  Hits         1611     1611           
  Misses        713      713           
  Partials       78       78           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@samuelcostae samuelcostae changed the title DRAFT #1066 add openid parameters #1066 add openid parameters Nov 7, 2023
@samuelcostae samuelcostae marked this pull request as ready for review November 7, 2023 15:24
Copy link
Member

@peternied peternied left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution Sam - could you add or update tests that confirm these parameters are included?

@samuelcostae
Copy link
Contributor Author

Thanks for the contribution Sam - could you add or update tests that confirm these parameters are included?

Hi! in your opinion, should I extract the query creator logic to a method and test that, or test the whole route? I would assume the whole route, but decide to ask cause I don't see other instances of the routes set up by the authclasses being tested directly.

Thanks

Copy link
Contributor

@stephen-crawford stephen-crawford left a comment

Choose a reason for hiding this comment

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

Hi Sam, thanks for putting this together. This is looking good, but I wanted to make sure you saw Craig's comment above (https://github.com/opensearch-project/security-dashboards-plugin/pull/1637/files#r1388235430). Basically, it looks like we cannot allow:

grant_type
         REQUIRED.  Value MUST be set to "authorization_code".

   code
         REQUIRED.  The authorization code received from the
         authorization server.

   redirect_uri
         REQUIRED, if the "redirect_uri" parameter was included in the
         authorization request as described in [Section 4.1.1](https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.1), and their
         values MUST be identical.

   client_id
         REQUIRED, if the client is not authenticating with the
         authorization server as described in [Section 3.2.1](https://datatracker.ietf.org/doc/html/rfc6749#section-3.2.1).

To be overwritten.

I got these fields from the RFC Craig linked. There may be others, but I saw these at first. Could you make sure we block overwriting these?

Thanks again

@samuelcostae
Copy link
Contributor Author

Hi Sam, thanks for putting this together. This is looking good, but I wanted to make sure you saw Craig's comment above (https://github.com/opensearch-project/security-dashboards-plugin/pull/1637/files#r1388235430). Basically, it looks like we cannot allow:

grant_type
         REQUIRED.  Value MUST be set to "authorization_code".

   code
         REQUIRED.  The authorization code received from the
         authorization server.

   redirect_uri
         REQUIRED, if the "redirect_uri" parameter was included in the
         authorization request as described in [Section 4.1.1](https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.1), and their
         values MUST be identical.

   client_id
         REQUIRED, if the client is not authenticating with the
         authorization server as described in [Section 3.2.1](https://datatracker.ietf.org/doc/html/rfc6749#section-3.2.1).

To be overwritten.

I got these fields from the RFC Craig linked. There may be others, but I saw these at first. Could you make sure we block overwriting these?

Thanks again

In that case, since the overwriting of values with "additional parameters" was more of an 'accidental' feature, would it make sense to just block it altogether? To keep the 'rules' more straight forward and with less exceptions?

I've pushed a commit with this change. Let me know if that is ok.

@fabianschwamborn
Copy link

fabianschwamborn commented Nov 13, 2023

Hello, i am interested in this topic too.

@samuelcostae Thank you for the patch!

I was just about to make something similar but then i saw your pull request. I need to inject "prompt=select_account" because the Microsoft Active Directory OIDC module has no other way to display the login mask, if another account is already authenticated in browser. ( https://learn.microsoft.com/en-us/entra/identity-platform/v2-protocols-oidc)

@samuelcostae samuelcostae force-pushed the 1066_add_openid_parameters branch from b6f271c to 2cdfc69 Compare November 14, 2023 15:40
@DarshitChanpura DarshitChanpura dismissed their stale review November 14, 2023 18:05

I'll re-review this once the linter changes are addressed

Copy link
Contributor

@stephen-crawford stephen-crawford left a comment

Choose a reason for hiding this comment

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

Overall looks good, one suggestion for fixing your lint issue and then a question about expanding testing scope. Thanks Sam :)

cwperks
cwperks previously approved these changes Nov 16, 2023
@cwperks cwperks added the backport 2.x backport to 2.x branch label Nov 16, 2023
@samuelcostae
Copy link
Contributor Author

@cwperks Can you review/approve again please?

Copy link
Member

@DarshitChanpura DarshitChanpura left a comment

Choose a reason for hiding this comment

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

Looks good!

@DarshitChanpura DarshitChanpura merged commit 5cf1748 into opensearch-project:main Nov 29, 2023
opensearch-trigger-bot bot pushed a commit that referenced this pull request Nov 29, 2023
Signed-off-by: Sam <[email protected]>
Co-authored-by: Darshit Chanpura <[email protected]>
(cherry picked from commit 5cf1748)
RyanL1997 pushed a commit that referenced this pull request Nov 29, 2023
Signed-off-by: Sam <[email protected]>
Co-authored-by: Darshit Chanpura <[email protected]>
(cherry picked from commit 5cf1748)

Co-authored-by: Sam <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport 2.x backport to 2.x branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants