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

More details on findings #33

Merged
merged 4 commits into from
Jan 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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