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

Allow access to health endpoint as per defined roles #2632

Merged
merged 66 commits into from
Apr 4, 2025

Conversation

sezal98
Copy link
Contributor

@sezal98 sezal98 commented Mar 24, 2025

Why make this change?

Closes #2531

What is this change?

This PR involves creating another parameter in the runtime config which defines the allowed roles for the health endpoint.

  • It created src/Config/Converters/RuntimeHealthOptionsConvertorFactory.cs which takes care of serialization and deserialization of runtime config custom way.
  • The incoming role and token are taken up to firct check if the role in the header is matching with the allowed roles in the runtime config.
  • Further this role and token are passed to execute the REST and GraphQL queries for DAB.

Scenarios

  1. Allowed Roles are not configured.
  • Mode is Development - we allow all requests
  • Mode is Production - we dont allow any requests. We show 403
  1. Allowed Roles are configured
  • Mode is Development or Production - we performt the role check in allowed roles.

How was this tested?

  • Integration Tests
  • Unit Tests

Sample Request(s)

Roles: ["authenticated"]
Mode: Development or Production
image
image

Roles: Not Configured
Mode: Development
image

Mode: Production
image

Roles: ["admin"]
Mode: Development or Production
image

Copy link
Contributor

@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.

Need more tests/assertion on the Rest Query/GraphQL query execution.

@Aniruddh25
Copy link
Contributor

nit: please provide a better title to the PR that explains what this PR is doing.

RubenCerna2079
RubenCerna2079 previously approved these changes Apr 4, 2025
Copy link
Contributor

@RubenCerna2079 RubenCerna2079 left a comment

Choose a reason for hiding this comment

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

LGTM

@Aniruddh25 Aniruddh25 changed the title Roles Health Check Allow access to health endpoint as per defined roles Apr 4, 2025
@Aniruddh25
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 6 pipeline(s).

@RubenCerna2079
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 6 pipeline(s).

Copy link
Contributor

@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.

Looks good. Thanks for addressing all the concerns specially about the role headers!

@RubenCerna2079
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 6 pipeline(s).

@RubenCerna2079 RubenCerna2079 merged commit ebbe989 into main Apr 4, 2025
11 checks passed
@RubenCerna2079 RubenCerna2079 deleted the dev/sezalchug/rolesHealthCheck branch April 4, 2025 22:09
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.

[HealthEndpoint] Roles Support
3 participants