Skip to content

fix(config-api): adding missing scope in spec and udated example of search field #10156

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

Merged
merged 3 commits into from
Nov 15, 2024

Conversation

pujavs
Copy link
Contributor

@pujavs pujavs commented Nov 15, 2024

Prepare


Description

Target issue

closes #10147 #10148

Implementation Details


Test and Document the changes

  • Static code analysis has been run locally and issues have been fixed
  • Relevant unit and integration tests have been added/updated
  • Relevant documentation has been updated if any (i.e. user guides, installation and configuration guides, technical design docs etc)

Please check the below before submitting your PR. The PR will not be merged if there are no commits that start with docs: to indicate documentation changes or if the below checklist is not selected.

  • I confirm that there is no impact on the docs due to the code changes in this PR.

Signed-off-by: pujavs <pujas.works@gmail.com>
Signed-off-by: pujavs <pujas.works@gmail.com>
@pujavs pujavs requested a review from devrimyatar November 15, 2024 09:55
@pujavs pujavs requested review from yuriyz and yurem as code owners November 15, 2024 09:55
@mo-auto mo-auto added comp-docs Touching folder /docs comp-jans-config-api Component affected by issue or PR kind-bug Issue or PR is a bug in existing functionality labels Nov 15, 2024
Copy link

dryrunsecurity bot commented Nov 15, 2024

DryRun Security Summary

The pull request includes a wide range of security-focused updates to the Jans Config API, such as new OAuth2 scopes, enhanced session management, improved health check endpoint security, input validation, and access control measures, all aimed at strengthening the overall security posture of the application.

Expand for full summary

Summary:

The code changes in this pull request cover a wide range of updates to the Jans Config API, with a strong focus on enhancing the application's security features. The changes include the addition of new OAuth2 scopes, updates to session management functionality, improvements to health check endpoints, and various other security-related enhancements.

The key security-focused changes include:

  1. New OAuth2 Scopes: The introduction of the APP_DATA_READ_ACCESS scope, which grants read-only access to configuration data, and the APP_VERSION_READ_ACCESS scope, which restricts access to application version information. These scopes help enforce the principle of least privilege and improve the overall security of the application.

  2. Session Management: The updates to the SessionResource class provide robust session management capabilities, including session revocation, search, and deletion. These features help administrators maintain control over user sessions and mitigate the risks associated with compromised user accounts.

  3. Health Check Endpoint Security: The changes to the ApiHealthCheck class ensure that the service status and application version endpoints are properly secured behind the appropriate OAuth2 scopes, preventing unauthorized access to sensitive information.

  4. Input Validation and Sanitization: The code demonstrates a focus on input validation and sanitization, such as the use of the @Parameter annotation and the escapeLog() method, which help prevent potential injection attacks.

  5. Access Control and Authorization: The extensive use of the @ProtectedApi annotation and the definition of security scopes in the config-api-rs-protect.json file indicate a strong emphasis on access control and authorization, ensuring that only authorized users can perform sensitive operations.

Overall, the changes in this pull request appear to be focused on improving the security and manageability of the Jans Config API, which is a crucial component of the Jans ecosystem. The security-conscious approach demonstrated in the code changes is commendable and should help strengthen the overall security posture of the application.

Files Changed:

  1. ApiAccessConstants.java: Adds a new constant APP_DATA_READ_ACCESS to represent an OAuth2 scope that grants read-only access to the application's data.
  2. kc-saml-plugin-swagger.yaml: Updates the SAML Identity Provider configuration, including the display name and realm fields.
  3. jans-admin-ui-plugin-swagger.yaml: Adds new API endpoints for managing admin permissions, roles, role-permissions mappings, admin-ui configuration, licenses, and webhooks.
  4. config-api-test.properties: Updates the test environment configuration, including the addition of a new OAuth2 scope and client credentials.
  5. jans-ui.jans.io/test.properties: Adds the https://jans.io/oauth/config/data.readonly scope to the list of scopes.
  6. IdpResource.java: Updates the getAllSamlIdentityProvider endpoint to allow filtering SAML Identity Providers by their display name and realm.
  7. local/test.properties: Adds the https://jans.io/oauth/config/data.readonly scope and configures the client credentials grant flow for the Jans-Auth server.
  8. ApiApplication.java: Adds a new OAuth2 scope named APP_DATA_READ_ACCESS with the description "View Config-API related data".
  9. jenkins-config-api.gluu.org/test.properties: Adds the https://jans.io/oauth/config/data.readonly scope and removes the authentication-related properties.
  10. jans-config-api-swagger.yaml: Adds new endpoints for managing user sessions, including retrieving, searching, and revoking sessions.
  11. ApiHealthCheck.java: Updates the health check endpoints to require specific OAuth2 scopes for access.
  12. config-api-rs-protect.json: Adds the /jans-config-api/api/v1/health/service-status endpoint to the list of protected resources, requiring the https://jans.io/oauth/config/data.readonly scope.
  13. SessionResource.java: Implements various session management functionalities, including session search, retrieval, and revocation, with a focus on security and access control.

Code Analysis

We ran 9 analyzers against 13 files and 0 analyzers had findings. 9 analyzers had no findings.

Riskiness

🟢 Risk threshold not exceeded.

View PR in the DryRun Dashboard.

Copy link

@yuriyz yuriyz enabled auto-merge (squash) November 15, 2024 14:06
@yuriyz yuriyz merged commit e7c519e into main Nov 15, 2024
10 of 11 checks passed
@yuriyz yuriyz deleted the jans-config-dev branch November 15, 2024 14:06
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp-docs Touching folder /docs comp-jans-config-api Component affected by issue or PR kind-bug Issue or PR is a bug in existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fix(config-api): adding oauth for service-status endpoint
4 participants