Skip to content

[SDSP-327] Add SDS rule config field for is_supporting_rule#912

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 3 commits into
mainfrom
isabella.garza/SDSP-327-support-rule-sds
May 14, 2026
Merged

[SDSP-327] Add SDS rule config field for is_supporting_rule#912
gh-worker-dd-mergequeue-cf854d[bot] merged 3 commits into
mainfrom
isabella.garza/SDSP-327-support-rule-sds

Conversation

@isabella-garza-datadog

Copy link
Copy Markdown
Contributor

What problem are you trying to solve?

The SDS library supports a concept of "supporting rules" which are rules that exist solely to supply context (ex. a subdomain or client ID) to a primary rule's active validation call via match pairing. This PR allows rules to be configured as is_supporting_rule from the static-analysis-api config and pass that to the SDS library.

Additionally, the previous scanner.scan() + scanner.validate_matches() two-step approach could not support supporting rules: matches would have to be retained between the two calls for validation, making it impossible to suppress them cleanly. Moving to scan_with_options lets the dd-sds library handle both validation and supporting rule match suppression in a single pass.

What is your solution?

  • Added is_supporting_rule: bool to the SecretRule model (with #[serde(default)] so omission from the API defaults to false)
  • Added is_supporting_rule to SecretRuleApiAttributes and wired it through the TryFrom<SecretRuleApiType> conversion
  • Passed is_supporting_rule to dd-sds via .is_supporting_rule(...) on RootRuleConfig during scanner construction, so the library knows to suppress those matches from output while still using them for template variable resolution in HTTP validation calls
  • Replaced the scanner.scan() + scanner.validate_matches() two-step with a single scanner.scan_with_options() call, passing disable_validation through ScanOptionBuilder

Alternatives considered

Filtering out supporting rule matches in the static analyzer after scan() returns was considered, but rejected in favor of having dd-sds own the behavior. This approach keeps the static analyzer's responsibility limited to passing the flag through from the API.

What the reviewer should know

  • Unit test coverage was added to verify setting is_supporting_rule=true correctly drops the matches from the SDS lib
  • A test for disable_validation=true confirms that scan_with_options correctly skips HTTP calls when validation is disabled

@datadog-prod-us1-4

Copy link
Copy Markdown

🎯 Code Coverage (details)
Patch Coverage: -1.00%
Overall Coverage: 85.38% (+0.22%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 75b6d78 | Docs | Datadog PR Page | Give us feedback!

@isabella-garza-datadog
isabella-garza-datadog marked this pull request as ready for review May 13, 2026 20:03
@isabella-garza-datadog
isabella-garza-datadog requested a review from a team as a code owner May 13, 2026 20:03
Copilot AI review requested due to automatic review settings May 13, 2026 20:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds an is_supporting_rule flag to SDS secret rules, plumbing it from the static-analysis-api config through to the dd-sds library so supporting-rule matches are suppressed from output while still being usable for match pairing/template variable resolution. Also consolidates the scan + validate flow into a single scan_with_options call.

Changes:

  • Adds is_supporting_rule to SecretRule/SecretRuleApiAttributes and wires it through to dd-sds via RootRuleConfig::is_supporting_rule.
  • Replaces scanner.scan() + scanner.validate_matches() with scanner.scan_with_options(), passing validation toggle via ScanOptionBuilder.
  • Adds unit tests (including httpmock-based) for supporting-rule suppression, match pairing template resolution, and disable_validation behavior.

Reviewed changes

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

Show a summary per file
File Description
crates/secrets/src/scanner.rs Switch to scan_with_options; add tests for supporting-rule suppression and disable_validation
crates/secrets/src/model/secret_rule.rs Add is_supporting_rule field and propagate to RootRuleConfig
crates/secrets/Cargo.toml Add httpmock as dev-dependency
crates/cli/src/model/datadog_api.rs Add API attribute and conversion; tests for deserialization defaults
crates/cli/src/model/cli_configuration.rs Update test fixtures for new field
crates/cli/src/sarif/sarif_utils.rs Update test fixtures for new field
Cargo.lock Lockfile updates for new httpmock dependency tree

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

@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot merged commit bd396d7 into main May 14, 2026
97 checks passed
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot deleted the isabella.garza/SDSP-327-support-rule-sds branch May 14, 2026 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants