fix: preserve lab config keys dropped during variant generation - #404
Merged
mwendigg merged 1 commit intoAug 3, 2026
Merged
Conversation
**Added:** - New struct fields to model previously unmodeled config keys - `OS` and `VulnsADCSTemplates` on `HostConfig`, plus `CAWebEnrollment` (pointer so an explicit `false` survives) and raw `SCCM` map on `DomainConfig` in `generator.go`; without these, `variant generate` silently drops the `vulns_adcs_templates` scoreboard annotation and the entire `sccm` block - Round-trip regression test that decodes every `ad/*/data/config.json`, re-encodes it through `LabConfig`, and fails if any non-empty key is lost - `roundtrip_test.go`; guards against future keys being added to configs without a matching struct field
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Key Changes:
OS,VulnsADCSTemplates,CAWebEnrollment,SCCM) sovariant generateno longer silently drops these keys during the JSON round-tripvulns_adcs_templatesscoreboard annotation and SCCM variants lost their entiresccmblockAdded:
HostConfig(cli/internal/variant/generator.go) -OSto mark non-Windows hosts (e.g., DRACARYS "linux" for lx01) andVulnsADCSTemplatesto carry certificate templates consumed bycli/internal/ansible/prepare.goDomainConfig(cli/internal/variant/generator.go) -CAWebEnrollmentas a*boolso an explicitfalsesurvives the round-trip (otherwise absent is treated as true byadcs.yml, silently re-enabling CA web enrollment), andSCCMas a raw map to preserve the MECM/SCCM site configuration without reshapingcli/internal/variant/roundtrip_test.gowithTestConfigRoundTripPreservesKeys, which decodes eachad/*/data/config.json, marshals it throughLabConfig, and asserts no non-empty keys are lost; acollectKeyshelper walks the decoded JSON while skipping empty values (whichomitemptylegitimately drops)