Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[backend] validate saved filters on create/edit (#4536) #4898

Closed
wants to merge 84 commits into from

Conversation

labo-flg
Copy link
Member

We need to validate each and every filter saved into the platform with respect to isStixMatchFilterGroup capabilities:

  • no multi filter keys
  • only a subset of filter keys compatible

Proposed changes

  • improve the validator function in stix-filtering.ts so the error gives enough details (what key is bad, what's available)
  • call this validator on edit and create resolvers for: Stream, Feed, Taxii, PlaybookNode, notif Trigger

Related issues

Further comments

Only for internal review in the "filter team".

@labo-flg labo-flg added the filigran team use to identify PR from the Filigran team label Nov 14, 2023
@labo-flg labo-flg self-assigned this Nov 14, 2023
@@ -36,6 +37,11 @@ const checkFeedIntegrity = (input: FeedAddInput) => {
}
});
}

// our stix matching is currently limited, we need to validate the input filters
if (input.filters && input.filters !== '{}') {
Copy link
Member

Choose a reason for hiding this comment

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

can input.filters be equal to {} ? I think it's undefined or of type FilterGroup (mode is compulsory etc)

Copy link
Member Author

Choose a reason for hiding this comment

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

it can be apparently. I tested it, but don't remember the actual test case.

Well in fact this check is not useful, the validation would throw an error properly anyway..

@Archidoit Archidoit force-pushed the issue/2686-preparation branch 2 times, most recently from 03a86b8 to c34f8ba Compare November 14, 2023 15:35
@labo-flg labo-flg marked this pull request as draft November 14, 2023 16:23
@labo-flg
Copy link
Member Author

Reviewed lived and merged.

@labo-flg labo-flg closed this Nov 14, 2023
@labo-flg labo-flg deleted the issue/4536-validation-filters branch November 14, 2023 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
filigran team use to identify PR from the Filigran team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants