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

Improve notable validation #34

Merged
merged 22 commits into from
Oct 9, 2023
Merged

Improve notable validation #34

merged 22 commits into from
Oct 9, 2023

Conversation

pyth0n1c
Copy link
Contributor

@pyth0n1c pyth0n1c commented Jul 31, 2023

The following PR ensures that the following validation takes places on observables during STATIC validation (contentctl validate):

  1. Each observable (which could appear in the message in the format $name$ or in the declaration of an observable) appears as a string in the search itself. This check occurs during the validate phase
  2. Each observable above which is called our in the format $name$ appears as a field in the results generated from executing the search. This check occurs during the test phase.

Finally, after contentctl test runs and a search is tested with data, we make sure that all the fields in the search appear, populated with values (the value of the field is not 'null') in the results of the search.

It also includes a large number of other changes:

  1. When a search references a macro or lookup, we ensure that the macro/lookups exists. If not, we throw a descriptive error.
  2. Some updates to the format of the contentctl_test.yml file to support more fine-grained control over the infrastructure tests are run against (server vs container).
  3. The ability to pass the credentials for one or more servers on the command line. This way, credentials and addresses do NOT need to be hardcoded into the configuration file.

of having it be a dictionary.  This allows
for better validation and is more
Pythonic.  Also, validate that
only valid observables are used in
the message field of a detection and that
every observable declared is used in
the message field.
search as well for the
notables that we have called out.
A more thorough check will also
be done after the search runs
in contentctl test, but this static
check will likely catch most
simple issues.
when fields are missing after
running a search with real
data on a splunk instance.
This helps determine to
and even higher degree
if notables were declared
correctly and gives a high
degree of certainty that they
will be generated correctly
in ES.
missing a notable field in the
underlying search
by removing un-needed
libraries
@pyth0n1c pyth0n1c added enhancement New feature or request WIP labels Jul 31, 2023
@pyth0n1c pyth0n1c linked an issue Jul 31, 2023 that may be closed by this pull request
and message fields - these should be allowed
to be independent.  Still require that all
fields called out in the message or in the
observable are present in the search. This
commit adds in the static checks.
for macros and lookups.  Now, if we
do not find a macro or a lookup
instead of just ignoring it we will
throw an error.
detections which have been affected by updated
macros and/or lookups, to include lookup CSV
and/or YML files.
by removing quotes.
a number of areas centered around the
contentctl_test.yml configuration file
and underlying object.  This will support
better for testing against multiple
targets.
Don't override default test options
unless CLI arguments are actually
passed.
…l support for passing the address and credentials of servers on the command line.
or environment variable environments!
WORKS, but only produces
a warning message. It
is presently disabled due to
a large amount of nonconformant
content.
process when an appinspect
throws any kind of
errors/warnings/failures/
manual checks.  All of these
can prevent automatic approval
in Splunkbase or deployment of
an app.
@pyth0n1c pyth0n1c merged commit 5421566 into main Oct 9, 2023
0 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request WIP
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Validation checks improvements
1 participant