-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SARIF support and integration with Github Alerts (#29)
* Feat/add makefile (#21) * develop * release/0.0.6 * feat: add Dockerized build and run support - Added Makefile for Dockerized application - Defined Docker image and version variables - Included Docker commands for build, run, exec, stop, clean, and rebuild Why: Facilitate easy development, testing, and deployment using Docker. * test perl critic * test perl critic * fix * syntax * identation * add path * identation * test * test of rule * fix * remove examples * remove rules * fix code * new policies * fix linter errors * update version to 0.0.6 * Support SARIF output format #11 (#27) * feat!: support of SARIF output format when "--sarif" option is passed as a parameter BREAKING CHANGES: recieves "--sarif" as a parameter stores the subset of information present on ZARN to generate SARIF output function to generate SARIF output * feat!: support "--sarif" option for outputs of this type * fix: variables declaration, SARIF generation * update workflows * Support SARIF output format (#28) * Bump actions/checkout from 2 to 4 (#26) Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](actions/checkout@v2...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * initializing sarif output format and some refactor on ast file * update the command description * commiting code changes to make checkpoint - most part of the implementation are correct now but still with some problems * support sarif output format * perlcritic update * solve merge problems * remove unused method * some changes now we maintain the actual output of the tool but in case the user pass --sarif with a string for filename we will create the corresponding file with the output at this file in sarif --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * added JSON as a dependencie * update version * starting refactoring * added example of sarif command * adjusts on style code * return to privsec version * fix linter warnings * rename * update version * fix syntax * rename SARIF to Sarif * fix * fixes to be a valid sarif file --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Anderson Bosa <andersonbosa0@gmail.com> Co-authored-by: Heitor Gouvêa <htrgouvea@Heitors-MacBook-Pro.local> Co-authored-by: priv <140729444+scriptprivate@users.noreply.github.com> Co-authored-by: Giovanni Martins <giovannimartins2000@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
- Loading branch information
1 parent
d1acedc
commit 9c9c22a
Showing
9 changed files
with
138 additions
and
56 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ on: | |
pull_request: | ||
branches: | ||
- main | ||
- develop | ||
|
||
jobs: | ||
critic: | ||
|
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--maximum-line-length=120 | ||
--indent-columns=4 | ||
--continuation-indentation=4 | ||
--square-bracket-tightness=2 | ||
--tight-secret-operators | ||
--maximum-consecutive-blank-lines=1 |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
requires "File::Find::Rule", "0.34"; | ||
requires "Getopt::Long", "2.54"; | ||
requires "YAML::Tiny", "1.73"; | ||
requires "PPI::Document", "1.276"; | ||
requires "PPI::Document", "1.276"; | ||
requires "JSON"; |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package Zarn::Sarif { | ||
use strict; | ||
use warnings; | ||
|
||
sub new { | ||
my ($self, @vulnerabilities) = @_; | ||
|
||
my $sarif_data = { | ||
"\$schema" => "https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json", | ||
version => "2.1.0", | ||
runs => [{ | ||
tool => { | ||
driver => { | ||
name => "ZARN", | ||
informationUri => "https://github.com/htrgouvea/zarn", | ||
version => "0.0.8" | ||
} | ||
}, | ||
results => [] | ||
}] | ||
}; | ||
|
||
foreach my $info (@vulnerabilities) { | ||
my $result = { | ||
ruleId => $info -> {title}, | ||
message => { | ||
text => $info -> {title} | ||
}, | ||
locations => [{ | ||
physicalLocation => { | ||
artifactLocation => { | ||
uri => $info -> {file} | ||
}, | ||
region => { | ||
startLine => $info -> {line}, | ||
startColumn => $info -> {rowchar} | ||
} | ||
} | ||
}] | ||
}; | ||
|
||
push @{$sarif_data -> {runs}[0]{results}}, $result; | ||
} | ||
|
||
return $sarif_data; | ||
} | ||
} | ||
|
||
1; |
This file contains 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