Skip to content

Commit

Permalink
state change hint
Browse files Browse the repository at this point in the history
  • Loading branch information
TilakMaddy committed Oct 6, 2024
1 parent ba94a0b commit a8117c8
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 8 deletions.
17 changes: 15 additions & 2 deletions aderyn_core/src/detect/high/state_change_after_ext_call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::{
error::Error,
};

use crate::ast::NodeID;
use crate::{ast::NodeID, context::browser::Peek};

use crate::{
capture,
Expand Down Expand Up @@ -58,7 +58,20 @@ impl IssueDetector for StateChangeAfterExternalCallDetector {
if let Some(external_call_ast_node) =
external_call_cfg_node.reflect(context)
{
capture!(self, context, external_call_ast_node);
let state_change_cfg_node =
cfg.nodes.get(&state_change).expect("cfg is corrupted");

if let Some(state_change_ast_node) =
state_change_cfg_node.reflect(context)
{
if let Some(state_change_code) = state_change_ast_node.peek(context)
{
let hint =
format!("State is changed at: `{}`", state_change_code);

capture!(self, context, external_call_ast_node, hint);
}
}
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions reports/ccip-functions-report.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 12 additions & 6 deletions reports/report.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions reports/report.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions reports/report.sarif

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions reports/templegold-report.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a8117c8

Please sign in to comment.