hullproof 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 +222 -0
- package/NOTICE +32 -0
- package/README.md +313 -2
- package/checks/db.firebase-rules-not-open.json +24 -0
- package/checks/db.rls-every-table.json +25 -0
- package/checks/log.no-credential-in-logs.json +30 -0
- package/checks/secrets.no-env-file-committed.json +31 -0
- package/checks/secrets.no-secret-in-public-env.json +37 -0
- package/checks/storage.firebase-rules-not-open.json +22 -0
- package/checks/supply.no-untrusted-event-in-run.json +23 -0
- package/checks/web.cors-no-reflected-origin.json +31 -0
- package/detectors/ai.json +25 -0
- package/detectors/auth.json +27 -0
- package/detectors/ci.json +19 -0
- package/detectors/containers.json +8 -0
- package/detectors/data_stores.json +38 -0
- package/detectors/frameworks.json +94 -0
- package/detectors/hosting.json +44 -0
- package/detectors/iac.json +43 -0
- package/detectors/languages.json +48 -0
- package/detectors/mobile.json +22 -0
- package/detectors/package_managers.json +39 -0
- package/detectors/payments.json +19 -0
- package/detectors/runtimes.json +17 -0
- package/dist/checks/code/admin-role.js +46 -0
- package/dist/checks/code/owner-filter.js +91 -0
- package/dist/checks/code/shared.js +84 -0
- package/dist/checks/code/webhook-verify.js +77 -0
- package/dist/checks/context.js +64 -0
- package/dist/checks/map/config-checks.js +74 -0
- package/dist/checks/map/entry-checks.js +97 -0
- package/dist/checks/map/shared.js +44 -0
- package/dist/checks/ops.js +307 -0
- package/dist/checks/pro-map.js +1 -0
- package/dist/checks/run.js +92 -0
- package/dist/checks/types.js +1 -0
- package/dist/ci/comment.js +44 -0
- package/dist/ci/sarif-check.js +157 -0
- package/dist/ci/sarif.js +61 -0
- package/dist/cli.js +358 -0
- package/dist/commands/ci.js +115 -0
- package/dist/commands/git.js +58 -0
- package/dist/commands/hooks.js +30 -0
- package/dist/commands/hunt-pro.js +1 -0
- package/dist/commands/hunt.js +86 -0
- package/dist/commands/map.js +33 -0
- package/dist/commands/mcp.js +17 -0
- package/dist/commands/pack.js +48 -0
- package/dist/commands/prove-pro.js +1 -0
- package/dist/commands/prove.js +173 -0
- package/dist/commands/report-gate.js +92 -0
- package/dist/commands/scan.js +158 -0
- package/dist/confirm/agreement.js +18 -0
- package/dist/confirm/chain.js +84 -0
- package/dist/confirm/confirm.js +112 -0
- package/dist/confirm/honesty.js +75 -0
- package/dist/confirm/lead.js +92 -0
- package/dist/confirm/merge.js +88 -0
- package/dist/confirm/query.js +145 -0
- package/dist/confirm/rule.js +86 -0
- package/dist/confirm/store.js +42 -0
- package/dist/confirm/summary.js +6 -0
- package/dist/confirm/synthesis.js +28 -0
- package/dist/discover/detectors.js +50 -0
- package/dist/discover/discover.js +270 -0
- package/dist/discover/extract.js +282 -0
- package/dist/discover/git.js +40 -0
- package/dist/discover/kit-files.js +47 -0
- package/dist/discover/walk.js +110 -0
- package/dist/env.js +57 -0
- package/dist/gate/gate.js +173 -0
- package/dist/hooks/install.js +153 -0
- package/dist/hooks/run.js +112 -0
- package/dist/map/analyze.js +201 -0
- package/dist/map/build.js +253 -0
- package/dist/map/candidates.js +49 -0
- package/dist/map/cblocks.js +77 -0
- package/dist/map/config.js +291 -0
- package/dist/map/dotnet.js +242 -0
- package/dist/map/entry.js +78 -0
- package/dist/map/expo.js +190 -0
- package/dist/map/go.js +292 -0
- package/dist/map/js-express.js +143 -0
- package/dist/map/js-misc.js +295 -0
- package/dist/map/js-next.js +292 -0
- package/dist/map/laravel.js +389 -0
- package/dist/map/lex-more.js +305 -0
- package/dist/map/lex.js +425 -0
- package/dist/map/light-index.js +191 -0
- package/dist/map/light-profiles.js +324 -0
- package/dist/map/light.js +574 -0
- package/dist/map/local-vocab.js +27 -0
- package/dist/map/mobile.js +326 -0
- package/dist/map/py-django.js +281 -0
- package/dist/map/py.js +391 -0
- package/dist/map/rails.js +391 -0
- package/dist/map/repo.js +178 -0
- package/dist/map/rust.js +312 -0
- package/dist/map/spring.js +207 -0
- package/dist/map/taint.js +96 -0
- package/dist/map/touches.js +355 -0
- package/dist/map/vocab.js +88 -0
- package/dist/mapping/controls.js +34 -0
- package/dist/mapping/dependency-policy.js +44 -0
- package/dist/mapping/map.js +44 -0
- package/dist/mapping/maps/gitleaks.json +12 -0
- package/dist/mapping/maps/osv-scanner.json +7 -0
- package/dist/mapping/maps/trivy.json +13 -0
- package/dist/mcp/confine.js +59 -0
- package/dist/mcp/protocol.js +140 -0
- package/dist/mcp/schema.js +43 -0
- package/dist/mcp/server.js +37 -0
- package/dist/mcp/tools.js +238 -0
- package/dist/packs/coverage.js +79 -0
- package/dist/packs/manifest.js +36 -0
- package/dist/packs/validate.js +271 -0
- package/dist/prove/container.js +276 -0
- package/dist/prove/exec-main.js +20 -0
- package/dist/prove/executor.js +149 -0
- package/dist/prove/local.js +131 -0
- package/dist/prove/probes.js +65 -0
- package/dist/prove/recipe.js +278 -0
- package/dist/prove/run.js +136 -0
- package/dist/prove/runner.js +1 -0
- package/dist/prove/safety.js +126 -0
- package/dist/prove/spec.js +357 -0
- package/dist/prove/store.js +65 -0
- package/dist/report/build.js +297 -0
- package/dist/report/entry-points.js +75 -0
- package/dist/report/hunt-section.js +71 -0
- package/dist/report/kit.js +41 -0
- package/dist/report/load.js +35 -0
- package/dist/report/messages.js +273 -0
- package/dist/report/prove-section.js +65 -0
- package/dist/report/report.js +156 -0
- package/dist/report/surface.js +21 -0
- package/dist/report/test-code.js +51 -0
- package/dist/report/tiers.js +44 -0
- package/dist/scanners/common.js +162 -0
- package/dist/scanners/gitleaks.js +90 -0
- package/dist/scanners/index.js +113 -0
- package/dist/scanners/osv-scanner.js +77 -0
- package/dist/scanners/run-targets.js +34 -0
- package/dist/scanners/secret-noise.js +89 -0
- package/dist/scanners/semgrep.js +142 -0
- package/dist/scanners/trivy.js +65 -0
- package/dist/scanners/types.js +1 -0
- package/dist/types/check.js +1 -0
- package/dist/types/codemap.js +1 -0
- package/dist/types/findings.js +5 -0
- package/dist/types/hunt.js +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/prove.js +1 -0
- package/dist/types/results.js +2 -0
- package/dist/types/scan.js +1 -0
- package/dist/types/stack.js +5 -0
- package/dist/util.js +71 -0
- package/dist/version.js +2 -0
- package/package.json +46 -4
- package/packs/android/fixture-result.json +43 -0
- package/packs/android/pack.json +56 -0
- package/packs/dotnet/fixture-result.json +62 -0
- package/packs/dotnet/pack.json +88 -0
- package/packs/expo/answer-key.json +51 -0
- package/packs/expo/fixture-result.json +62 -0
- package/packs/expo/pack.json +79 -0
- package/packs/firebase/answer-key.json +27 -0
- package/packs/firebase/fixture-result.json +43 -0
- package/packs/firebase/pack.json +58 -0
- package/packs/go/answer-key.json +101 -0
- package/packs/go/fixture-result.json +64 -0
- package/packs/go/pack.json +99 -0
- package/packs/ios/fixture-result.json +43 -0
- package/packs/ios/pack.json +55 -0
- package/packs/laravel/answer-key.json +84 -0
- package/packs/laravel/fixture-result.json +60 -0
- package/packs/laravel/pack.json +91 -0
- package/packs/node-ts/answer-key.json +220 -0
- package/packs/node-ts/fixture-result.json +114 -0
- package/packs/node-ts/pack.json +134 -0
- package/packs/python/answer-key.json +195 -0
- package/packs/python/fixture-result.json +119 -0
- package/packs/python/pack.json +121 -0
- package/packs/rails/answer-key.json +84 -0
- package/packs/rails/fixture-result.json +60 -0
- package/packs/rails/pack.json +78 -0
- package/packs/rust/fixture-result.json +43 -0
- package/packs/rust/pack.json +69 -0
- package/packs/spring/fixture-result.json +63 -0
- package/packs/spring/pack.json +103 -0
- package/packs/supabase/answer-key.json +52 -0
- package/packs/supabase/fixture-result.json +58 -0
- package/packs/supabase/pack.json +60 -0
- package/rules/gitleaks.toml +256 -0
- package/rules/semgrep/api-route-no-auth.yaml +31 -0
- package/rules/semgrep/cors-reflect-origin.yaml +48 -0
- package/rules/semgrep/eval-or-new-function.yaml +185 -0
- package/rules/semgrep/log-session-token.yaml +48 -0
- package/rules/semgrep/math-random-tokens.yaml +24 -0
- package/rules/semgrep/next-public-secret-name.yaml +32 -0
- package/rules/semgrep/postgrest-filter-injection.yaml +78 -0
- package/rules/semgrep/raw-sql-concat.yaml +42 -0
- package/rules/semgrep/read-by-id-no-owner.yaml +49 -0
- package/rules/semgrep/server-action-no-auth.yaml +26 -0
- package/rules/semgrep/sql-variants.yaml +99 -0
- package/rules/semgrep/ssrf-unguarded-url.yaml +137 -0
- package/rules/semgrep/subprocess-injection.yaml +163 -0
- package/rules/semgrep/taint-go.yaml +333 -0
- package/rules/semgrep/taint-java.yaml +317 -0
- package/rules/semgrep/taint-javascript.yaml +412 -0
- package/rules/semgrep/taint-php.yaml +361 -0
- package/rules/semgrep/taint-python.yaml +414 -0
- package/rules/semgrep/tool-endpoint-admin-client.yaml +86 -0
- package/rules/semgrep/user-metadata-authz.yaml +22 -0
- package/rules/semgrep/verify-result-unused.yaml +62 -0
- package/rules/semgrep/webhook-parse-before-verify.yaml +29 -0
- package/rules/test-artifact-ids.json +4 -0
- package/rules/tiers.json +427 -0
- package/schemas/check-results.schema.json +55 -0
- package/schemas/check.schema.json +41 -0
- package/schemas/codemap.schema.json +216 -0
- package/schemas/findings.schema.json +1048 -0
- package/schemas/hunt-output.schema.json +46 -0
- package/schemas/hunt-result.schema.json +58 -0
- package/schemas/results.schema.json +17 -0
- package/schemas/scan-hits.schema.json +32 -0
- package/schemas/scan-meta.schema.json +25 -0
- package/schemas/stack.schema.json +93 -0
- package/src/checks/README.md +32 -0
- package/src/checks/code/admin-role.ts +49 -0
- package/src/checks/code/owner-filter.ts +95 -0
- package/src/checks/code/shared.ts +66 -0
- package/src/checks/code/webhook-verify.ts +75 -0
- package/src/checks/context.ts +72 -0
- package/src/checks/map/config-checks.ts +79 -0
- package/src/checks/map/entry-checks.ts +116 -0
- package/src/checks/map/shared.ts +63 -0
- package/src/checks/ops.ts +280 -0
- package/src/checks/pro-map.ts +4 -0
- package/src/checks/run.ts +80 -0
- package/src/checks/types.ts +12 -0
- package/src/ci/comment.ts +52 -0
- package/src/ci/sarif-check.ts +100 -0
- package/src/ci/sarif.ts +72 -0
- package/src/cli.ts +273 -0
- package/src/commands/ci.ts +104 -0
- package/src/commands/git.ts +59 -0
- package/src/commands/hooks.ts +27 -0
- package/src/commands/hunt-pro.ts +4 -0
- package/src/commands/hunt.ts +68 -0
- package/src/commands/map.ts +27 -0
- package/src/commands/mcp.ts +18 -0
- package/src/commands/pack.ts +34 -0
- package/src/commands/prove-pro.ts +4 -0
- package/src/commands/prove.ts +126 -0
- package/src/commands/report-gate.ts +75 -0
- package/src/commands/scan.ts +156 -0
- package/src/confirm/agreement.ts +23 -0
- package/src/confirm/chain.ts +67 -0
- package/src/confirm/confirm.ts +107 -0
- package/src/confirm/honesty.ts +65 -0
- package/src/confirm/lead.ts +76 -0
- package/src/confirm/merge.ts +89 -0
- package/src/confirm/query.ts +126 -0
- package/src/confirm/rule.ts +76 -0
- package/src/confirm/store.ts +42 -0
- package/src/confirm/summary.ts +9 -0
- package/src/confirm/synthesis.ts +33 -0
- package/src/discover/detectors.ts +71 -0
- package/src/discover/discover.ts +253 -0
- package/src/discover/extract.ts +235 -0
- package/src/discover/git.ts +31 -0
- package/src/discover/kit-files.ts +37 -0
- package/src/discover/walk.ts +88 -0
- package/src/env.ts +51 -0
- package/src/gate/gate.ts +169 -0
- package/src/hooks/install.ts +142 -0
- package/src/hooks/run.ts +121 -0
- package/src/map/analyze.ts +219 -0
- package/src/map/build.ts +206 -0
- package/src/map/candidates.ts +47 -0
- package/src/map/cblocks.ts +55 -0
- package/src/map/config.ts +207 -0
- package/src/map/dotnet.ts +205 -0
- package/src/map/entry.ts +80 -0
- package/src/map/expo.ts +171 -0
- package/src/map/go.ts +271 -0
- package/src/map/js-express.ts +135 -0
- package/src/map/js-misc.ts +221 -0
- package/src/map/js-next.ts +282 -0
- package/src/map/laravel.ts +327 -0
- package/src/map/lex-more.ts +152 -0
- package/src/map/lex.ts +274 -0
- package/src/map/light-index.ts +134 -0
- package/src/map/light-profiles.ts +363 -0
- package/src/map/light.ts +484 -0
- package/src/map/local-vocab.ts +30 -0
- package/src/map/mobile.ts +263 -0
- package/src/map/py-django.ts +239 -0
- package/src/map/py.ts +329 -0
- package/src/map/rails.ts +291 -0
- package/src/map/repo.ts +150 -0
- package/src/map/rust.ts +256 -0
- package/src/map/spring.ts +185 -0
- package/src/map/taint.ts +86 -0
- package/src/map/touches.ts +296 -0
- package/src/map/vocab.ts +106 -0
- package/src/mapping/controls.ts +47 -0
- package/src/mapping/dependency-policy.ts +55 -0
- package/src/mapping/map.ts +59 -0
- package/src/mapping/maps/gitleaks.json +12 -0
- package/src/mapping/maps/osv-scanner.json +7 -0
- package/src/mapping/maps/trivy.json +13 -0
- package/src/mcp/confine.ts +44 -0
- package/src/mcp/protocol.ts +144 -0
- package/src/mcp/schema.ts +35 -0
- package/src/mcp/server.ts +32 -0
- package/src/mcp/tools.ts +235 -0
- package/src/packs/coverage.ts +98 -0
- package/src/packs/manifest.ts +97 -0
- package/src/packs/validate.ts +204 -0
- package/src/prove/container.ts +237 -0
- package/src/prove/exec-main.ts +16 -0
- package/src/prove/executor.ts +130 -0
- package/src/prove/local.ts +100 -0
- package/src/prove/probes.ts +68 -0
- package/src/prove/recipe.ts +215 -0
- package/src/prove/run.ts +124 -0
- package/src/prove/runner.ts +28 -0
- package/src/prove/safety.ts +98 -0
- package/src/prove/spec.ts +256 -0
- package/src/prove/store.ts +48 -0
- package/src/report/build.ts +304 -0
- package/src/report/entry-points.ts +78 -0
- package/src/report/hunt-section.ts +67 -0
- package/src/report/kit.ts +59 -0
- package/src/report/load.ts +49 -0
- package/src/report/messages.ts +270 -0
- package/src/report/prove-section.ts +61 -0
- package/src/report/report.ts +160 -0
- package/src/report/surface.ts +32 -0
- package/src/report/test-code.ts +56 -0
- package/src/report/tiers.ts +50 -0
- package/src/scanners/common.ts +149 -0
- package/src/scanners/gitleaks.ts +89 -0
- package/src/scanners/index.ts +103 -0
- package/src/scanners/osv-scanner.ts +90 -0
- package/src/scanners/run-targets.ts +35 -0
- package/src/scanners/secret-noise.ts +80 -0
- package/src/scanners/semgrep.ts +139 -0
- package/src/scanners/trivy.ts +66 -0
- package/src/scanners/types.ts +98 -0
- package/src/types/check.ts +52 -0
- package/src/types/codemap.ts +142 -0
- package/src/types/findings.ts +107 -0
- package/src/types/hunt.ts +97 -0
- package/src/types/index.ts +10 -0
- package/src/types/prove.ts +83 -0
- package/src/types/results.ts +15 -0
- package/src/types/scan.ts +63 -0
- package/src/types/stack.ts +61 -0
- package/src/util.ts +59 -0
- package/src/version.ts +2 -0
package/dist/map/py.js
ADDED
|
@@ -0,0 +1,391 @@
|
|
|
1
|
+
import { analyze } from './analyze.js';
|
|
2
|
+
import { empty, joinPath, makeEntry } from './entry.js';
|
|
3
|
+
import { closeOf, pyBlock, splitArgs } from './lex.js';
|
|
4
|
+
// Decorator groups: each run of decorators followed by a def or class.
|
|
5
|
+
export function decoratorGroups(v) {
|
|
6
|
+
const out = [];
|
|
7
|
+
const m = v.masked;
|
|
8
|
+
const re = /^[ \t]*@/gm;
|
|
9
|
+
let from = 0;
|
|
10
|
+
for (let x = re.exec(m); x; x = re.exec(m)) {
|
|
11
|
+
if (x.index < from)
|
|
12
|
+
continue;
|
|
13
|
+
const decos = [];
|
|
14
|
+
let i = x.index;
|
|
15
|
+
for (;;) {
|
|
16
|
+
const at = m.indexOf('@', i);
|
|
17
|
+
if (at < 0 || /\S/.test(m.slice(i, at)))
|
|
18
|
+
break;
|
|
19
|
+
const nm = /^@\s*([\w.]+)/.exec(m.slice(at));
|
|
20
|
+
if (!nm)
|
|
21
|
+
break;
|
|
22
|
+
let end = at + nm[0].length;
|
|
23
|
+
let open = -1;
|
|
24
|
+
if (m[end] === '(') {
|
|
25
|
+
open = end;
|
|
26
|
+
const c = closeOf(m, end);
|
|
27
|
+
if (c < 0)
|
|
28
|
+
break;
|
|
29
|
+
end = c;
|
|
30
|
+
}
|
|
31
|
+
decos.push({ name: nm[1], start: at, end, open });
|
|
32
|
+
i = end;
|
|
33
|
+
const nxt = /^\s*(?=@|(?:async\s+)?def\s|class\s)/.exec(m.slice(i, i + 400));
|
|
34
|
+
if (!nxt)
|
|
35
|
+
break;
|
|
36
|
+
i += nxt[0].length;
|
|
37
|
+
if (m[i] !== '@')
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
if (!decos.length)
|
|
41
|
+
continue;
|
|
42
|
+
const tail = /^\s*((?:async\s+)?def|class)\s+([A-Za-z_]\w*)/.exec(m.slice(decos[decos.length - 1].end, decos[decos.length - 1].end + 400));
|
|
43
|
+
if (!tail)
|
|
44
|
+
continue;
|
|
45
|
+
const nameIdx = decos[decos.length - 1].end + tail[0].length - tail[2].length;
|
|
46
|
+
const lineStart = m.lastIndexOf('\n', nameIdx) + 1;
|
|
47
|
+
out.push({ decos, kind: tail[1] === 'class' ? 'class' : 'def', name: tail[2], lineStart, defStart: nameIdx });
|
|
48
|
+
from = lineStart + 1;
|
|
49
|
+
}
|
|
50
|
+
return out;
|
|
51
|
+
}
|
|
52
|
+
export function pyParams(masked, from) {
|
|
53
|
+
const open = masked.indexOf('(', from);
|
|
54
|
+
if (open < 0)
|
|
55
|
+
return [];
|
|
56
|
+
const close = closeOf(masked, open);
|
|
57
|
+
const inner = masked.slice(open + 1, close - 1);
|
|
58
|
+
const out = [];
|
|
59
|
+
let depth = 0;
|
|
60
|
+
let cur = '';
|
|
61
|
+
const flush = () => {
|
|
62
|
+
const name = /^\s*\*{0,2}([A-Za-z_]\w*)/.exec(cur)?.[1];
|
|
63
|
+
if (name && name !== 'self' && name !== 'cls' && !/Depends\s*\(|Security\s*\(/.test(cur))
|
|
64
|
+
out.push(name);
|
|
65
|
+
cur = '';
|
|
66
|
+
};
|
|
67
|
+
for (const c of inner) {
|
|
68
|
+
if ('([{'.includes(c))
|
|
69
|
+
depth++;
|
|
70
|
+
else if (')]}'.includes(c))
|
|
71
|
+
depth--;
|
|
72
|
+
if (c === ',' && depth === 0)
|
|
73
|
+
flush();
|
|
74
|
+
else
|
|
75
|
+
cur += c;
|
|
76
|
+
}
|
|
77
|
+
flush();
|
|
78
|
+
return out;
|
|
79
|
+
}
|
|
80
|
+
export function pyImports(v) {
|
|
81
|
+
const out = new Map();
|
|
82
|
+
for (const m of v.text.matchAll(/^[ \t]*from\s+(\.*[\w.]*)\s+import\s+(\([^)]*\)|[^\n]+)/gm)) {
|
|
83
|
+
for (const part of m[2].replace(/[()]/g, ' ').split(',')) {
|
|
84
|
+
const [attr, alias] = part.trim().split(/\s+as\s+/);
|
|
85
|
+
if (attr && /^[\w*]+$/.test(attr))
|
|
86
|
+
out.set(alias ?? attr, { module: m[1], attr });
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
for (const m of v.text.matchAll(/^[ \t]*import\s+([\w.]+)(?:\s+as\s+(\w+))?/gm))
|
|
90
|
+
out.set(m[2] ?? m[1].split('.')[0], { module: m[1], attr: null });
|
|
91
|
+
return out;
|
|
92
|
+
}
|
|
93
|
+
export function resolvePyModule(repo, from, dotted) {
|
|
94
|
+
let rel = 0;
|
|
95
|
+
while (dotted[rel] === '.')
|
|
96
|
+
rel++;
|
|
97
|
+
const rest = dotted.slice(rel).replace(/\./g, '/');
|
|
98
|
+
const candidates = (base) => (base ? [`${base}.py`, `${base}/__init__.py`] : []);
|
|
99
|
+
if (rel > 0) {
|
|
100
|
+
const parts = from.split('/').slice(0, -1);
|
|
101
|
+
for (let i = 1; i < rel; i++)
|
|
102
|
+
parts.pop();
|
|
103
|
+
const base = [...parts, ...(rest ? [rest] : [])].join('/');
|
|
104
|
+
return candidates(base).find((c) => repo.fileSet.has(c)) ?? null;
|
|
105
|
+
}
|
|
106
|
+
if (!rest)
|
|
107
|
+
return null;
|
|
108
|
+
const exact = candidates(rest).find((c) => repo.fileSet.has(c));
|
|
109
|
+
if (exact)
|
|
110
|
+
return exact;
|
|
111
|
+
const suffix = candidates(rest).flatMap((c) => repo.ctx.files.filter((f) => f.endsWith('/' + c)));
|
|
112
|
+
return suffix.sort()[0] ?? null;
|
|
113
|
+
}
|
|
114
|
+
const strArg = (t) => /^\s*(?:[rRuUbB]{0,2})(['"])((?:\\.|(?!\1).)*)\1/.exec(t)?.[2] ?? null;
|
|
115
|
+
const kwStr = (args, key) => { const m = new RegExp(`(?:^|[,(\\s])${key}\\s*=\\s*[rRuU]?(['"])([^'"]*)\\1`).exec(args); return m ? m[2] : null; };
|
|
116
|
+
export function extractPython(repo, v) {
|
|
117
|
+
const out = empty();
|
|
118
|
+
const { masked, text } = v;
|
|
119
|
+
const flaskish = /\bflask\b|\bFlask\b|\bBlueprint\b|\bfastapi\b|\bFastAPI\b|\bAPIRouter\b|\bquart\b|\bsanic\b|\bstarlette\b|\bbottle\b|\bfalcon\b|\baiohttp\b|\blitestar\b|\bflask_restful\b|\bflask_restx\b|\bconnexion\b|\bceleryd?\b|\bshared_task\b|\bapscheduler\b|\bchalice\b|\bflask_smorest\b|\btool\b|\bmcp\b/.test(v.imports + text.slice(0, 2000));
|
|
120
|
+
if (!flaskish)
|
|
121
|
+
return out;
|
|
122
|
+
const helpers = repo.helpers('py');
|
|
123
|
+
const imps = pyImports(v);
|
|
124
|
+
// Receivers: app = Flask(...), bp = Blueprint(...), router = APIRouter(...)
|
|
125
|
+
const receivers = new Map();
|
|
126
|
+
for (const m of masked.matchAll(/^[ \t]*([A-Za-z_]\w*)\s*(?::[^=\n]+)?=\s*(Flask|Blueprint|APIRouter|FastAPI|Quart|Sanic|Starlette|Router|Api|Namespace)\s*\(/gm)) {
|
|
127
|
+
const open = m.index + m[0].length - 1;
|
|
128
|
+
const close = closeOf(masked, open);
|
|
129
|
+
if (close < 0)
|
|
130
|
+
continue;
|
|
131
|
+
const args = text.slice(open, close);
|
|
132
|
+
const prefix = kwStr(args, 'url_prefix') ?? kwStr(args, 'prefix') ?? kwStr(args, 'path') ?? '';
|
|
133
|
+
const hasDeps = /dependencies\s*=/.test(args);
|
|
134
|
+
receivers.set(m[1], { name: m[1], prefix, deps: hasDeps ? { start: open, end: close } : null, isApp: /^(Flask|FastAPI|Quart|Sanic|Starlette)$/.test(m[2]) });
|
|
135
|
+
}
|
|
136
|
+
// before_request hooks: protections for every route of that receiver (app: for the whole app).
|
|
137
|
+
const hookDecos = new Map();
|
|
138
|
+
const groups = decoratorGroups(v);
|
|
139
|
+
for (const g of groups) {
|
|
140
|
+
for (const d of g.decos) {
|
|
141
|
+
const hook = /^(\w+)\.(before_request|before_app_request|middleware|before_first_request)$/.exec(d.name);
|
|
142
|
+
if (!hook || g.kind !== 'def')
|
|
143
|
+
continue;
|
|
144
|
+
const b = pyBlock(masked, v.lines, g.lineStart);
|
|
145
|
+
const rec = receivers.get(hook[1]);
|
|
146
|
+
const spec = { start: g.lineStart, end: b.end, seeds: [], decorators: [], returnsJson: false };
|
|
147
|
+
const a = analyze(v, spec, helpers);
|
|
148
|
+
const protections = a.protections.filter((p) => p.kind !== 'owner_filter').map((p) => ({ ...p, scope: 'middleware', enforced: p.enforced ?? true }));
|
|
149
|
+
if (!protections.length)
|
|
150
|
+
continue;
|
|
151
|
+
if (rec?.isApp || hook[2] === 'middleware') {
|
|
152
|
+
const gate = { id: `${v.file}:${v.lines.at(g.lineStart)}:${hook[2]}`, kind: 'middleware', framework: 'flask', file: v.file, line: v.lines.at(g.lineStart), paths: ['*'], methods: [], protections, confidence: 'medium' };
|
|
153
|
+
out.gates.push(gate);
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
const list = hookDecos.get(hook[1]) ?? [];
|
|
157
|
+
list.push({ start: g.lineStart, end: b.end });
|
|
158
|
+
hookDecos.set(hook[1], list);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
// Routes by decorator.
|
|
163
|
+
const reg = /^(\w+)\.(route|get|post|put|patch|delete|head|options|api_route|websocket|websocket_route|on_event)$/;
|
|
164
|
+
for (const g of groups) {
|
|
165
|
+
if (g.kind !== 'def')
|
|
166
|
+
continue;
|
|
167
|
+
const rd = g.decos.find((d) => reg.test(d.name) && d.open >= 0);
|
|
168
|
+
if (!rd)
|
|
169
|
+
continue;
|
|
170
|
+
const rm = reg.exec(rd.name);
|
|
171
|
+
if (rm[2] === 'on_event')
|
|
172
|
+
continue;
|
|
173
|
+
const rec = receivers.get(rm[1]);
|
|
174
|
+
if (!rec && !/^(app|bp|api|router|blueprint|server|v\d+|\w*router|\w*bp|\w*app)$/i.test(rm[1]))
|
|
175
|
+
continue;
|
|
176
|
+
const args = text.slice(rd.open, rd.end);
|
|
177
|
+
const first = splitArgs(masked, rd.open)[0];
|
|
178
|
+
const path = first ? strArg(text.slice(first.start, first.end)) ?? kwStr(args, 'path') : kwStr(args, 'path');
|
|
179
|
+
if (path === null)
|
|
180
|
+
continue;
|
|
181
|
+
let methods;
|
|
182
|
+
if (rm[2] === 'route' || rm[2] === 'api_route') {
|
|
183
|
+
const ml = /methods\s*=\s*[\[(]([^\])]*)[\])]/.exec(args);
|
|
184
|
+
methods = ml ? [...ml[1].matchAll(/['"](\w+)['"]/g)].map((x) => x[1].toUpperCase()) : ['GET'];
|
|
185
|
+
if (!methods.length)
|
|
186
|
+
methods = ['GET'];
|
|
187
|
+
}
|
|
188
|
+
else
|
|
189
|
+
methods = [rm[2].startsWith('websocket') ? 'WS' : rm[2].toUpperCase()];
|
|
190
|
+
const b = pyBlock(masked, v.lines, g.lineStart);
|
|
191
|
+
const decoSpecs = g.decos.map((d) => ({ view: v, start: d.start, end: d.end, scope: 'router' }));
|
|
192
|
+
if (rec?.deps)
|
|
193
|
+
decoSpecs.push({ view: v, start: rec.deps.start, end: rec.deps.end, scope: 'router' });
|
|
194
|
+
for (const h of hookDecos.get(rm[1]) ?? [])
|
|
195
|
+
decoSpecs.push({ view: v, start: h.start, end: h.end, scope: 'router' });
|
|
196
|
+
const params = pyParams(masked, g.defStart);
|
|
197
|
+
const framework = /fastapi|starlette|litestar/i.test(v.imports) ? 'fastapi' : /quart/i.test(v.imports) ? 'quart' : /sanic/i.test(v.imports) ? 'sanic' : 'flask';
|
|
198
|
+
for (const method of methods) {
|
|
199
|
+
const e = makeEntry(repo, { kind: 'http_route', framework, file: v.file, line: v.lines.at(rd.start), method, path: joinPath(rec?.prefix ?? '', path), name: g.name, confidence: 'high', handlerView: v, spec: { start: g.lineStart, end: b.end, seeds: [...params, 'request'], decorators: decoSpecs, returnsJson: true } });
|
|
200
|
+
// FastAPI: a parameter typed with a pydantic model is validated; Form, File and Query parameters are reads.
|
|
201
|
+
fastapiParams(repo, v, g, e);
|
|
202
|
+
out.entries.push(e);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
// add_url_rule('/x', view_func=f, methods=[...]) and api.add_resource(Cls, '/x').
|
|
206
|
+
for (const m of masked.matchAll(/\b(\w+)\.(add_url_rule|add_resource|add_api_route|add_route|add_websocket_route)\s*\(/g)) {
|
|
207
|
+
const open = m.index + m[0].length - 1;
|
|
208
|
+
const args = splitArgs(masked, open);
|
|
209
|
+
const argText = (i) => (args[i] ? text.slice(args[i].start, args[i].end) : '');
|
|
210
|
+
const rec = receivers.get(m[1]);
|
|
211
|
+
if (m[2] === 'add_resource') {
|
|
212
|
+
const cls = /^[A-Za-z_]\w*/.exec(argText(0))?.[0];
|
|
213
|
+
const paths = args.slice(1).map((_, i) => strArg(argText(i + 1))).filter((x) => !!x);
|
|
214
|
+
if (cls && paths.length)
|
|
215
|
+
pyClassMethods(repo, v, cls).forEach((cm) => { for (const p of paths)
|
|
216
|
+
out.entries.push(makeEntry(repo, { kind: 'http_route', framework: 'flask-restful', file: cm.view.file, line: cm.view.lines.at(cm.start), method: cm.method, path: joinPath(rec?.prefix ?? '', p), name: `${cls}.${cm.method.toLowerCase()}`, confidence: 'medium', handlerView: cm.view, spec: { start: cm.start, end: cm.end, seeds: [...pyParams(cm.view.masked, cm.start), 'request'], decorators: classDecos(cm.view, cls), returnsJson: true } })); });
|
|
217
|
+
continue;
|
|
218
|
+
}
|
|
219
|
+
const path = strArg(argText(0));
|
|
220
|
+
if (path === null)
|
|
221
|
+
continue;
|
|
222
|
+
const viewFunc = /view_func\s*=\s*([\w.]+)|^\s*[\w"']+\s*,\s*([\w.]+)\s*[,)]/.exec(argText(1) ? text.slice(args[1].start, args[args.length - 1].end) : '')?.[1] ?? (args[1] ? /^[A-Za-z_][\w.]*/.exec(argText(1))?.[0] : null) ?? null;
|
|
223
|
+
if (!viewFunc)
|
|
224
|
+
continue;
|
|
225
|
+
const fname = viewFunc.replace(/\.as_view$/, '').split('.')[0];
|
|
226
|
+
const methods = /methods\s*=\s*[\[(]([^\])]*)[\])]/.exec(text.slice(open, closeOf(masked, open)))?.[1];
|
|
227
|
+
const ms = methods ? [...methods.matchAll(/['"](\w+)['"]/g)].map((x) => x[1].toUpperCase()) : ['GET'];
|
|
228
|
+
const fn = repo.defs('py', fname).sort((a, b) => (a.view.file === v.file ? -1 : 0) - (b.view.file === v.file ? -1 : 0))[0];
|
|
229
|
+
if (/as_view/.test(argText(1)) || /as_view/.test(text.slice(open, closeOf(masked, open)))) {
|
|
230
|
+
const cls = /(\w+)\.as_view/.exec(text.slice(open, closeOf(masked, open)))?.[1];
|
|
231
|
+
if (!cls)
|
|
232
|
+
continue;
|
|
233
|
+
for (const cm of pyClassMethods(repo, v, cls))
|
|
234
|
+
out.entries.push(makeEntry(repo, { kind: 'http_route', framework: 'flask', file: cm.view.file, line: cm.view.lines.at(cm.start), method: cm.method, path: joinPath(rec?.prefix ?? '', path), name: `${cls}.${cm.method.toLowerCase()}`, confidence: 'medium', handlerView: cm.view, spec: { start: cm.start, end: cm.end, seeds: [...pyParams(cm.view.masked, cm.start), 'request'], decorators: classDecos(cm.view, cls), returnsJson: true } }));
|
|
235
|
+
continue;
|
|
236
|
+
}
|
|
237
|
+
if (!fn)
|
|
238
|
+
continue;
|
|
239
|
+
const b = pyBlock(fn.view.masked, fn.view.lines, fn.start);
|
|
240
|
+
const decos = decoratorsAbove(fn.view, fn.start);
|
|
241
|
+
for (const method of ms)
|
|
242
|
+
out.entries.push(makeEntry(repo, { kind: 'http_route', framework: 'flask', file: v.file, line: v.lines.at(m.index), method, path: joinPath(rec?.prefix ?? '', path), name: fname, confidence: 'medium', handlerView: fn.view, spec: { start: fn.start, end: b.end, seeds: [...pyParams(fn.view.masked, fn.start), 'request'], decorators: decos, returnsJson: true } }));
|
|
243
|
+
}
|
|
244
|
+
// Mounts: app.register_blueprint(bp, url_prefix=...), app.include_router(mod.router, prefix=..., dependencies=[...]).
|
|
245
|
+
for (const m of masked.matchAll(/\b(\w+)\.(register_blueprint|include_router|mount)\s*\(/g)) {
|
|
246
|
+
const open = m.index + m[0].length - 1;
|
|
247
|
+
const close = closeOf(masked, open);
|
|
248
|
+
if (close < 0)
|
|
249
|
+
continue;
|
|
250
|
+
const args = splitArgs(masked, open);
|
|
251
|
+
const first = args[0] ? text.slice(args[0].start, args[0].end) : '';
|
|
252
|
+
const head = /^([A-Za-z_]\w*)/.exec(first)?.[1];
|
|
253
|
+
const imp = head ? imps.get(head) : undefined;
|
|
254
|
+
const callText = text.slice(open, close);
|
|
255
|
+
const prefix = kwStr(callText, 'url_prefix') ?? kwStr(callText, 'prefix') ?? (m[2] === 'mount' ? strArg(first) ?? '' : '');
|
|
256
|
+
let target = null;
|
|
257
|
+
if (imp) {
|
|
258
|
+
const modName = imp.attr && imp.module ? `${imp.module.replace(/\.$/, '')}${imp.module.endsWith('.') ? '' : '.'}${imp.attr}` : imp.module;
|
|
259
|
+
target = (imp.attr ? resolvePyModule(repo, v.file, modName) : null) ?? resolvePyModule(repo, v.file, imp.module);
|
|
260
|
+
}
|
|
261
|
+
const protections = [];
|
|
262
|
+
if (/dependencies\s*=/.test(callText)) {
|
|
263
|
+
const a = analyze(v, { start: open, end: close, seeds: [], decorators: [], returnsJson: false }, helpers);
|
|
264
|
+
for (const p of a.protections)
|
|
265
|
+
if (p.kind !== 'owner_filter')
|
|
266
|
+
protections.push({ ...p, scope: 'router' });
|
|
267
|
+
}
|
|
268
|
+
if (target && target !== v.file)
|
|
269
|
+
out.mounts.push({ from: v.file, line: v.lines.at(m.index), prefix: joinPath('', prefix || '/'), target, protections });
|
|
270
|
+
}
|
|
271
|
+
// Jobs: Celery tasks and scheduler jobs.
|
|
272
|
+
for (const g of groups) {
|
|
273
|
+
if (g.kind !== 'def')
|
|
274
|
+
continue;
|
|
275
|
+
const jd = g.decos.find((d) => /(^|\.)(task|shared_task|scheduled_job|periodic_task|job|actor)$/.test(d.name) && /celery|apscheduler|dramatiq|huey|rq|shared_task|schedul/i.test(v.imports + d.name));
|
|
276
|
+
if (!jd)
|
|
277
|
+
continue;
|
|
278
|
+
const b = pyBlock(masked, v.lines, g.lineStart);
|
|
279
|
+
out.entries.push(makeEntry(repo, { kind: 'job', framework: /celery|shared_task/i.test(v.imports + jd.name) ? 'celery' : 'scheduler', file: v.file, line: v.lines.at(jd.start), method: null, path: null, name: g.name, confidence: 'high', handlerView: v, spec: { start: g.lineStart, end: b.end, seeds: pyParams(masked, g.defStart), decorators: [], returnsJson: false } }));
|
|
280
|
+
}
|
|
281
|
+
for (const m of masked.matchAll(/\b\w+\.add_job\s*\(\s*([A-Za-z_]\w*)/g)) {
|
|
282
|
+
const fn = repo.defs('py', m[1])[0];
|
|
283
|
+
if (!fn)
|
|
284
|
+
continue;
|
|
285
|
+
const b = pyBlock(fn.view.masked, fn.view.lines, fn.start);
|
|
286
|
+
out.entries.push(makeEntry(repo, { kind: 'job', framework: 'scheduler', file: fn.view.file, line: fn.view.lines.at(fn.start), method: null, path: null, name: m[1], confidence: 'medium', handlerView: fn.view, spec: { start: fn.start, end: b.end, seeds: pyParams(fn.view.masked, fn.start), decorators: [], returnsJson: false } }));
|
|
287
|
+
}
|
|
288
|
+
// AI tools: @tool (LangChain and others), @mcp.tool(), @function_tool.
|
|
289
|
+
for (const g of groups) {
|
|
290
|
+
if (g.kind !== 'def')
|
|
291
|
+
continue;
|
|
292
|
+
const td = g.decos.find((d) => /(^|\.)(tool|function_tool|register_tool)$/.test(d.name));
|
|
293
|
+
if (!td)
|
|
294
|
+
continue;
|
|
295
|
+
const b = pyBlock(masked, v.lines, g.lineStart);
|
|
296
|
+
out.entries.push(makeEntry(repo, { kind: 'ai_tool', framework: /mcp/i.test(td.name + v.imports) ? 'mcp' : 'ai-tools', file: v.file, line: v.lines.at(g.lineStart), method: null, path: null, name: g.name, confidence: 'medium', handlerView: v, spec: { start: g.lineStart, end: b.end, seeds: pyParams(masked, g.defStart), decorators: [], returnsJson: false } }));
|
|
297
|
+
}
|
|
298
|
+
return out;
|
|
299
|
+
}
|
|
300
|
+
// Decorators directly above the def that starts at `defStart` (an index at the start of the def line), as spec ranges.
|
|
301
|
+
export function decoratorsAbove(v, defStart) {
|
|
302
|
+
const g = decoratorGroups(v).find((x) => x.lineStart === defStart || v.masked.lastIndexOf('\n', x.defStart) + 1 === defStart);
|
|
303
|
+
return g ? g.decos.map((d) => ({ view: v, start: d.start, end: d.end, scope: 'router' })) : [];
|
|
304
|
+
}
|
|
305
|
+
export function classDecos(v, cls) {
|
|
306
|
+
const m = new RegExp(`^class\\s+${cls}\\b[^\\n]*:`, 'm').exec(v.masked);
|
|
307
|
+
if (!m)
|
|
308
|
+
return [];
|
|
309
|
+
const b = pyBlock(v.masked, v.lines, m.index);
|
|
310
|
+
const body = v.masked.slice(b.bodyStart, b.end);
|
|
311
|
+
const attrs = /\b(?:permission_classes|authentication_classes|throttle_classes|decorators|serializer_class|method_decorators)\s*=[^\n]*(?:\n[ \t]+[^\n]*)?/g;
|
|
312
|
+
const out = [{ view: v, start: m.index, end: b.bodyStart, scope: 'router' }];
|
|
313
|
+
for (const x of body.matchAll(attrs))
|
|
314
|
+
out.push({ view: v, start: b.bodyStart + x.index, end: b.bodyStart + x.index + x[0].length, scope: 'router' });
|
|
315
|
+
return out;
|
|
316
|
+
}
|
|
317
|
+
const HTTP_METHODS = ['get', 'post', 'put', 'patch', 'delete', 'head', 'options'];
|
|
318
|
+
// The HTTP methods a class defines (get, post ...), found in the class named `cls` in this file or elsewhere.
|
|
319
|
+
export function pyClassMethods(repo, v, cls) {
|
|
320
|
+
const files = [v.file, ...repo.filesOf('py').filter((f) => f !== v.file)];
|
|
321
|
+
for (const f of files) {
|
|
322
|
+
const view = f === v.file ? v : repo.view(f);
|
|
323
|
+
if (!view)
|
|
324
|
+
continue;
|
|
325
|
+
const m = new RegExp(`^class\\s+${cls}\\b[^\\n]*:`, 'm').exec(view.masked);
|
|
326
|
+
if (!m)
|
|
327
|
+
continue;
|
|
328
|
+
const b = pyBlock(view.masked, view.lines, m.index);
|
|
329
|
+
const found = [];
|
|
330
|
+
const body = view.masked.slice(b.bodyStart, b.end);
|
|
331
|
+
for (const x of body.matchAll(/^[ \t]+(?:async\s+)?def\s+(\w+)\s*\(/gm)) {
|
|
332
|
+
const name = x[1].toLowerCase();
|
|
333
|
+
if (!HTTP_METHODS.includes(name))
|
|
334
|
+
continue;
|
|
335
|
+
const at = b.bodyStart + x.index;
|
|
336
|
+
const ls = view.masked.lastIndexOf('\n', at + 1) + 1;
|
|
337
|
+
const mb = pyBlock(view.masked, view.lines, ls);
|
|
338
|
+
found.push({ view, method: name.toUpperCase(), start: ls, end: mb.end });
|
|
339
|
+
}
|
|
340
|
+
return found;
|
|
341
|
+
}
|
|
342
|
+
return [];
|
|
343
|
+
}
|
|
344
|
+
function fastapiParams(repo, v, g, e) {
|
|
345
|
+
const open = v.masked.indexOf('(', g.defStart);
|
|
346
|
+
if (open < 0)
|
|
347
|
+
return;
|
|
348
|
+
const close = closeOf(v.masked, open);
|
|
349
|
+
const sig = v.text.slice(open, close);
|
|
350
|
+
const line = v.lines.at(open);
|
|
351
|
+
const add = (source) => { if (!e.reads.some((r) => r.source === source))
|
|
352
|
+
e.reads.push({ source, line }); };
|
|
353
|
+
for (const m of sig.matchAll(/(\w+)\s*:\s*([A-Z]\w*)/g)) {
|
|
354
|
+
const typ = m[2];
|
|
355
|
+
if (typ === 'UploadFile') {
|
|
356
|
+
add('file');
|
|
357
|
+
continue;
|
|
358
|
+
}
|
|
359
|
+
if (/^(?:Dict|List|Any|Mapping|Sequence)$/.test(typ)) {
|
|
360
|
+
add('body');
|
|
361
|
+
continue;
|
|
362
|
+
}
|
|
363
|
+
if (['Request', 'Response', 'Depends', 'Session', 'BackgroundTasks', 'WebSocket'].includes(typ))
|
|
364
|
+
continue;
|
|
365
|
+
const isModel = repo.filesOf('py').some((f) => { const t = repo.ctx.text(f); return new RegExp(`class\\s+${typ}\\s*\\([^)]*(?:BaseModel|SQLModel|Schema|BaseSchema)[^)]*\\)`).test(t); });
|
|
366
|
+
if (isModel) {
|
|
367
|
+
add('body');
|
|
368
|
+
e.protections.push({ kind: 'input_validation', scope: 'handler', file: v.file, line, via: `pydantic model ${typ}`, enforced: true, confidence: 'high' });
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
for (const m of sig.matchAll(/(\w+)\s*:\s*(?:dict|list|bytes|object)\b(?!\s*=\s*(?:Query|Header|Depends))/g)) {
|
|
372
|
+
if (!(e.path ?? '').includes(`:${m[1]}`) && /^(POST|PUT|PATCH|DELETE)$/.test(e.method ?? ''))
|
|
373
|
+
add('body');
|
|
374
|
+
}
|
|
375
|
+
if (/\bFile\s*\(|UploadFile/.test(sig))
|
|
376
|
+
add('file');
|
|
377
|
+
if (/\bForm\s*\(/.test(sig))
|
|
378
|
+
add('form');
|
|
379
|
+
if (/\bQuery\s*\(/.test(sig))
|
|
380
|
+
add('query');
|
|
381
|
+
if (/\bPath\s*\(/.test(sig))
|
|
382
|
+
add('params');
|
|
383
|
+
if (/\bBody\s*\(/.test(sig))
|
|
384
|
+
add('body');
|
|
385
|
+
if (/\bHeader\s*\(/.test(sig))
|
|
386
|
+
add('headers');
|
|
387
|
+
if (e.path && /:\w+/.test(e.path))
|
|
388
|
+
add('params');
|
|
389
|
+
e.reads.sort((a, b) => (a.source < b.source ? -1 : a.source > b.source ? 1 : 0));
|
|
390
|
+
e.protections.sort((a, b) => a.line - b.line || (a.kind < b.kind ? -1 : a.kind > b.kind ? 1 : 0) || (a.via < b.via ? -1 : a.via > b.via ? 1 : 0));
|
|
391
|
+
}
|