@sikkuumiii/defuse 0.0.0-stage → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +235 -0
- package/README.md +561 -2
- package/dist/src/cli.d.ts +20 -0
- package/dist/src/cli.js +619 -0
- package/dist/src/cli.js.map +1 -0
- package/dist/src/core/analyze.d.ts +178 -0
- package/dist/src/core/analyze.js +834 -0
- package/dist/src/core/analyze.js.map +1 -0
- package/dist/src/core/coverage.d.ts +87 -0
- package/dist/src/core/coverage.js +181 -0
- package/dist/src/core/coverage.js.map +1 -0
- package/dist/src/core/finding.d.ts +196 -0
- package/dist/src/core/finding.js +178 -0
- package/dist/src/core/finding.js.map +1 -0
- package/dist/src/core/licence.d.ts +50 -0
- package/dist/src/core/licence.js +56 -0
- package/dist/src/core/licence.js.map +1 -0
- package/dist/src/core/paths.d.ts +21 -0
- package/dist/src/core/paths.js +58 -0
- package/dist/src/core/paths.js.map +1 -0
- package/dist/src/core/score.d.ts +137 -0
- package/dist/src/core/score.js +232 -0
- package/dist/src/core/score.js.map +1 -0
- package/dist/src/dast/targets.d.ts +30 -0
- package/dist/src/dast/targets.js +79 -0
- package/dist/src/dast/targets.js.map +1 -0
- package/dist/src/dast/zap.d.ts +42 -0
- package/dist/src/dast/zap.js +184 -0
- package/dist/src/dast/zap.js.map +1 -0
- package/dist/src/engine/scan.d.ts +80 -0
- package/dist/src/engine/scan.js +129 -0
- package/dist/src/engine/scan.js.map +1 -0
- package/dist/src/engine/shapes.d.ts +47 -0
- package/dist/src/engine/shapes.js +328 -0
- package/dist/src/engine/shapes.js.map +1 -0
- package/dist/src/engine/walk.d.ts +60 -0
- package/dist/src/engine/walk.js +156 -0
- package/dist/src/engine/walk.js.map +1 -0
- package/dist/src/parse/astDump.d.ts +31 -0
- package/dist/src/parse/astDump.js +66 -0
- package/dist/src/parse/astDump.js.map +1 -0
- package/dist/src/parse/languages.d.ts +70 -0
- package/dist/src/parse/languages.js +174 -0
- package/dist/src/parse/languages.js.map +1 -0
- package/dist/src/parse/location.d.ts +17 -0
- package/dist/src/parse/location.js +38 -0
- package/dist/src/parse/location.js.map +1 -0
- package/dist/src/parse/node-grammars.d.ts +12 -0
- package/dist/src/parse/node-grammars.js +35 -0
- package/dist/src/parse/node-grammars.js.map +1 -0
- package/dist/src/parse/parser.d.ts +126 -0
- package/dist/src/parse/parser.js +202 -0
- package/dist/src/parse/parser.js.map +1 -0
- package/dist/src/parse/tree-store.d.ts +139 -0
- package/dist/src/parse/tree-store.js +236 -0
- package/dist/src/parse/tree-store.js.map +1 -0
- package/dist/src/platform/dependency-rule.d.ts +27 -0
- package/dist/src/platform/dependency-rule.js +21 -0
- package/dist/src/platform/dependency-rule.js.map +1 -0
- package/dist/src/platform/deps.d.ts +86 -0
- package/dist/src/platform/deps.js +304 -0
- package/dist/src/platform/deps.js.map +1 -0
- package/dist/src/platform/php-facts.d.ts +49 -0
- package/dist/src/platform/php-facts.js +67 -0
- package/dist/src/platform/php-facts.js.map +1 -0
- package/dist/src/platform/runtime-version.d.ts +78 -0
- package/dist/src/platform/runtime-version.js +573 -0
- package/dist/src/platform/runtime-version.js.map +1 -0
- package/dist/src/report/colors.d.ts +50 -0
- package/dist/src/report/colors.js +97 -0
- package/dist/src/report/colors.js.map +1 -0
- package/dist/src/report/coverage-table.d.ts +90 -0
- package/dist/src/report/coverage-table.js +291 -0
- package/dist/src/report/coverage-table.js.map +1 -0
- package/dist/src/report/html-report.d.ts +66 -0
- package/dist/src/report/html-report.js +489 -0
- package/dist/src/report/html-report.js.map +1 -0
- package/dist/src/report/human.d.ts +44 -0
- package/dist/src/report/human.js +575 -0
- package/dist/src/report/human.js.map +1 -0
- package/dist/src/report/json.d.ts +24 -0
- package/dist/src/report/json.js +178 -0
- package/dist/src/report/json.js.map +1 -0
- package/dist/src/report/mark.d.ts +17 -0
- package/dist/src/report/mark.js +39 -0
- package/dist/src/report/mark.js.map +1 -0
- package/dist/src/report/pricing.d.ts +33 -0
- package/dist/src/report/pricing.js +343 -0
- package/dist/src/report/pricing.js.map +1 -0
- package/dist/src/report/sarif.d.ts +39 -0
- package/dist/src/report/sarif.js +219 -0
- package/dist/src/report/sarif.js.map +1 -0
- package/dist/src/report/site.d.ts +87 -0
- package/dist/src/report/site.js +742 -0
- package/dist/src/report/site.js.map +1 -0
- package/dist/src/rules/code-injection.d.ts +47 -0
- package/dist/src/rules/code-injection.js +326 -0
- package/dist/src/rules/code-injection.js.map +1 -0
- package/dist/src/rules/command-injection.d.ts +30 -0
- package/dist/src/rules/command-injection.js +286 -0
- package/dist/src/rules/command-injection.js.map +1 -0
- package/dist/src/rules/contract.d.ts +198 -0
- package/dist/src/rules/contract.js +39 -0
- package/dist/src/rules/contract.js.map +1 -0
- package/dist/src/rules/format-string.d.ts +46 -0
- package/dist/src/rules/format-string.js +146 -0
- package/dist/src/rules/format-string.js.map +1 -0
- package/dist/src/rules/hardcoded-secret.d.ts +38 -0
- package/dist/src/rules/hardcoded-secret.js +440 -0
- package/dist/src/rules/hardcoded-secret.js.map +1 -0
- package/dist/src/rules/lib/guards.d.ts +168 -0
- package/dist/src/rules/lib/guards.js +1179 -0
- package/dist/src/rules/lib/guards.js.map +1 -0
- package/dist/src/rules/lib/html-safety.d.ts +75 -0
- package/dist/src/rules/lib/html-safety.js +755 -0
- package/dist/src/rules/lib/html-safety.js.map +1 -0
- package/dist/src/rules/lib/local-build.d.ts +59 -0
- package/dist/src/rules/lib/local-build.js +320 -0
- package/dist/src/rules/lib/local-build.js.map +1 -0
- package/dist/src/rules/lib/strings.d.ts +208 -0
- package/dist/src/rules/lib/strings.js +1970 -0
- package/dist/src/rules/lib/strings.js.map +1 -0
- package/dist/src/rules/path-traversal.d.ts +33 -0
- package/dist/src/rules/path-traversal.js +96 -0
- package/dist/src/rules/path-traversal.js.map +1 -0
- package/dist/src/rules/registry.d.ts +19 -0
- package/dist/src/rules/registry.js +77 -0
- package/dist/src/rules/registry.js.map +1 -0
- package/dist/src/rules/sql-injection.d.ts +36 -0
- package/dist/src/rules/sql-injection.js +299 -0
- package/dist/src/rules/sql-injection.js.map +1 -0
- package/dist/src/rules/ssrf.d.ts +39 -0
- package/dist/src/rules/ssrf.js +111 -0
- package/dist/src/rules/ssrf.js.map +1 -0
- package/dist/src/rules/unbounded-copy.d.ts +37 -0
- package/dist/src/rules/unbounded-copy.js +147 -0
- package/dist/src/rules/unbounded-copy.js.map +1 -0
- package/dist/src/rules/unsafe-deserialization.d.ts +43 -0
- package/dist/src/rules/unsafe-deserialization.js +276 -0
- package/dist/src/rules/unsafe-deserialization.js.map +1 -0
- package/dist/src/rules/weak-hash.d.ts +37 -0
- package/dist/src/rules/weak-hash.js +197 -0
- package/dist/src/rules/weak-hash.js.map +1 -0
- package/dist/src/rules/xss.d.ts +38 -0
- package/dist/src/rules/xss.js +527 -0
- package/dist/src/rules/xss.js.map +1 -0
- package/dist/src/taint/content-type.d.ts +19 -0
- package/dist/src/taint/content-type.js +20 -0
- package/dist/src/taint/content-type.js.map +1 -0
- package/dist/src/taint/dictionaries.d.ts +23 -0
- package/dist/src/taint/dictionaries.js +1778 -0
- package/dist/src/taint/dictionaries.js.map +1 -0
- package/dist/src/taint/fold.d.ts +59 -0
- package/dist/src/taint/fold.js +1177 -0
- package/dist/src/taint/fold.js.map +1 -0
- package/dist/src/taint/java-scope.d.ts +61 -0
- package/dist/src/taint/java-scope.js +212 -0
- package/dist/src/taint/java-scope.js.map +1 -0
- package/dist/src/taint/local-map.d.ts +79 -0
- package/dist/src/taint/local-map.js +603 -0
- package/dist/src/taint/local-map.js.map +1 -0
- package/dist/src/taint/project.d.ts +172 -0
- package/dist/src/taint/project.js +617 -0
- package/dist/src/taint/project.js.map +1 -0
- package/dist/src/taint/tracer.d.ts +265 -0
- package/dist/src/taint/tracer.js +3817 -0
- package/dist/src/taint/tracer.js.map +1 -0
- package/dist/src/taint/types.d.ts +484 -0
- package/dist/src/taint/types.js +47 -0
- package/dist/src/taint/types.js.map +1 -0
- package/dist/src/taint/visibility.d.ts +25 -0
- package/dist/src/taint/visibility.js +96 -0
- package/dist/src/taint/visibility.js.map +1 -0
- package/docs/examples/defuse.json +20 -0
- package/docs/examples/dvwa-urls.json +14 -0
- package/docs/examples/github-code-scanning.yml +54 -0
- package/docs/examples/tiny.js +4 -0
- package/package.json +73 -4
- package/src/cli.ts +747 -0
- package/src/core/analyze.ts +1072 -0
- package/src/core/coverage.ts +269 -0
- package/src/core/finding.ts +311 -0
- package/src/core/licence.ts +61 -0
- package/src/core/paths.ts +59 -0
- package/src/core/score.ts +353 -0
- package/src/dast/targets.ts +121 -0
- package/src/dast/zap.ts +246 -0
- package/src/engine/scan.ts +200 -0
- package/src/engine/shapes.ts +348 -0
- package/src/engine/walk.ts +196 -0
- package/src/parse/astDump.ts +85 -0
- package/src/parse/languages.ts +232 -0
- package/src/parse/location.ts +44 -0
- package/src/parse/node-grammars.ts +41 -0
- package/src/parse/parser.ts +262 -0
- package/src/parse/tree-store.ts +301 -0
- package/src/platform/dependency-rule.ts +33 -0
- package/src/platform/deps.ts +374 -0
- package/src/platform/php-facts.ts +85 -0
- package/src/platform/runtime-version.ts +710 -0
- package/src/report/colors.ts +107 -0
- package/src/report/coverage-table.ts +359 -0
- package/src/report/html-report.ts +601 -0
- package/src/report/human.ts +811 -0
- package/src/report/json.ts +189 -0
- package/src/report/mark.ts +47 -0
- package/src/report/pricing.ts +374 -0
- package/src/report/sarif.ts +235 -0
- package/src/report/site.ts +760 -0
- package/src/rules/code-injection.ts +346 -0
- package/src/rules/command-injection.ts +296 -0
- package/src/rules/contract.ts +220 -0
- package/src/rules/format-string.ts +158 -0
- package/src/rules/hardcoded-secret.ts +485 -0
- package/src/rules/lib/guards.ts +1235 -0
- package/src/rules/lib/html-safety.ts +793 -0
- package/src/rules/lib/local-build.ts +329 -0
- package/src/rules/lib/strings.ts +2034 -0
- package/src/rules/path-traversal.ts +101 -0
- package/src/rules/registry.ts +90 -0
- package/src/rules/sql-injection.ts +311 -0
- package/src/rules/ssrf.ts +118 -0
- package/src/rules/unbounded-copy.ts +162 -0
- package/src/rules/unsafe-deserialization.ts +291 -0
- package/src/rules/weak-hash.ts +226 -0
- package/src/rules/xss.ts +572 -0
- package/src/taint/content-type.ts +20 -0
- package/src/taint/dictionaries.ts +1855 -0
- package/src/taint/fold.ts +1206 -0
- package/src/taint/java-scope.ts +200 -0
- package/src/taint/local-map.ts +594 -0
- package/src/taint/project.ts +774 -0
- package/src/taint/tracer.ts +4298 -0
- package/src/taint/types.ts +511 -0
- package/src/taint/visibility.ts +100 -0
- package/tsconfig.json +61 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"//": "Copy to .defuse.json in your repository root. Every key here also",
|
|
3
|
+
"//exclude": "exists as a command-line flag, and the flag always wins.",
|
|
4
|
+
|
|
5
|
+
"exclude": ["node_modules", "dist", "vendor", "**/*.min.js"],
|
|
6
|
+
|
|
7
|
+
"//failOn": "Exit 1 at or above this level. 'none' always exits 0.",
|
|
8
|
+
"failOn": "critical",
|
|
9
|
+
|
|
10
|
+
"//minSeverity": "Hide below this level in the TERMINAL report only. Findings",
|
|
11
|
+
"//minSeverity2": "stay in --json and --sarif regardless - the machine output",
|
|
12
|
+
"//minSeverity3": "is never allowed to be rosier than the human one.",
|
|
13
|
+
"minSeverity": "info",
|
|
14
|
+
|
|
15
|
+
"//only": "Restrict to these rule ids. Omit to run every rule.",
|
|
16
|
+
"//note": "There is deliberately NO way to disable a rule here. A config that",
|
|
17
|
+
"//note2": "can switch off the rules a repo fails makes findings vanish with",
|
|
18
|
+
"//note3": "no record. Use defuse:ignore <rule> - <reason> on the line",
|
|
19
|
+
"//note4": "instead; those are counted and listed in every report."
|
|
20
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"base": "http://dvwa/",
|
|
3
|
+
"root": "corpus2/DVWA",
|
|
4
|
+
"trigger": "Submit=Submit",
|
|
5
|
+
"rules": [
|
|
6
|
+
["^vulnerabilities/brute/source/(low|medium)\\.php$", "vulnerabilities/brute/", "security=$1", "Login=Login"],
|
|
7
|
+
["^vulnerabilities/brute/source/(high|impossible)\\.php$", "vulnerabilities/brute/", "security=$1", {"untestable": "the page wants a fresh anti-CSRF token on every request, which this scan does not fetch"}],
|
|
8
|
+
["^vulnerabilities/captcha/source/(low|medium|high|impossible)\\.php$", "vulnerabilities/captcha/", "security=$1", {"untestable": "the code only runs after a passed reCAPTCHA, which this scan cannot solve"}],
|
|
9
|
+
["^vulnerabilities/([^/]+)/source/(low|medium|high|impossible)\\.php$", "vulnerabilities/$1/", "security=$2"],
|
|
10
|
+
["^vulnerabilities/view_help\\.php$", "$&", "", "security=low&locale=en"],
|
|
11
|
+
["^vulnerabilities/view_source\\.php$", "$&", "", "security=low"],
|
|
12
|
+
["^vulnerabilities/.+\\.php$", "$&"]
|
|
13
|
+
]
|
|
14
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Run Defuse on every pull request and publish the results into
|
|
2
|
+
# GitHub's Security tab.
|
|
3
|
+
#
|
|
4
|
+
# WHAT YOU WILL SEE, and why it looks different from other scanners:
|
|
5
|
+
#
|
|
6
|
+
# A finding whose data flow was TRACED arrives with a SARIF codeFlow attached,
|
|
7
|
+
# so GitHub renders the full source-to-sink path as clickable steps. A finding
|
|
8
|
+
# that was only pattern-matched has no codeFlow, and its message opens with
|
|
9
|
+
# "[signature-based, UNVERIFIED]". That asymmetry is deliberate - it is the
|
|
10
|
+
# whole point of the tool, and it survives the trip into CI rather than being
|
|
11
|
+
# flattened into "12 alerts".
|
|
12
|
+
#
|
|
13
|
+
# --fail-on controls the build, and is SEPARATE from what gets uploaded.
|
|
14
|
+
# Everything is reported to the Security tab; only findings at or above
|
|
15
|
+
# --fail-on stop the pipeline. Start at `critical` on an existing codebase and
|
|
16
|
+
# tighten once the backlog is down, rather than switching rules off.
|
|
17
|
+
|
|
18
|
+
name: Security scan
|
|
19
|
+
|
|
20
|
+
on:
|
|
21
|
+
pull_request:
|
|
22
|
+
push:
|
|
23
|
+
branches: [main]
|
|
24
|
+
|
|
25
|
+
permissions:
|
|
26
|
+
contents: read
|
|
27
|
+
security-events: write # required to upload SARIF
|
|
28
|
+
|
|
29
|
+
jobs:
|
|
30
|
+
defuse:
|
|
31
|
+
runs-on: ubuntu-latest
|
|
32
|
+
steps:
|
|
33
|
+
- uses: actions/checkout@v4
|
|
34
|
+
|
|
35
|
+
- uses: actions/setup-node@v4
|
|
36
|
+
with:
|
|
37
|
+
node-version: 20
|
|
38
|
+
|
|
39
|
+
- name: Build the scanner
|
|
40
|
+
run: npm ci && npm run build
|
|
41
|
+
|
|
42
|
+
# `|| true` so a failing gate still uploads its results - a blocked merge
|
|
43
|
+
# with no visible reason is a worse experience than a noisy one.
|
|
44
|
+
- name: Scan
|
|
45
|
+
run: node dist/src/cli.js scan . --sarif --fail-on=critical > defuse.sarif || true
|
|
46
|
+
|
|
47
|
+
- uses: github/codeql-action/upload-sarif@v3
|
|
48
|
+
with:
|
|
49
|
+
sarif_file: defuse.sarif
|
|
50
|
+
category: defuse
|
|
51
|
+
|
|
52
|
+
# Re-run for the exit code, now that the results are safely uploaded.
|
|
53
|
+
- name: Enforce the gate
|
|
54
|
+
run: node dist/src/cli.js scan . --quiet --fail-on=critical
|
package/package.json
CHANGED
|
@@ -1,6 +1,75 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sikkuumiii/defuse",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.5.0",
|
|
4
|
+
"description": "A SAST scanner that labels every finding signature-based or flow-verified, and prints what it did not check.",
|
|
5
|
+
"license": "AGPL-3.0-only",
|
|
6
|
+
"author": "Farhaad",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/sikkuumi/Defuse.git"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/sikkuumi/Defuse#readme",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/sikkuumi/Defuse/issues"
|
|
14
|
+
},
|
|
15
|
+
"type": "module",
|
|
16
|
+
"bin": {
|
|
17
|
+
"defuse": "dist/src/cli.js"
|
|
18
|
+
},
|
|
19
|
+
"engines": {
|
|
20
|
+
"node": ">=18"
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "tsc",
|
|
24
|
+
"scan": "npm run build --silent && node dist/src/cli.js scan",
|
|
25
|
+
"test": "npm run build --silent && node dist/tests/run-tests.js",
|
|
26
|
+
"ast": "npm run build --silent && node dist/src/cli.js ast",
|
|
27
|
+
"clean": "rm -rf dist",
|
|
28
|
+
"doctor": "npm run build --silent && node dist/src/cli.js doctor",
|
|
29
|
+
"rules": "npm run build --silent && node dist/src/cli.js rules",
|
|
30
|
+
"ui": "npm run build --silent && node scripts/build-ui.mjs && node scripts/serve-ui.mjs",
|
|
31
|
+
"build:ui": "npm run build --silent && node scripts/build-ui.mjs",
|
|
32
|
+
"metamorphic": "npm run build --silent && node dist/tests/metamorphic.js",
|
|
33
|
+
"benchmark": "npm run build --silent && node scripts/label-split.mjs",
|
|
34
|
+
"dvwa": "npm run build --silent && node scripts/dvwa.mjs",
|
|
35
|
+
"sync:readme": "npm run build --silent && node scripts/sync-readme.mjs",
|
|
36
|
+
"prepare": "npm run build",
|
|
37
|
+
"install-check": "node scripts/install-check.mjs",
|
|
38
|
+
"git-install-check": "npm run build --silent && node scripts/git-install-check.mjs",
|
|
39
|
+
"memory": "npm run build --silent && node scripts/memory.mjs",
|
|
40
|
+
"identity": "npm run build --silent && node scripts/identity.mjs",
|
|
41
|
+
"label-split": "npm run build --silent && node scripts/label-split.mjs",
|
|
42
|
+
"build:site": "npm run build --silent && node scripts/build-site.mjs",
|
|
43
|
+
"review-reasons": "node scripts/review-reasons.mjs",
|
|
44
|
+
"scoreboard": "npm run build --silent && node scripts/scoreboard.mjs"
|
|
45
|
+
},
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"tree-sitter-wasms": "0.1.13",
|
|
48
|
+
"web-tree-sitter": "0.25.10"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@types/node": "^22.10.2",
|
|
52
|
+
"@types/sarif": "^2.1.7",
|
|
53
|
+
"typescript": "^5.7.2"
|
|
54
|
+
},
|
|
55
|
+
"keywords": [
|
|
56
|
+
"sast",
|
|
57
|
+
"static-analysis",
|
|
58
|
+
"security",
|
|
59
|
+
"taint-analysis",
|
|
60
|
+
"sarif",
|
|
61
|
+
"tree-sitter",
|
|
62
|
+
"vulnerability-scanner"
|
|
63
|
+
],
|
|
64
|
+
"files": [
|
|
65
|
+
"dist/src",
|
|
66
|
+
"src",
|
|
67
|
+
"tsconfig.json",
|
|
68
|
+
"docs/examples",
|
|
69
|
+
"README.md",
|
|
70
|
+
"LICENSE"
|
|
71
|
+
],
|
|
72
|
+
"publishConfig": {
|
|
73
|
+
"access": "public"
|
|
74
|
+
}
|
|
75
|
+
}
|