Skip to content

[K9VULN-12170] Ignore empty configuration files#865

Merged
jasonforal merged 1 commit intomainfrom
jf/K9VULN-12170
Mar 27, 2026
Merged

[K9VULN-12170] Ignore empty configuration files#865
jasonforal merged 1 commit intomainfrom
jf/K9VULN-12170

Conversation

@jasonforal
Copy link
Copy Markdown
Collaborator

What problem are you trying to solve?

Static analysis currently fails if an empty configuration file is encountered. While technically invalid (i.e. doesn't pass schema validation), an empty file should be ignored, as the intent is clearly to not have any configuration.

What is your solution?

Only attempt to parse the file as a configuration if it isn't empty.

Alternatives considered

What the reviewer should know

@jasonforal jasonforal requested a review from a team as a code owner March 26, 2026 15:34
Copilot AI review requested due to automatic review settings March 26, 2026 15:34
@datadog-official

This comment has been minimized.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates CLI configuration loading to treat empty (or whitespace-only) YAML config files as “not present”, preventing schema validation failures when users intentionally leave config blank.

Changes:

  • Skip parsing Code Security (v1) and legacy config files when file contents are empty/whitespace-only.
  • Remove the explicit error previously raised for an empty legacy config file.
  • Add a unit test ensuring empty config files are ignored.

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

Comment thread crates/cli/src/config_file.rs
@jasonforal jasonforal merged commit a6874d5 into main Mar 27, 2026
108 of 110 checks passed
@jasonforal jasonforal deleted the jf/K9VULN-12170 branch March 27, 2026 19:36
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