Skip to content

Conversation

mgold1234
Copy link
Contributor

@mgold1234 mgold1234 commented Sep 7, 2025

This commits refactors lintBlueprint and adds snapshot comparison to detect compliance policy changes that add/remove blueprint requirements.

Fixup automatically adds missing items but only warns about items no longer required.

JIRA: HMS-9058

@mgold1234 mgold1234 requested a review from a team as a code owner September 7, 2025 13:43
@mgold1234 mgold1234 force-pushed the linting branch 3 times, most recently from 4442539 to 27fd842 Compare September 7, 2025 19:00
@mgold1234 mgold1234 changed the title Linting [wip] - dont rewiew yet - Linting Sep 7, 2025
@mgold1234 mgold1234 marked this pull request as draft September 7, 2025 19:00
@mgold1234 mgold1234 force-pushed the linting branch 14 times, most recently from 65bab69 to 57d698c Compare September 15, 2025 08:05
@mgold1234 mgold1234 force-pushed the linting branch 7 times, most recently from 6039715 to 0148f26 Compare September 16, 2025 09:05
@mgold1234 mgold1234 force-pushed the linting branch 13 times, most recently from 6decdfc to 839d51b Compare October 21, 2025 12:00
@ondrejbudai ondrejbudai changed the title v1/oscap: detect policy customization changes using snapshots (HMS-9059) v1/oscap: detect policy customization changes using snapshots (HMS-9058) Oct 21, 2025
@mgold1234 mgold1234 force-pushed the linting branch 9 times, most recently from 7da811f to ce1860d Compare October 21, 2025 15:47
Refactor lintBlueprint to delegate OpenSCAP-specific validation and
error handling to lintOpenscap. This simplifies lintBlueprint and
improves separation of concerns, making it easier to add other lintable
components in the future.

Moved:
- nil check for Customizations.Openscap
- AsOpenSCAPCompliance() validation and error handling
- ErrorTailoringNotFound handling logic

This change follows review feedback to make lintBlueprint more generic
and better structured.
Fix two functions that called 'lintOpenscap' with empty Customizations
lacking policy ID context, causing policy data to be ignored and
empty results returned.

'GetOscapCustomizationsForPolicy' and 'buildServiceSnapshots' now create
an OpenSCAP object with the correct policy ID before invoking lintOpenscap.
This ensures policy-specific packages, services, and FIPS settings are
properly retrieved and processed.

Refactored error handling to a switch statement for improved clarity
and maintainability.

Without this fix, compliance workflows failed silently with empty
customizations, breaking blueprint creation and policy endpoints.

Fixes:
- TestGetCustomizations/Get_customizations_for_policy_matches
- TestGetCustomizations/Get_customizations_for_policy_errors
- TestBlueprintCreationRollbackOnPolicyFailure
- TestBlueprintComplianceSnapshot
This commit adds comparing the snapshotted policy customizations with the current policy customizations,
 to generate warnings/ detect when a compliance policy has made a customization no longer required
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.

5 participants