Skip to content

Commit

Permalink
Add version and driver loading test
Browse files Browse the repository at this point in the history
  • Loading branch information
radare authored and trufae committed Jun 14, 2024
1 parent e290096 commit 9355b45
Show file tree
Hide file tree
Showing 2 changed files with 103 additions and 6 deletions.
55 changes: 55 additions & 0 deletions test/bins/files/sarif.driver.ns.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"driver": {
"name": "SARIF Findings",
"product": "Platform",
"semanticVersion": "0.0.1",
"rules": [
{
"id": "SF00001",
"deprecatedIds": [
"unprotected_context_registered_broadcast_receivers"
],
"name": "Context Registered Broadcast Receivers Not Protected with Permissions",
"defaultConfiguration": {
"level": "error"
},
"properties": {
"security-severity": "4",
"security-severity-vector": "CVSS:3.0/AV:L/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N",
"tags": [
"security"
]
}
},
{
"id": "SF00002",
"deprecatedIds": [
"unprotected_manifest_broadcast_receivers"
],
"name": "Manifest Declared Broadcast Receivers Not Protected With Permissions Can Leak Data to Other Apps",
"defaultConfiguration": {
"level": "error"
},
"properties": {
"security-severity": "4",
"security-severity-vector": "CVSS:3.0/AV:L/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N",
"tags": [
"security"
]
}
},
{
"id": "SF00003",
"deprecatedIds": [
"exported_components"
],
"name": "Implicitly Exported Components Block Installation to Android 12",
"defaultConfiguration": {
"level": "note"
}
}
],
"isComprehensive": true,
"language": "en"
}
}
54 changes: 48 additions & 6 deletions test/db/cmd/cmd_sarif
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
NAME=sarif world
FILE=-
ARGS=-i ../sarif-ts/plugin.r2.js
ARGS=-i ../sarif.r2.js
CMDS=<<EOF
?e hello sarif
?ee error message
Expand All @@ -15,7 +15,7 @@ RUN

NAME=sarif help
FILE=-
ARGS=-i ../sarif-ts/plugin.r2.js
ARGS=-i ../sarif.r2.js
CMDS=<<EOF
sarif help
EOF
Expand All @@ -36,19 +36,61 @@ sarif version - show plugin version
EOF
RUN

NAME=sarif load
NAME=sarif load document
ARGS=-i ../sarif.r2.js
CMDS=<<EOF
pwd
sarif load examples/driver.sarif.json
sarif load bins/files/sarif.rules.mastg.json
sarif list docs
EOF
EXPECT=<<EOF
Document loaded. Use 'sarif list'
0 bins/files/sarif.rules.mastg.json
+ mastg 1.0.0
EOF
EXPECT_ERR=
RUN

NAME=sarif drivers
ARGS=-i ../sarif.r2.js
CMDS=<<EOF
sarif list drivers
sarif load examples/driver.sarif.json
sarif load bins/files/sarif.driver.ns.json
?e ---
?e drivers
sarif list drivers
?e ---
?e docs
sarif list docs
?e ---
?e rules
sarif list rules
EOF
EXPECT=<<EOF
---
drivers
---
docs
---
rules
SF00001 Context Registered Broadcast Receivers Not Protected with Permissions
SF00002 Manifest Declared Broadcast Receivers Not Protected With Permissions Can Leak Data to Other Apps
SF00003 Implicitly Exported Components Block Installation to Android 12
Document loaded. Use 'sarif list'
0 SARIF Findings 0.0.1
0 bins/files/sarif.driver.ns.json
+ SARIF Findings 0.0.1
# Rules for Driver: SARIF Findings (0.0.1)
EOF
EXPECT_ERR=
RUN

NAME=sarif version
FILE=-
ARGS=-i ../sarif.r2.js
CMDS=<<EOF
sarif version
EOF
EXPECT=<<EOF
0.0.1
EOF
RUN

0 comments on commit 9355b45

Please sign in to comment.