Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cwe_checker
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fact-depend
cwe_checker
Commits
b06cccff
Unverified
Commit
b06cccff
authored
Aug 31, 2021
by
Enkelmann
Committed by
GitHub
Aug 31, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sort generated CWE warnings by address (#221)
parent
681b50df
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
21 additions
and
8 deletions
+21
-8
mod.rs
src/cwe_checker_lib/src/analysis/pointer_inference/mod.rs
+7
-4
cwe_134.rs
src/cwe_checker_lib/src/checkers/cwe_134.rs
+1
-0
cwe_190.rs
src/cwe_checker_lib/src/checkers/cwe_190.rs
+1
-0
cwe_243.rs
src/cwe_checker_lib/src/checkers/cwe_243.rs
+1
-0
cwe_332.rs
src/cwe_checker_lib/src/checkers/cwe_332.rs
+1
-0
cwe_367.rs
src/cwe_checker_lib/src/checkers/cwe_367.rs
+1
-0
cwe_426.rs
src/cwe_checker_lib/src/checkers/cwe_426.rs
+1
-0
cwe_467.rs
src/cwe_checker_lib/src/checkers/cwe_467.rs
+1
-0
cwe_476.rs
src/cwe_checker_lib/src/checkers/cwe_476.rs
+2
-2
cwe_560.rs
src/cwe_checker_lib/src/checkers/cwe_560.rs
+1
-0
cwe_676.rs
src/cwe_checker_lib/src/checkers/cwe_676.rs
+1
-0
cwe_78.rs
src/cwe_checker_lib/src/checkers/cwe_78.rs
+2
-2
cwe_782.rs
src/cwe_checker_lib/src/checkers/cwe_782.rs
+1
-0
No files found.
src/cwe_checker_lib/src/analysis/pointer_inference/mod.rs
View file @
b06cccff
...
...
@@ -39,7 +39,7 @@ use crate::{
use
petgraph
::
graph
::
NodeIndex
;
use
petgraph
::
visit
::
IntoNodeReferences
;
use
petgraph
::
Direction
;
use
std
::
collections
::
HashMap
;
use
std
::
collections
::
{
BTreeMap
,
HashMap
}
;
mod
context
;
pub
mod
object
;
...
...
@@ -496,9 +496,9 @@ pub fn run<'a>(
fn
collect_all_logs
(
receiver
:
crossbeam_channel
::
Receiver
<
LogThreadMsg
>
,
)
->
(
Vec
<
LogMessage
>
,
Vec
<
CweWarning
>
)
{
let
mut
logs_with_address
=
Hash
Map
::
new
();
let
mut
logs_with_address
=
BTree
Map
::
new
();
let
mut
general_logs
=
Vec
::
new
();
let
mut
collected_cwes
=
Hash
Map
::
new
();
let
mut
collected_cwes
=
BTree
Map
::
new
();
while
let
Ok
(
log_thread_msg
)
=
receiver
.recv
()
{
match
log_thread_msg
{
...
...
@@ -523,7 +523,10 @@ fn collect_all_logs(
.cloned
()
.chain
(
general_logs
.into_iter
())
.collect
();
let
cwes
=
collected_cwes
.drain
()
.map
(|(
_key
,
value
)|
value
)
.collect
();
let
cwes
=
collected_cwes
.into_iter
()
.map
(|(
_key
,
value
)|
value
)
.collect
();
(
logs
,
cwes
)
}
...
...
src/cwe_checker_lib/src/checkers/cwe_134.rs
View file @
b06cccff
...
...
@@ -107,6 +107,7 @@ pub fn check_cwe(
}
}
cwe_warnings
.sort
();
(
Vec
::
new
(),
cwe_warnings
)
}
...
...
src/cwe_checker_lib/src/checkers/cwe_190.rs
View file @
b06cccff
...
...
@@ -116,5 +116,6 @@ pub fn check_cwe(
}
}
cwe_warnings
.sort
();
(
Vec
::
new
(),
cwe_warnings
)
}
src/cwe_checker_lib/src/checkers/cwe_243.rs
View file @
b06cccff
...
...
@@ -175,5 +175,6 @@ pub fn check_cwe(
}
}
cwe_warnings
.sort
();
(
Vec
::
new
(),
cwe_warnings
)
}
src/cwe_checker_lib/src/checkers/cwe_332.rs
View file @
b06cccff
...
...
@@ -70,5 +70,6 @@ pub fn check_cwe(
cwe_warnings
.push
(
generate_cwe_warning
(
secure_initializer_func
,
rand_func
));
}
}
cwe_warnings
.sort
();
(
Vec
::
new
(),
cwe_warnings
)
}
src/cwe_checker_lib/src/checkers/cwe_367.rs
View file @
b06cccff
...
...
@@ -119,5 +119,6 @@ pub fn check_cwe(
}
}
cwe_warnings
.sort
();
(
Vec
::
new
(),
cwe_warnings
)
}
src/cwe_checker_lib/src/checkers/cwe_426.rs
View file @
b06cccff
...
...
@@ -96,5 +96,6 @@ pub fn check_cwe(
}
}
}
cwe_warnings
.sort
();
(
Vec
::
new
(),
cwe_warnings
)
}
src/cwe_checker_lib/src/checkers/cwe_467.rs
View file @
b06cccff
...
...
@@ -132,5 +132,6 @@ pub fn check_cwe(
}
}
}
cwe_warnings
.sort
();
(
Vec
::
new
(),
cwe_warnings
)
}
src/cwe_checker_lib/src/checkers/cwe_476.rs
View file @
b06cccff
...
...
@@ -45,7 +45,7 @@ use crate::prelude::*;
use
crate
::
utils
::
log
::{
CweWarning
,
LogMessage
};
use
crate
::
CweModule
;
use
petgraph
::
visit
::
EdgeRef
;
use
std
::
collections
::
Hash
Map
;
use
std
::
collections
::
BTree
Map
;
mod
state
;
use
state
::
*
;
...
...
@@ -123,7 +123,7 @@ pub fn check_cwe(
}
}
let
mut
cwe_warnings
=
Hash
Map
::
new
();
let
mut
cwe_warnings
=
BTree
Map
::
new
();
for
cwe
in
cwe_receiver
.try_iter
()
{
match
&
cwe
.addresses
[
..
]
{
[
taint_source_address
,
..
]
=>
cwe_warnings
.insert
(
taint_source_address
.clone
(),
cwe
),
...
...
src/cwe_checker_lib/src/checkers/cwe_560.rs
View file @
b06cccff
...
...
@@ -141,5 +141,6 @@ pub fn check_cwe(
}
}
cwes
.sort
();
(
log_messages
,
cwes
)
}
src/cwe_checker_lib/src/checkers/cwe_676.rs
View file @
b06cccff
...
...
@@ -89,6 +89,7 @@ pub fn generate_cwe_warnings<'a>(
cwe_warnings
.push
(
cwe_warning
);
}
cwe_warnings
.sort
();
cwe_warnings
}
...
...
src/cwe_checker_lib/src/checkers/cwe_78.rs
View file @
b06cccff
...
...
@@ -41,7 +41,7 @@
//! - Missing Taints due to lost track of pointer targets
//! - Non tracked function parameters cause incomplete taints that could miss possible dangerous inputs
use
std
::
collections
::{
HashMap
,
HashSet
};
use
std
::
collections
::{
BTreeMap
,
HashMap
,
HashSet
};
use
crate
::{
analysis
::{
...
...
@@ -161,7 +161,7 @@ pub fn check_cwe(
}
}
let
mut
cwe_warnings
=
Hash
Map
::
new
();
let
mut
cwe_warnings
=
BTree
Map
::
new
();
for
cwe
in
cwe_receiver
.try_iter
()
{
match
&
cwe
.addresses
[
..
]
{
[
taint_source_address
,
..
]
=>
cwe_warnings
.insert
(
taint_source_address
.clone
(),
cwe
),
...
...
src/cwe_checker_lib/src/checkers/cwe_782.rs
View file @
b06cccff
...
...
@@ -82,5 +82,6 @@ pub fn check_cwe(
.iter
()
.for_each
(|
sub
|
warnings
.append
(
&
mut
handle_sub
(
sub
,
symbol
)));
}
warnings
.sort
();
(
vec!
[],
warnings
)
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment