Skip to content

Commit

Permalink
show source and sink in output message (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
hgouvea-nubank authored Mar 23, 2024
1 parent 303468d commit 27d6c65
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
17 changes: 10 additions & 7 deletions lib/Zarn/AST.pm
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,18 @@ package Zarn::AST {
$var_token -> parent -> isa("PPI::Token::Operator") ||
$var_token -> parent -> isa("PPI::Statement::Expression")
)) {
my ($line, $rowchar) = @{$token -> location};
my ($line_sink, $rowchar_sink) = @{$token -> location};
my ($line_source, $rowchar_source) = @{$var_token -> location};

push @results, {
category => $category,
file => $file,
title => $title,
message => $message,
line => $line,
rowchar => $rowchar
category => $category,
file => $file,
title => $title,
message => $message,
line_sink => $line_sink,
rowchar_sink => $rowchar_sink,
line_source => $line_source,
rowchar_source => $rowchar_source
};
}
}
Expand Down
14 changes: 8 additions & 6 deletions zarn.pl
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,15 @@ sub main {
}

foreach my $result (@results) {
my $category = $result -> {category};
my $file = $result -> {file};
my $title = $result -> {title};
my $line = $result -> {line};
my $rowchar = $result -> {rowchar};
my $category = $result -> {category};
my $file = $result -> {file};
my $title = $result -> {title};
my $line_sink = $result -> {line_sink};
my $rowchar_sink = $result -> {rowchar_sink};
my $line_source = $result -> {line_source};
my $rowchar_source = $result -> {rowchar_source};

print "[$category] - FILE:$file \t Potential: $title. \t Line: $line:$rowchar\n";
print "[$category] - FILE:$file \t Potential: $title. \t Dangerous function on line: $line_sink:$rowchar_sink \t Data point possibility controlled: $line_source:$rowchar_source\n";
}

if ($sarif) {
Expand Down

0 comments on commit 27d6c65

Please sign in to comment.