Skip to content

Commit

Permalink
fix #16 CustomAnalysis
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-therond committed Feb 27, 2020
1 parent b69cb7b commit abe1de2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
Binary file not shown.
24 changes: 13 additions & 11 deletions package/src/progpilot/Analysis/CustomAnalysis.php
Original file line number Diff line number Diff line change
Expand Up @@ -240,17 +240,19 @@ public static function mustVerifyDefinition($context, $instruction, $myFunc, $st
$hashedValue = $myFunc->getLine();
$hashedValue.= "-".$customRule->getAction()."-".$myFunc->getSourceMyFile()->getName();
$idVuln = hash("sha256", $hashedValue);

$temp["vuln_rule"] = Utils::encodeCharacters($customRule->getAction());
$temp["vuln_name"] = Utils::encodeCharacters($customRule->getAttack());
$temp["vuln_line"] = $myFunc->getLine();
$temp["vuln_column"] = $myFunc->getColumn();
$temp["vuln_file"] = Utils::encodeCharacters($myFunc->getSourceMyFile()->getName());
$temp["vuln_description"] = Utils::encodeCharacters($customRule->getDescription());
$temp["vuln_cwe"] = Utils::encodeCharacters($customRule->getCwe());
$temp["vuln_id"] = $idVuln;
$temp["vuln_type"] = "custom";
$context->outputs->addResult($temp);

if(is_null($context->inputs->getFalsePositiveById($idVuln))) {
$temp["vuln_rule"] = Utils::encodeCharacters($customRule->getAction());
$temp["vuln_name"] = Utils::encodeCharacters($customRule->getAttack());
$temp["vuln_line"] = $myFunc->getLine();
$temp["vuln_column"] = $myFunc->getColumn();
$temp["vuln_file"] = Utils::encodeCharacters($myFunc->getSourceMyFile()->getName());
$temp["vuln_description"] = Utils::encodeCharacters($customRule->getDescription());
$temp["vuln_cwe"] = Utils::encodeCharacters($customRule->getCwe());
$temp["vuln_id"] = $idVuln;
$temp["vuln_type"] = "custom";
$context->outputs->addResult($temp);
}
}
}
}
Expand Down

0 comments on commit abe1de2

Please sign in to comment.