Support remote custom configs
What does this MR do?
Refactors the code slightly store a pointer to the ruleset and update convert
and analyze
methods to accept the pointer.
This allows the report
module to use the same ruleset without re-cloning it from the remote git repo.
This change depends on changes to the ruleset
and command
modules too.
What are the relevant issue numbers?
MRs this blocks
Testing
To test this, since it requires multiple modules, we need to do some tricksy work:
- Checkout the
425730_eurie_remote_ruleset_not_applied_during_report_generation
branch forkics
- Then create a
modules
folder in the cloned director - In the
modules
folder clone the425730_eurie_remote_ruleset_not_applied_during_report_generation
branch for thecommand
, andruleset
modules. - In the top-level
kics
directory we're going to start a go workspace:go work init .
go work use modules/command modules/ruleset
- Clone the test project into
qa/fixtures
:git@gitlab.com:jfarmiloe/sast-remote-config-issue.git
- Make sure there's no
cast-ruleset.toml
in that project's.gitlab
folder (there was when I cloned it) - Now run
analyzer-build
- Run
analyzer-debug qa/fixtures/sast-remote-config-issue
- In the debug container, set the following environment variables
GITLAB_FEATURES=sast_custom_rulesets
SAST_RULESET_GIT_REFERENCE=gitlab.com/jfarmiloe/sast-remote-config-issue-rules
- Run the
kics
analyzer via:/analyzer run
- Verify that there are no results in the resulting
/tmp/app/gl-sast-report.json
files
Does this MR meet the acceptance criteria?
-
Changelog entry added -
Documentation created/updated for GitLab EE, if necessary -
Documentation created/updated for this project, if necessary -
Documentation reviewed by technical writer or follow-up review issue created -
Tests added for this feature/bug -
Job definition updated, if necessary -
Conforms to the code review guidelines -
Conforms to the Go guidelines -
Security reports checked/validated by reviewer
Edited by Lucas Charles