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

[#IP-215] Add AzureAllowBodyPayloadMiddleware #167

Merged
merged 4 commits into from
Jun 1, 2021

Conversation

balanza
Copy link
Contributor

@balanza balanza commented May 31, 2021

Add a middleware that allow a specific payload to be provided only by a specific set of user groups.

It is designed for when it's needed to allow only a subset of users to provide a payload that matches a specific subset of the payload schema.

The use case is: we want restrict the opportunity to send a specific field into a Message content to a limited group of users.

@pagopa-github-bot
Copy link
Contributor

pagopa-github-bot commented May 31, 2021

Warnings
⚠️ Please include a Pivotal story at the beginning of the PR title (see below).

Example of PR titles that include pivotal stories:

  • single story: [#123456] my PR title
  • multiple stories: [#123456,#123457,#123458] my PR title

Generated by 🚫 dangerJS against f3b1ec3

Copy link
Contributor

@michaeldisaro michaeldisaro left a comment

Choose a reason for hiding this comment

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

Just a question: Should this middleware be always combined with the authorization middleware to check that the calling user is effectively into the desired group?

src/utils/middlewares/azure_api_auth.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@gquadrati gquadrati left a comment

Choose a reason for hiding this comment

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

LGTM except the test name and what @michaeldisaro pointed out

src/utils/middlewares/__tests__/azure_api_auth.test.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@michaeldisaro michaeldisaro left a comment

Choose a reason for hiding this comment

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

LGTM

@balanza
Copy link
Contributor Author

balanza commented Jun 1, 2021

Just a question: Should this middleware be always combined with the authorization middleware to check that the calling user is effectively into the desired group?

I actually copied that part :

NonEmptyString.decode(request.header("x-user-groups"))

In the end, it's nothing more than a plain text header

@balanza balanza merged commit eb5fdc4 into master Jun 1, 2021
@balanza balanza deleted the ip-215--restrict-payload branch June 1, 2021 13:38
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.

4 participants