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

Add XACML DAO JDBC implementation #5792

Conversation

Yoshani
Copy link
Contributor

@Yoshani Yoshani commented Jul 12, 2024

Proposed changes in this pull request

Introduces the JDBC implementation for XACML.

When should this PR be merged

Upon review

Related PRs

Related issues

Checklist (for reviewing)

General

  • Is this PR explained thoroughly? All code changes must be accounted for in the PR description.
  • Is the PR labeled correctly?

Functionality

  • Are all requirements met? Compare implemented functionality with the requirements specification.
  • Does the UI work as expected? There should be no Javascript errors in the console; all resources should load. There should be no unexpected errors. Deliberately try to break the feature to find out if there are corner cases that are not handled.

Code

  • Do you fully understand the introduced changes to the code? If not ask for clarification, it might uncover ways to solve a problem in a more elegant and efficient way.
  • Does the PR introduce any inefficient database requests? Use the debug server to check for duplicate requests.
  • Are all necessary strings marked for translation? All strings that are exposed to users via the UI must be marked for translation.

Tests

  • Are there sufficient test cases? Ensure that all components are tested individually; models, forms, and serializers should be tested in isolation even if a test for a view covers these components.
  • If this is a bug fix, are tests for the issue in place? There must be a test case for the bug to ensure the issue won’t regress. Make sure that the tests break without the new code to fix the issue.
  • If this is a new feature or a significant change to an existing feature? has the manual testing spreadsheet been updated with instructions for manual testing?

Security

  • Confirm this PR doesn't commit any keys, passwords, tokens, usernames, or other secrets.
  • Are all UI and API inputs run through forms or serializers?
  • Are all external inputs validated and sanitized appropriately?
  • Does all branching logic have a default case?
  • Does this solution handle outliers and edge cases gracefully?
  • Are all external communications secured and restricted to SSL?

Documentation

  • Are changes to the UI documented in the platform docs? If this PR introduces new platform site functionality or changes existing ones, the changes should be documented.
  • Are changes to the API documented in the API docs? If this PR introduces new API functionality or changes existing ones, the changes must be documented.
  • Are reusable components documented? If this PR introduces components that are relevant to other developers (for instance a mixin for a view or a generic form) they should be documented in the Wiki.

@Yoshani Yoshani mentioned this pull request Jul 12, 2024
19 tasks
@Yoshani Yoshani force-pushed the feature-remove-registry-xacml branch 2 times, most recently from f1dbfae to 289f5e5 Compare July 15, 2024 11:29
public static final String VERSION = "VERSION";
public static final String TENANT_ID = "TENANT_ID";
public static final String LAST_MODIFIED_TIME = "LAST_MODIFIED_TIME";
public static final String LAST_MODIFIED_USER = "LAST_MODIFIED_USER";
Copy link
Contributor

Choose a reason for hiding this comment

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

revisit whether this is storing user-id or a username

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It stores the username

Copy link
Contributor

Choose a reason for hiding this comment

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

Cant we store userid?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It will be a behavioral change from registry impl since lastModifiedUser is a property of the PolicyDTO object.

// IDN_XACML_STATUS table
public static final String STATUS_TYPE = "TYPE";
public static final String IS_SUCCESS = "IS_SUCCESS";
public static final String USER = "USERNAME";
Copy link
Contributor

Choose a reason for hiding this comment

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

revisit whether this is storing user-id or a username

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also stores the username

}

// performing cache invalidation
EntitlementEngine.getInstance().invalidatePolicyCache();
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't we invalidate cache after the commit?

in a rare situation, if the thread got wait just after executing this line.. another thread could add a new cache entry which will be incorrect just after the first thread continues its execution and updated the policy combining algo in the db.. This would leave, a stale incorrect cache entry in the cache.

But moving the invalidation just after the commit, could lead to another race condition other way around, but thats impact is minimal and would not leave for stale data for a long time.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, can we move the caching logic out of the dao.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved the caching logic out

try {
// Check the existence of the algorithm
String algorithm = getPolicyCombiningAlgorithm(connection, tenantId);
String query = StringUtils.isNotBlank(algorithm)
Copy link
Contributor

Choose a reason for hiding this comment

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

better if we can get rid of this kind of logic outside from the dao impl..
but this specific instance have very minor impact.

@Yoshani Yoshani force-pushed the feature-remove-registry-xacml branch 4 times, most recently from c73e0bf to 012de8e Compare July 23, 2024 09:56
@Yoshani Yoshani force-pushed the feature-remove-registry-xacml branch 10 times, most recently from e2bd8c6 to 862f890 Compare July 25, 2024 09:15
@Yoshani Yoshani force-pushed the feature-remove-registry-xacml branch from 862f890 to 92f0a83 Compare July 26, 2024 08:56
@Yoshani
Copy link
Contributor Author

Yoshani commented Aug 1, 2024

Closing since this will be covered with #5826.

@Yoshani Yoshani closed this Aug 1, 2024
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.

2 participants