Skip to content

[K9VULN-11258] Implement config file v2 parser#806

Merged
jasonforal merged 7 commits intomainfrom
jf/K9VULN-11258
Feb 3, 2026
Merged

[K9VULN-11258] Implement config file v2 parser#806
jasonforal merged 7 commits intomainfrom
jf/K9VULN-11258

Conversation

@jasonforal
Copy link
Collaborator

What problem are you trying to solve?

Implementing the config V2 file schema.

What is your solution?

NOTE: this PR makes no changes to business logic or v1 semantics.

  • Implements the v2 schema parser (currently dead code)
    • Parsing logic is mostly equivalent to the v1 parser, with one notable difference: the new v2 structs (e.g. ConfigFile, RulesetConfig, etc.) have every field expressed as an Option. This preserves of the semantic meaning of an unset field beyond just the YAML parsing phase.

Alternatives considered

What the reviewer should know

  • I took this as an opportunity to bump our JSON schema spec from draft-04 to draft-07 to get better metadata support.
    • This required switching NPM packages to one that supported draft-07.

@datadog-official

This comment has been minimized.

V1 => YamlSchemaVersion::V1,
V2 => YamlSchemaVersion::V2,
_ => {
s.truncate(8);

Choose a reason for hiding this comment

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

i know you said this is preserving existing behavior but is there a reason we truncate to 8 characters? seems a little arbitrary

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This will be new behavior for the v2 parser (this enum is unused by the v1 parser).

It is entirely arbitrary. However, should we eventually start to expose parse errors in the UI, I'd rather not accidentally print a 50 megabyte string someone (not so graciously) adds as a schema version :)

Copy link
Contributor

@robertohuertasm-datadog robertohuertasm-datadog left a comment

Choose a reason for hiding this comment

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

LGTM! 🚀

@jasonforal jasonforal merged commit 49ad731 into main Feb 3, 2026
81 checks passed
@jasonforal jasonforal deleted the jf/K9VULN-11258 branch February 3, 2026 16:01
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.

3 participants