feat: Extend custom rule packs - #111
Merged
Merged
Conversation
| 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); |
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.
Summary
Extend custom rule packs so users can express organization-specific security policies without writing C#.
reachableFrom/connectsTo, and endpoint-kind filters.