Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat: Extend custom rule packs - #111

Merged
Hacks4Snacks merged 1 commit into
mainfrom
hacks4snacks/dslmatchers
Sep 15, 2026
Merged

Hacks4Snacks merged 1 commit into
mainfrom
hacks4snacks/dslmatchers

Conversation

@Hacks4Snacks

Copy link
Copy Markdown
Owner

Summary

Extend custom rule packs so users can express organization-specific security policies without writing C#.

  • Add invariant numeric comparisons, bounded regex matching, directed reachableFrom/connectsTo, and endpoint-kind filters.
  • Reuse the shared evaluator with one page-scoped graph index per analysis.
  • Update the v2 schema and documentation; add compatibility, complexity, and cross-host tests.

endpoint?.Present.HasValue == true ||
endpoint?.AnyOf != null ||
endpoint?.NotAnyOf != null;
endpoint?.NotAnyOf != null || endpoint?.GreaterThan != null || endpoint?.GreaterThanOrEqual != null ||
endpoint?.Present.HasValue == true ||
endpoint?.AnyOf != null ||
endpoint?.NotAnyOf != null;
endpoint?.NotAnyOf != null || endpoint?.GreaterThan != null || endpoint?.GreaterThanOrEqual != null ||
endpoint?.AnyOf != null ||
endpoint?.NotAnyOf != null;
endpoint?.NotAnyOf != null || endpoint?.GreaterThan != null || endpoint?.GreaterThanOrEqual != null ||
endpoint?.LessThan != null || endpoint?.LessThanOrEqual != null || endpoint?.Matches != null;
endpoint?.AnyOf != null ||
endpoint?.NotAnyOf != null;
endpoint?.NotAnyOf != null || endpoint?.GreaterThan != null || endpoint?.GreaterThanOrEqual != null ||
endpoint?.LessThan != null || endpoint?.LessThanOrEqual != null || endpoint?.Matches != null;
endpoint?.AnyOf != null ||
endpoint?.NotAnyOf != null;
endpoint?.NotAnyOf != null || endpoint?.GreaterThan != null || endpoint?.GreaterThanOrEqual != null ||
endpoint?.LessThan != null || endpoint?.LessThanOrEqual != null || endpoint?.Matches != null;
endpoint?.AnyOf != null ||
endpoint?.NotAnyOf != null;
endpoint?.NotAnyOf != null || endpoint?.GreaterThan != null || endpoint?.GreaterThanOrEqual != null ||
endpoint?.LessThan != null || endpoint?.LessThanOrEqual != null || endpoint?.Matches != null;
endpoint?.AnyOf != null ||
endpoint?.NotAnyOf != null;
endpoint?.NotAnyOf != null || endpoint?.GreaterThan != null || endpoint?.GreaterThanOrEqual != null ||
endpoint?.LessThan != null || endpoint?.LessThanOrEqual != null || endpoint?.Matches != null;
Comment on lines +2540 to +2549
foreach (DeclarativeEndpoint? filter in new[] { condition?.ReachableFrom, condition?.ConnectsTo })
{
if (filter?.Property != null)
{
foreach (string kind in filter.Kind == null ? new[] { "process", "datastore", "external" } : new[] { filter.Kind })
{
WarnProperty(kind, filter.Property, pack, origin, diagnostics);
}
}
}
Comment on lines +719 to +722
return (!expression.HasNumericMatcher ||
(isPresent && this.MatchesNumericValue(expression, value, context, ref operations))) &&
(expression.Pattern == null ||
(isPresent && this.MatchesRegexValue(expression, value, context, ref operations)));
Comment on lines +767 to +772
return value.Length <= maximumLength &&
decimal.TryParse(value, NumberStyles.Float, CultureInfo.InvariantCulture, out decimal number) &&
(!expression.GreaterThan.HasValue || number > expression.GreaterThan.Value) &&
(!expression.GreaterThanOrEqual.HasValue || number >= expression.GreaterThanOrEqual.Value) &&
(!expression.LessThan.HasValue || number < expression.LessThan.Value) &&
(!expression.LessThanOrEqual.HasValue || number <= expression.LessThanOrEqual.Value);
@Hacks4Snacks
Hacks4Snacks merged commit 4a418e6 into main Sep 15, 2026
11 checks passed
@Hacks4Snacks
Hacks4Snacks deleted the hacks4snacks/dslmatchers branch September 15, 2026 16:18
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.

2 participants