Skip to content

Fix compliance check through compliance profiles returning incorrect result when rule is removed - #1375

Open
klaraf755 wants to merge 22 commits into
OmniTrustILM:mainfrom
klaraf755:fix-compl
Open

klaraf755 wants to merge 22 commits into
OmniTrustILM:mainfrom
klaraf755:fix-compl

Conversation

@klaraf755

Copy link
Copy Markdown
Contributor

Fixes #1365

Copilot AI review requested due to automatic review settings March 27, 2026 09:25

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Fixes stale compliance results when a rule is removed from a compliance profile by proactively removing “orphaned” rule references from persisted compliance results, preventing removed rules from continuing to influence object compliance.

Changes:

  • Update compliance profile rule patching to remove orphaned internal/provider rule UUIDs from stored compliance results when rules are removed from profiles.
  • Add native repository update queries to prune removed rule UUIDs from JSON compliance results across affected resource types.
  • Extend test coverage to validate compliance results are cleaned up after rule removal.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/test/java/com/czertainly/core/service/compliance/ComplianceServiceTest.java Extends compliance checks to include SECRET resources in the test flow.
src/test/java/com/czertainly/core/service/compliance/ComplianceProfileServiceV2Test.java Adds a test ensuring orphaned rules are removed from persisted compliance results after rule removal.
src/main/java/com/czertainly/core/service/v2/impl/ComplianceProfileServiceImpl.java On rule removal, triggers repository cleanup to remove orphaned rule UUIDs from compliance results.
src/main/java/com/czertainly/core/dao/repository/SecretRepository.java Adds native updates to remove internal/provider rule UUIDs from secret.compliance_result.
src/main/java/com/czertainly/core/dao/repository/CryptographicKeyItemRepository.java Adds native updates to remove internal/provider rule UUIDs from cryptographic_key_item.compliance_result.
src/main/java/com/czertainly/core/dao/repository/CertificateRequestRepository.java Adds native updates to remove internal/provider rule UUIDs from certificate_request.compliance_result.
src/main/java/com/czertainly/core/dao/repository/CertificateRepository.java Adds native updates to remove internal/provider rule UUIDs from certificate.compliance_result and adjusts entity graph loading.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/main/java/com/czertainly/core/dao/repository/CertificateRepository.java Outdated
@sonarqubecloud

Copy link
Copy Markdown

@CLAassistant

CLAassistant commented Apr 22, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

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.

Compliance check through compliance profiles returns incorrect result when rule is removed

3 participants