Skip to content

Commit

Permalink
More details on findings (#33)
Browse files Browse the repository at this point in the history
* update description

* add message to the rules

* start to considerate message in the sarif output file

* change severity from 5 to 4
  • Loading branch information
htrgouvea authored Jan 28, 2024
1 parent b1bb9fa commit ec2d288
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
5 changes: 3 additions & 2 deletions .perlcriticrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
severity = 5
severity = 4

[-TestingAndDebugging::RequireUseStrict]
[-TestingAndDebugging::RequireUseStrict]
[-TestingAndDebugging::RequireUseWarnings]
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: zarn-sast
description: A lightweight static security analysis tool for modern Perl Apps
description: A lightweight static security analysis tool (SAST) for modern Perl Apps
author: Heitor Gouvêa
branding:
icon: "shield"
Expand Down
2 changes: 2 additions & 0 deletions lib/Zarn/AST.pm
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ package Zarn::AST {
my @sample = $rule -> {sample} -> @*;
my $category = $rule -> {category};
my $title = $rule -> {name};
my $message = $rule -> {message};

if (grep {my $content = $_; scalar(grep {$content =~ m/$_/xms} @sample)} $token -> content()) {
my $next_element = $token -> snext_sibling;
Expand All @@ -50,6 +51,7 @@ package Zarn::AST {
category => $category,
file => $file,
title => $title,
message => $message,
line => $line,
rowchar => $rowchar
};
Expand Down
5 changes: 4 additions & 1 deletion lib/Zarn/Sarif.pm
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@ package Zarn::Sarif {
foreach my $info (@vulnerabilities) {
my $result = {
ruleId => $info -> {title},
properties => {
title => $info -> {title}
},
message => {
text => $info -> {title}
text => $info -> {message}
},
locations => [{
physicalLocation => {
Expand Down
8 changes: 4 additions & 4 deletions rules/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ rules:
- id: '0001'
category: info
name: Debug module enabled
message:
message: Debug modules can expose sensitive information and potentially create security vulnerabilities.
sample:
- Dumper
- id: '0002'
category: vuln
name: Code Injection
message:
message: Occur when untrusted data is executed as code, allowing attackers to run arbitrary commands on the server.
sample:
- system
- eval
Expand All @@ -18,12 +18,12 @@ rules:
- id: '0003'
category: vuln
name: Path Traversal
message:
message: Occur when user input is not properly sanitized, allowing attackers to access files and directories outside of the intended directory structure.
sample:
- open
- id: '0004'
category: vuln
name: Weak Criptography Algorithm
message:
message: Weak algorithms like MD5 are susceptible to various attacks and should be avoided in favor of stronger alternatives to ensure the security of sensitive data.
sample:
- md5

0 comments on commit ec2d288

Please sign in to comment.