brexhq / substation

Substation is a toolkit for routing, normalizing, and enriching security event and audit logs.
https://substation.readme.io
MIT License
330 stars 21 forks source link

Regression in CLI Tool Testing Subcommand #275

Open jshlbrd opened 6 days ago

jshlbrd commented 6 days ago

Describe the bug

The CLI tool has a regression in behavior between versions v2.2.0 and v2.3.1. In v2.3.1 configs that have relative imports fail with errors like this:

% substation test substation/threat_signals.libsonnet
?       substation/threat_signals.libsonnet    [error]
substation/threat_signals.libsonnet: RUNTIME ERROR: couldn't open import "./event.libsonnet": no match locally or in the Jsonnet library paths
        snippet:7:15-41 thunk <event> from <$>
        snippet:135:11-16
        Field "transforms"
        Array element 1
        Field "tests"
        During manifestation

This is fixed when running the CLI tool from the file's local directory. This also affects the vet subcommand.

To Reproduce

For v2.3.1, run a test for any file that uses relative imports in its tests or transforms config.

Expected behavior Relative imports should not cause errors.

Screenshots If applicable, add screenshots to help explain your problem.

Build (please complete the following information):