Skip to content

Conversation

@ayush3797
Copy link
Contributor

@ayush3797 ayush3797 commented Dec 6, 2022

Why make this change?

Currently the payload for SWA in X-MS-CLIENT-PRINCIPAL header does not contain any claims. We self-populate claims like userId and userDetails into the ClaimsPrincipal object ourselves and hence any claim other than these 2 referenced in the database policy should lead to a config validation error.
The changes made in this PR are to address the same.

What is this change?

An additional check is added to database policy validation where the validation would fail if any claim other than userId or userDetails is referenced when the authentication provider is StaticWebApps.

How was this tested?

  • Integration Tests - Passing of existing tests confirm the correctness of the change.
  • Unit Tests - Test TestInvalidClaimsForStaticWebApps is added in ConfigValidationUnitTests class to unit test the change.

@ayush3797 ayush3797 marked this pull request as ready for review December 6, 2022 08:55
@ayush3797 ayush3797 changed the title Failing validation for invalid claims in SWA Failing Config validation for invalid claims in SWA Dec 6, 2022
Copy link
Collaborator

@Aniruddh25 Aniruddh25 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the quick fix! Can even make it to Nov2022 now :)

Copy link
Contributor

@abhishekkumams abhishekkumams left a comment

Choose a reason for hiding this comment

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

LGTM

@ayush3797 ayush3797 merged commit 8a0d2e3 into main Dec 6, 2022
@ayush3797 ayush3797 deleted the dev/agarwalayush/invalidClaimsinSWA branch December 6, 2022 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Claims other than userId and userDetails should not be referenced in db policy for SWA

4 participants