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

fix(config-api): scope validation issue #9426 #9428

Merged
merged 66 commits into from
Sep 9, 2024
Merged

fix(config-api): scope validation issue #9426 #9428

merged 66 commits into from
Sep 9, 2024

Conversation

pujavs
Copy link
Contributor

@pujavs pujavs commented Sep 9, 2024

Prepare


Description

Target issue

closes #9426

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.

pujavs added 30 commits August 5, 2024 13:15
Signed-off-by: pujavs <pujas.works@gmail.com>
Signed-off-by: pujavs <pujas.works@gmail.com>
Signed-off-by: pujavs <pujas.works@gmail.com>
Signed-off-by: pujavs <pujas.works@gmail.com>
Signed-off-by: pujavs <pujas.works@gmail.com>
Signed-off-by: pujavs <pujas.works@gmail.com>
Signed-off-by: pujavs <pujas.works@gmail.com>
Signed-off-by: pujavs <pujas.works@gmail.com>
Signed-off-by: pujavs <pujas.works@gmail.com>
Signed-off-by: pujavs <pujas.works@gmail.com>
Signed-off-by: pujavs <pujas.works@gmail.com>
Signed-off-by: pujavs <pujas.works@gmail.com>
Signed-off-by: pujavs <pujas.works@gmail.com>
Signed-off-by: pujavs <pujas.works@gmail.com>
Signed-off-by: pujavs <pujas.works@gmail.com>
Signed-off-by: pujavs <pujas.works@gmail.com>
Signed-off-by: pujavs <pujas.works@gmail.com>
Signed-off-by: pujavs <pujas.works@gmail.com>
pujavs added 17 commits August 30, 2024 14:54
Signed-off-by: pujavs <pujas.works@gmail.com>
Signed-off-by: pujavs <pujas.works@gmail.com>
Signed-off-by: pujavs <pujas.works@gmail.com>
Signed-off-by: pujavs <pujas.works@gmail.com>
Signed-off-by: pujavs <pujas.works@gmail.com>
Signed-off-by: pujavs <pujas.works@gmail.com>
Signed-off-by: pujavs <pujas.works@gmail.com>
Signed-off-by: pujavs <pujas.works@gmail.com>
…ssets forconfig-api #9403

Signed-off-by: pujavs <pujas.works@gmail.com>
Signed-off-by: pujavs <pujas.works@gmail.com>
@pujavs pujavs requested review from yuriyz and yurem as code owners September 9, 2024 17:30
@pujavs pujavs requested a review from devrimyatar September 9, 2024 17:30
Copy link

dryrunsecurity bot commented Sep 9, 2024

DryRun Security Summary

The pull request focuses on improving the security and access control mechanisms of the Jans Config API, with key changes in the OpenIdAuthorizationService class and the Swagger documentation to enhance token validation, scope validation, authentication-specific scopes, external authorization, and access control properties for the JansAttribute schema.

Expand for full summary

Summary:

The changes in this pull request focus on improving the security and access control mechanisms of the Jans Config API. The primary changes are in the OpenIdAuthorizationService class, which handles the authorization process for incoming requests, and the Swagger documentation, which updates the access control properties for the JansAttribute schema.

The key security-related aspects of the changes in the OpenIdAuthorizationService class include:

  1. Thorough Token Validation: The code properly validates incoming tokens, whether they are JWT or reference tokens, ensuring that only valid tokens are accepted.
  2. Comprehensive Scope Validation: The scope validation process checks for missing scopes at different levels (super, group, and normal scopes), ensuring that clients only have access to the resources they are authorized to access.
  3. Authentication-Specific Scopes: The ability to generate a new access token with the required authentication-specific scopes is a security feature that allows the application to enforce more granular access control.
  4. External Authorization: The external authorization mechanism provides a way to implement custom authorization logic outside of the standard scope validation process, which could be useful for implementing additional security checks or integrating with external authorization systems.

The changes to the Swagger documentation update the access control properties for the JansAttribute schema, which is likely to improve the API's access control and authorization mechanisms by enforcing more granular permissions for users and administrators.

Overall, these changes appear to be a positive improvement from an application security perspective, as they enhance the security and access control capabilities of the Jans Config API.

Files Changed:

  1. jans-config-api/server/src/main/java/io/jans/configapi/security/service/OpenIdAuthorizationService.java:
    • The code in this file handles the authorization process for incoming requests, focusing on the validation of OAuth2 tokens and their associated scopes.
    • The changes include thorough token validation, comprehensive scope validation, authentication-specific scopes, and an external authorization mechanism.
  2. jans-config-api/docs/jans-config-api-swagger.yaml:
    • The changes in this file update the access control properties for the JansAttribute schema, including userCanAccess, adminCanAccess, userCanEdit, adminCanEdit, userCanView, and adminCanView.
    • These changes are likely to improve the API's access control and authorization mechanisms by enforcing more granular permissions for users and administrators.

Code Analysis

We ran 9 analyzers against 2 files and 1 analyzer had findings. 8 analyzers had no findings.

Analyzer Findings
Authn/Authz Analyzer 1 finding

Riskiness

🟢 Risk threshold not exceeded.

View PR in the DryRun Dashboard.

@mo-auto mo-auto added comp-jans-config-api Component affected by issue or PR kind-bug Issue or PR is a bug in existing functionality labels Sep 9, 2024
Copy link

sonarqubecloud bot commented Sep 9, 2024

@yurem yurem enabled auto-merge (squash) September 9, 2024 17:42
@yurem yurem merged commit 0138e82 into main Sep 9, 2024
12 checks passed
@yurem yurem deleted the jans-config-fix branch September 9, 2024 18:03
yuriyz pushed a commit that referenced this pull request Nov 7, 2024
* fix(config-api): asset mgt endpoint fixes

Signed-off-by: pujavs <pujas.works@gmail.com>

* feat(config-api): asset upload mgt ehancement and fido

Signed-off-by: pujavs <pujas.works@gmail.com>

* feat(config-api): asset upload mgt ehancement and fido

Signed-off-by: pujavs <pujas.works@gmail.com>

* feat(config-api): asset upload mgt ehancement and fido

Signed-off-by: pujavs <pujas.works@gmail.com>

* fix(config-api): asset upload

Signed-off-by: pujavs <pujas.works@gmail.com>

* fix(config-api): lock review comments

Signed-off-by: pujavs <pujas.works@gmail.com>

* feat(config-api): lock code review comments

Signed-off-by: pujavs <pujas.works@gmail.com>

* feat(config-api): lock master renamed to lock server

Signed-off-by: pujavs <pujas.works@gmail.com>

* feat(config-api): lock master renamed to lock server

Signed-off-by: pujavs <pujas.works@gmail.com>

* feat(config-api): lock master renamed to lock server

Signed-off-by: pujavs <pujas.works@gmail.com>

* feat(config-api): lock master renamed to lock server

Signed-off-by: pujavs <pujas.works@gmail.com>

* feat(config-api): fido2 delete functionality

Signed-off-by: pujavs <pujas.works@gmail.com>

* fix(config-api): acr validation

Signed-off-by: pujavs <pujas.works@gmail.com>

* feat(config-api): doc(config-api): IDP schema attribute descriptions #9187

Signed-off-by: pujavs <pujas.works@gmail.com>

* feat(config-api): sync with main

Signed-off-by: pujavs <pujas.works@gmail.com>

* feat(config-api): uploading assets via API generates 2 entries #9178

Signed-off-by: pujavs <pujas.works@gmail.com>

* feat(config-api): asset mgt, fido and IDP changes

Signed-off-by: pujavs <pujas.works@gmail.com>

* feat(config-api): fido2 device endpoint

Signed-off-by: pujavs <pujas.works@gmail.com>

* feat(config-api): fido2 endpoint

Signed-off-by: pujavs <pujas.works@gmail.com>

* feat(config-api): fido2 endpoint

Signed-off-by: pujavs <pujas.works@gmail.com>

* feat(config-api): sync with main

Signed-off-by: pujavs <pujas.works@gmail.com>

* feat(config-api): sync with main

Signed-off-by: pujavs <pujas.works@gmail.com>

* feat(config-api): sync with main

Signed-off-by: pujavs <pujas.works@gmail.com>

* feat(config-api): resolved sonar review issues

Signed-off-by: pujavs <pujas.works@gmail.com>

* feat(config-api): sonar review comment fix

Signed-off-by: pujavs <pujas.works@gmail.com>

* feat(config-api): swagger spec

Signed-off-by: pujavs <pujas.works@gmail.com>

* feat(config-api): saml config attribute description

Signed-off-by: pujavs <pujas.works@gmail.com>

* doc(config-api): added SAML attribute description

Signed-off-by: pujavs <pujas.works@gmail.com>

* doc(config-api): added SAML attribute description

Signed-off-by: pujavs <pujas.works@gmail.com>

* feat(config-api): sync with main

Signed-off-by: pujavs <pujas.works@gmail.com>

* fix(jans-lock): code review comment fix isssue#9305

Signed-off-by: pujavs <pujas.works@gmail.com>

* fix(jans-lock): code review comment fix isssue#9305

Signed-off-by: pujavs <pujas.works@gmail.com>

* feat(config-api): lock review point

Signed-off-by: pujavs <pujas.works@gmail.com>

* fix(lock): code review comment

Signed-off-by: pujavs <pujas.works@gmail.com>

* fix(lock): code review comment

Signed-off-by: pujavs <pujas.works@gmail.com>

* fix(config-api): sync with main

Signed-off-by: pujavs <pujas.works@gmail.com>

* feat(config-api): lock endpoint fixes and SAML IDP NPE

Signed-off-by: pujavs <pujas.works@gmail.com>

* feat(config-api): asset enhancement

Signed-off-by: pujavs <pujas.works@gmail.com>

* feat(config-api): implement timer for asset mgt to fetch and deploy assets forconfig-api #9403

Signed-off-by: pujavs <pujas.works@gmail.com>

* fix(config-api): scope validation issue #9426

Signed-off-by: pujavs <pujas.works@gmail.com>

---------

Signed-off-by: pujavs <pujas.works@gmail.com>
Former-commit-id: 0138e82
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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): scope validation issue
4 participants