@code-sentinel-cli/code-sentinel-cli 4.0.9 → 4.0.11
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/dist/bin.js +7204 -914
- package/dist/builtin-rules/ai/spring-boot/ownership-scope-risk.rule.yaml +1 -0
- package/dist/builtin-rules/ai/spring-boot/security-authorization-risk.rule.yaml +1 -0
- package/dist/builtin-rules/ai/spring-boot/security-mass-assignment-risk.rule.yaml +1 -0
- package/dist/builtin-rules/ai/spring-boot/state-transition-guard-risk.rule.yaml +1 -0
- package/dist/builtin-rules/fortify/ai/angular/cross-feature-route-permission-drift.rule.yaml +2 -0
- package/dist/builtin-rules/fortify/ai/angular/route-permission-flow.rule.yaml +2 -0
- package/dist/builtin-rules/fortify/ai/spring-boot/io-boundary-risk.rule.yaml +1 -0
- package/dist/builtin-rules/fortify/ai/spring-boot/security-redirect-risk.rule.yaml +2 -0
- package/dist/builtin-rules/fortify/ai/spring-boot/security-sensitive-data-risk.rule.yaml +2 -0
- package/dist/builtin-rules/fortify/static/angular/sensitive-input-masking.rule.js +1 -0
- package/dist/builtin-rules/fortify/static/general/java-weak-randomness.rule.js +2 -0
- package/dist/builtin-rules/fortify/static/general/no-client-identity-header.rule.js +1 -0
- package/dist/builtin-rules/fortify/static/general/no-guessable-websql-database-name.rule.js +1 -0
- package/dist/builtin-rules/fortify/static/general/no-reflective-access-override.rule.js +1 -0
- package/dist/builtin-rules/fortify/static/general/no-sensitive-string-materialization.rule.js +1 -0
- package/dist/builtin-rules/fortify/static/spring-boot/no-command-injection.rule.js +2 -0
- package/dist/builtin-rules/fortify/static/spring-boot/no-path-traversal.rule.js +8 -1
- package/dist/builtin-rules/fortify/static/spring-boot/no-servlet-xss.rule.js +2 -0
- package/dist/builtin-rules/fortify/static/spring-boot/no-spel-injection.rule.js +2 -0
- package/dist/builtin-rules/fortify/static/spring-boot/no-sql-string-concat.rule.js +2 -0
- package/dist/builtin-rules/fortify/static/spring-boot/no-ssrf.rule.js +2 -0
- package/dist/builtin-rules/fortify/static/spring-boot/no-trust-boundary-violation.rule.js +43 -0
- package/dist/builtin-rules/fortify/static/spring-boot/no-weak-tls-protocol.rule.js +2 -0
- package/dist/builtin-rules/static/angular/no-dom-xss.rule.js +1 -0
- package/dist/builtin-rules/static/angular/template-dom-xss.rule.js +1 -0
- package/dist/builtin-rules/static/flutter/INVENTORY.md +44 -0
- package/dist/builtin-rules/static/flutter/NATIVE-INVENTORY.md +34 -0
- package/dist/builtin-rules/static/flutter/android-cleartext-traffic.rule.js +105 -0
- package/dist/builtin-rules/static/flutter/android-debug-certificate-risk.rule.js +1 -0
- package/dist/builtin-rules/static/flutter/android-exported-component.rule.js +1 -0
- package/dist/builtin-rules/static/flutter/android-manifest-hardening.rule.js +1 -0
- package/dist/builtin-rules/static/flutter/android-minsdk-low.rule.js +1 -0
- package/dist/builtin-rules/static/flutter/android-release-debuggable.rule.js +86 -0
- package/dist/builtin-rules/static/flutter/android-sensitive-permissions.rule.js +1 -0
- package/dist/builtin-rules/static/flutter/bad-certificate-callback.rule.js +81 -0
- package/dist/builtin-rules/static/flutter/biometric-without-crypto-object.rule.js +87 -0
- package/dist/builtin-rules/static/flutter/cleartext-http-endpoint.rule.js +77 -0
- package/dist/builtin-rules/static/flutter/debug-tooling-release-risk.rule.js +12 -3
- package/dist/builtin-rules/static/flutter/device-fingerprint-collection.rule.js +74 -0
- package/dist/builtin-rules/static/flutter/dynamic-archive-risk.rule.js +1 -0
- package/dist/builtin-rules/static/flutter/exported-content-provider-leak.rule.js +119 -0
- package/dist/builtin-rules/static/flutter/hardcoded-crypto-key.rule.js +125 -0
- package/dist/builtin-rules/static/flutter/hardcoded-oauth-client-secret.rule.js +108 -0
- package/dist/builtin-rules/static/flutter/hive-sensitive-storage.rule.js +1 -0
- package/dist/builtin-rules/static/flutter/insecure-deep-link.rule.js +154 -0
- package/dist/builtin-rules/static/flutter/ios-ats-exception.rule.js +83 -0
- package/dist/builtin-rules/static/flutter/ios-pasteboard-leak.rule.js +96 -0
- package/dist/builtin-rules/static/flutter/ios-privacy-hardening.rule.js +1 -0
- package/dist/builtin-rules/static/flutter/missing-enforced-update.rule.js +81 -0
- package/dist/builtin-rules/static/flutter/oauth-missing-pkce.rule.js +75 -0
- package/dist/builtin-rules/static/flutter/packaged-env-risk.rule.js +1 -0
- package/dist/builtin-rules/static/flutter/sensitive-log-leak.rule.js +1 -0
- package/dist/builtin-rules/static/flutter/token-insecure-storage.rule.js +121 -0
- package/dist/builtin-rules/static/flutter/tracking-sdk-init.rule.js +76 -0
- package/dist/builtin-rules/static/flutter/weak-mobile-crypto-algorithm.rule.js +114 -0
- package/dist/builtin-rules/static/flutter/weak-prng-mobile.rule.js +104 -0
- package/dist/builtin-rules/static/flutter/webview-bridge-guard.rule.js +1 -0
- package/dist/builtin-rules/static/general/dockerfile-dependency-confusion.rule.js +5 -4
- package/dist/builtin-rules/static/general/dockerfile-no-root-user.rule.js +1 -0
- package/dist/builtin-rules/static/general/kubernetes-pod-security.rule.js +1 -0
- package/dist/builtin-rules/static/general/no-dynamic-code-eval.rule.js +1 -0
- package/dist/builtin-rules/static/general/no-empty-encryption-key.rule.js +16 -1
- package/dist/builtin-rules/static/general/no-hardcoded-secret.rule.js +72 -9
- package/dist/builtin-rules/static/general/no-insecure-external-link.rule.js +1 -0
- package/dist/builtin-rules/static/general/no-insecure-password-submission.rule.js +34 -2
- package/dist/builtin-rules/static/general/no-unsafe-html-sink.rule.js +1 -0
- package/dist/builtin-rules/static/general/no-unused-export.rule.js +1 -0
- package/dist/builtin-rules/static/general/openapi-https-credentials.rule.js +1 -0
- package/dist/builtin-rules/static/general/sensitive-exception-response.rule.js +1 -0
- package/dist/builtin-rules/static/general/sensitive-output-exposure.rule.js +1 -0
- package/dist/builtin-rules/static/spring-boot/no-devtools-in-production.rule.js +1 -0
- package/dist/builtin-rules/static/spring-boot/no-unsafe-shared-formatter.rule.js +1 -0
- package/dist/builtin-rules/static/spring-boot/no-unzoned-datetime.rule.js +1 -0
- package/dist/builtin-rules/static/spring-boot/validate-input.rule.js +1 -0
- package/dist/index.d.ts +467 -0
- package/dist/index.js +7203 -913
- package/node_modules/@code-sentinel/parsers/index.js +81 -4
- package/package.json +1 -1
|
@@ -312,15 +312,22 @@ var JWT_PATTERNS = [
|
|
|
312
312
|
var GENERIC_PATTERNS = [
|
|
313
313
|
{
|
|
314
314
|
name: "generic-password-assignment",
|
|
315
|
-
|
|
315
|
+
// Group 1 = assigned key, group 2 = payload (keyGroup/payloadGroup below).
|
|
316
|
+
// MEASURED on ctd_ctct run ptr_muimhnjx_4a064837: the LAST surviving FP was
|
|
317
|
+
// an enum member `CONFIGURATION_PASSWORD = 'Configuration_password'` — the
|
|
318
|
+
// value echoes its own key, which is exactly the v1.2.1 field-name-echo
|
|
319
|
+
// intent generalized from a fixed list to self-echo detection.
|
|
320
|
+
regex: /\b([A-Za-z_$][\w$]*(?:password|passwd|pwd)|password|passwd|pwd)\s*[:=]\s*["']([^"'\s]{8,})["']/gi,
|
|
316
321
|
confidence: 65,
|
|
317
322
|
message: "Hard-coded password assignment detected.",
|
|
318
|
-
payloadGroup:
|
|
323
|
+
payloadGroup: 2,
|
|
324
|
+
keyGroup: 1
|
|
319
325
|
},
|
|
320
326
|
{
|
|
321
327
|
name: "empty-password-assignment",
|
|
322
|
-
regex: /\b(
|
|
328
|
+
regex: /\b([A-Za-z_$][\w$]*(?:password|passwd|pwd))\s*[:=]\s*["']\s*["']/gi,
|
|
323
329
|
confidence: 85,
|
|
330
|
+
keyGroup: 1,
|
|
324
331
|
message: "Empty password assignment detected (CWE-258 / CWE-798). Passwords must not be empty."
|
|
325
332
|
},
|
|
326
333
|
{
|
|
@@ -411,6 +418,7 @@ var looksLikePlaceholder = (payload) => {
|
|
|
411
418
|
if (lower.includes(needle)) return true;
|
|
412
419
|
}
|
|
413
420
|
if (payload.length >= 8 && /^(.)\1{7,}$/.test(payload)) return true;
|
|
421
|
+
if (/^<[^<>\s]+>$/.test(payload)) return true;
|
|
414
422
|
return false;
|
|
415
423
|
};
|
|
416
424
|
var FIELD_NAME_ECHOES = [
|
|
@@ -434,6 +442,12 @@ var FIELD_NAME_ECHOES = [
|
|
|
434
442
|
"client-secret"
|
|
435
443
|
];
|
|
436
444
|
var isFieldNameEcho = (payload) => FIELD_NAME_ECHOES.includes(payload.toLowerCase());
|
|
445
|
+
var looksLikeRoutePath = (payload) => {
|
|
446
|
+
const value = payload.trim();
|
|
447
|
+
if (/^[a-z0-9]+(?:-[a-z0-9]+)+(?:\/[a-z0-9]+(?:-[a-z0-9]+)*)*$/.test(value)) return true;
|
|
448
|
+
return /^\/?[a-z0-9]+(?:-[a-z0-9]+)*(?:\/[a-z0-9]+(?:-[a-z0-9]+)*)+$/.test(value);
|
|
449
|
+
};
|
|
450
|
+
var normalizeKeyish = (value) => value.toLowerCase().replace(/[\s_\-./]+/g, "");
|
|
437
451
|
var looksExternalized = (payload) => {
|
|
438
452
|
const trimmed = payload.trim();
|
|
439
453
|
const lower = trimmed.toLowerCase();
|
|
@@ -589,8 +603,44 @@ var EMPTY_PASSWORD_PATTERNS = /* @__PURE__ */ new Set([
|
|
|
589
603
|
"empty-password-assignment",
|
|
590
604
|
"empty-password-method-call"
|
|
591
605
|
]);
|
|
606
|
+
var isClientOnly = (path, language) => path.toLowerCase().endsWith(".vue") || language === "typescript" || language === "javascript";
|
|
607
|
+
var SERVICE_QUALIFIED_CREDENTIAL_RE = /^(?:smtp|smtps|mail|email|ldap|ad|db|database|sql|mysql|mariadb|postgres|mongo|redis|memcached|kafka|rabbit|amqp|proxy|ftp|sftp|ssl|tls|keystore|truststore|admin|root|api|client|server|sso|basic|digest|oauth|vault)\s*(?:password|passwd|pwd)$/i;
|
|
608
|
+
var isI18nKey = (payload) => /^[A-Z][A-Z0-9_]*(?:\.[A-Z0-9_]+)+$/.test(payload);
|
|
609
|
+
var isConstantNameEcho = (matched, payload) => {
|
|
610
|
+
const key = /^\s*([A-Za-z_$][\w$]*)/.exec(matched)?.[1] ?? "";
|
|
611
|
+
return /^[A-Z][A-Z0-9_]*$/.test(key) && /^[a-z]+(?:[A-Z][a-z0-9]*)+$/.test(payload) && key.replace(/_/g, "").toLowerCase() === payload.toLowerCase();
|
|
612
|
+
};
|
|
613
|
+
var assignedKey = (matched) => (/([A-Za-z_$][\w$-]*)["']?\s*[:=]/.exec(matched)?.[1] ?? "").toLowerCase();
|
|
614
|
+
var namesAnotherObject = (matched, payload) => {
|
|
615
|
+
const key = assignedKey(matched);
|
|
616
|
+
const value = payload.trim().replace(/^["']|["']$/g, "");
|
|
617
|
+
if (/^(?:tls|existing)secret$|secret(?:name|ref)$/.test(key) && /^[a-z0-9](?:[-a-z0-9]*[a-z0-9])?$/.test(value) && value.includes("-")) {
|
|
618
|
+
return true;
|
|
619
|
+
}
|
|
620
|
+
return /^(?:field|column|col|param|key|label|attr|prop|header)_/.test(key) && /^[A-Za-z_]+$/.test(value);
|
|
621
|
+
};
|
|
622
|
+
var isBenignEmpty = (content, start) => {
|
|
623
|
+
const lineStart = content.lastIndexOf("\n", start - 1) + 1;
|
|
624
|
+
const before = content.slice(lineStart, start);
|
|
625
|
+
if (/\?\s*[\w$.]*\s*$/.test(before) && /\?/.test(before)) return true;
|
|
626
|
+
return /^\s*(?:private|protected|public)\s+(?!static\b)(?:final\s+)?String\s+$/.test(before);
|
|
627
|
+
};
|
|
628
|
+
var hasPemBody = (content, headerEnd) => {
|
|
629
|
+
const window = content.slice(headerEnd, headerEnd + 200);
|
|
630
|
+
const end = window.indexOf("-----END");
|
|
631
|
+
const body = (end >= 0 ? window.slice(0, end) : window).replace(/\\n|\s/g, "");
|
|
632
|
+
if (/[A-Za-z0-9+/=]{40,}/.test(body)) return true;
|
|
633
|
+
return !(end >= 0 || /^(?:\.{3}|…)/.test(body));
|
|
634
|
+
};
|
|
592
635
|
var rule = {
|
|
593
636
|
id: "general/no-hardcoded-secret",
|
|
637
|
+
// v15: route constants using the PWD abbreviation (CHANGE_PWD: 'change-password')
|
|
638
|
+
// are semantic key echoes, not stored passwords.
|
|
639
|
+
// v14: a key that NAMES another object (Helm `tlsSecret: my-tls`, `FIELD_PASSWORD = "FieldName"`).
|
|
640
|
+
// v13: a PEM private-key header only fires when key material follows (hasPemBody).
|
|
641
|
+
// v12 (UBCK, 2026-09-25): v11's browser-only skip extends to Angular TS/JS; an empty-password
|
|
642
|
+
// match on a ternary else-branch or a non-static Java field default is skipped; generic patterns
|
|
643
|
+
// skip dotted UPPER_SNAKE i18n keys and `CONST_NAME: 'constName'` echoes.
|
|
594
644
|
// v11: skip the EMPTY-password patterns in a Vue SFC ([ADR-0093]). A `.vue` component only ever
|
|
595
645
|
// runs in the browser, so `passWord: ''` in its `data()` is a form field being reset, never a
|
|
596
646
|
// credential a server authenticates with. Measured on mcdt_bqp: 54 of 54 hits were exactly that
|
|
@@ -615,12 +665,13 @@ var rule = {
|
|
|
615
665
|
// v2 (1.2.1): added FIELD_NAME_ECHOES filter for enum-value / label-dict
|
|
616
666
|
// FPs (e.g. `PASSWORD = 'password'`). Bumped so the rule cache invalidates
|
|
617
667
|
// stale v1 findings — Phase 9 cache key is (id, version, file.hash).
|
|
618
|
-
version:
|
|
668
|
+
version: 15,
|
|
619
669
|
kind: "static-ts",
|
|
620
670
|
title: "Kh\xF4ng hardcode secrets / API keys / private keys v\xE0o source",
|
|
621
671
|
description: "Qu\xE9t credentials, API keys, tokens, private keys committed v\xE0o code. H\u1ED7 tr\u1EE3 AWS / GitHub / GitLab / Slack / Stripe / Google / Azure / Twilio / SendGrid / Mailgun / NPM / PyPI / Discord / Telegram / DataDog / New Relic / Cloudflare / DigitalOcean / Docker Hub + PEM private keys + connection strings c\xF3 inline credentials + JWT + generic password/secret/apiKey assignments. Severity = error (CI gate). Confidence t\u1EEB 65 (generic, c\xF3 false positive) t\u1EDBi 95 (provider-prefixed, near-zero false positive). Tune qua options.disabledPatterns + options.extraPatterns.",
|
|
622
672
|
severity: "error",
|
|
623
673
|
category: "security",
|
|
674
|
+
checklistIds: ["23"],
|
|
624
675
|
// Pure content scan: can run on YAML and text-classified config files.
|
|
625
676
|
languages: ["typescript", "javascript", "java", "xml", "yaml", "text", "shell"],
|
|
626
677
|
scope: "general",
|
|
@@ -635,11 +686,9 @@ var rule = {
|
|
|
635
686
|
if (isOwnTestFile(ctx.file.path)) return [];
|
|
636
687
|
const disabled = new Set(ctx.options.disabledPatterns);
|
|
637
688
|
const extras = compileExtra(ctx.options.extraPatterns, ctx.logger);
|
|
638
|
-
const clientOnly = ctx.file.path.
|
|
689
|
+
const clientOnly = isClientOnly(ctx.file.path, ctx.file.language);
|
|
639
690
|
const patterns = [
|
|
640
|
-
...BUILTIN_PATTERNS.filter(
|
|
641
|
-
(p) => !disabled.has(p.name) && !(clientOnly && EMPTY_PASSWORD_PATTERNS.has(p.name))
|
|
642
|
-
),
|
|
691
|
+
...BUILTIN_PATTERNS.filter((p) => !disabled.has(p.name)),
|
|
643
692
|
...!disabled.has(HTTP_URL_SECRET_PATTERN.name) ? [HTTP_URL_SECRET_PATTERN] : [],
|
|
644
693
|
...isConfigLanguage(ctx.file.language) ? CONFIG_SECRET_PATTERNS.filter((p) => !disabled.has(p.name)) : [],
|
|
645
694
|
...ctx.file.language === "xml" ? XML_SECRET_PATTERNS.filter((p) => !disabled.has(p.name)) : [],
|
|
@@ -662,7 +711,21 @@ var rule = {
|
|
|
662
711
|
if (overlapsReported(matchStart, matchEnd)) continue;
|
|
663
712
|
const payload = pattern.payloadGroup !== void 0 ? match[pattern.payloadGroup] : match[0];
|
|
664
713
|
const encrypted = payload !== void 0 && /^(?:ENC\(|\{cipher\})/i.test(payload.trim());
|
|
665
|
-
|
|
714
|
+
const keyValue = pattern.keyGroup !== void 0 ? match[pattern.keyGroup] ?? void 0 : void 0;
|
|
715
|
+
const isKeySelfEcho = payload !== void 0 && keyValue !== void 0 && normalizeKeyish(payload) === normalizeKeyish(keyValue);
|
|
716
|
+
const isRouteAliasEcho = payload !== void 0 && keyValue !== void 0 && /^[A-Z][A-Z0-9_]*_PWD$/.test(keyValue) && looksLikeRoutePath(payload) && normalizeKeyish(payload) === normalizeKeyish(keyValue.replace(/_PWD$/, "_PASSWORD"));
|
|
717
|
+
const isCamelCaseKey = keyValue !== void 0 && /[a-z][A-Z]/.test(keyValue);
|
|
718
|
+
if (payload && (looksLikePlaceholder(payload) || isFieldNameEcho(payload) && pattern.name.startsWith("generic-") || looksLikeRoutePath(payload) && pattern.name.startsWith("generic-") && isCamelCaseKey || isKeySelfEcho && pattern.name.startsWith("generic-") || isRouteAliasEcho && pattern.name.startsWith("generic-") || looksExternalized(payload) && !(encrypted && ctx.options.inspectEncryptedValues) || pattern.name === "config-secret-assignment" && /^(?:true|false|null|~)?$/i.test(payload.trim()) || pattern.name.startsWith("generic-") && (isI18nKey(payload) || isConstantNameEcho(match[0], payload)) || (pattern.name.startsWith("generic-") || pattern.name === "config-secret-assignment") && namesAnotherObject(match[0], payload))) {
|
|
719
|
+
continue;
|
|
720
|
+
}
|
|
721
|
+
if (EMPTY_PASSWORD_PATTERNS.has(pattern.name)) {
|
|
722
|
+
if (isBenignEmpty(content, matchStart)) continue;
|
|
723
|
+
if (clientOnly) {
|
|
724
|
+
const key = pattern.keyGroup !== void 0 ? match[pattern.keyGroup] ?? "" : "";
|
|
725
|
+
if (!SERVICE_QUALIFIED_CREDENTIAL_RE.test(key)) continue;
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
if (pattern.name.startsWith("private-key") && !hasPemBody(content, matchEnd)) {
|
|
666
729
|
continue;
|
|
667
730
|
}
|
|
668
731
|
const { line, column } = lineColAt(content, matchStart);
|
|
@@ -11,6 +11,7 @@ var rule = {
|
|
|
11
11
|
description: "Ph\xE1t hi\u1EC7n li\xEAn k\u1EBFt ho\u1EB7c t\xE0i nguy\xEAn ngo\u1EA1i b\u1ED9 (<a href>, <script src>, <link href>) s\u1EED d\u1EE5ng giao th\u1EE9c cleartext http:// thay v\xEC https://. D\u1EEF li\u1EC7u truy\u1EC1n t\u1EA3i c\xF3 nguy c\u01A1 b\u1ECB nghe l\xE9n, gi\u1EA3 m\u1EA1o ho\u1EB7c t\u1EA5n c\xF4ng Man-In-The-Middle (CWE-319).",
|
|
12
12
|
severity: "warning",
|
|
13
13
|
category: "security",
|
|
14
|
+
sourceTools: ["fortify"],
|
|
14
15
|
languages: ["html"],
|
|
15
16
|
scope: "general",
|
|
16
17
|
requires: "text",
|
|
@@ -2,6 +2,7 @@ import { isExcludedHost } from '@code-sentinel/parsers';
|
|
|
2
2
|
|
|
3
3
|
// builtin-rules/static/general/no-insecure-password-submission.rule.ts
|
|
4
4
|
var HTML_FILE_RE = /\.(?:html|htm|jsp|xhtml|ftl)$/i;
|
|
5
|
+
var SUBMIT_INTERCEPTOR_RE = /\(\s*(?:ngSubmit|ngForm)\s*\)[\s=]|ngNoForm|\[\(ngSubmit\)\]|onsubmit\s*=\s*["'][^"']*preventDefault|\(\s*ngSubmit\s*=/i;
|
|
5
6
|
var lineColumnAt = (content, index) => {
|
|
6
7
|
const safeIndex = Math.max(0, Math.min(index, content.length));
|
|
7
8
|
const before = content.slice(0, safeIndex);
|
|
@@ -10,12 +11,13 @@ var lineColumnAt = (content, index) => {
|
|
|
10
11
|
};
|
|
11
12
|
var rule = {
|
|
12
13
|
id: "general/no-insecure-password-submission",
|
|
13
|
-
version:
|
|
14
|
+
version: 4,
|
|
14
15
|
kind: "static-ts",
|
|
15
16
|
title: "Kh\xF4ng submit m\u1EADt kh\u1EA9u qua HTTP cleartext ho\u1EB7c method GET",
|
|
16
|
-
description: 'Form nh\u1EADp m\u1EADt kh\u1EA9u g\u1EEDi d\u1EEF li\u1EC7u qua HTTP kh\xF4ng m\xE3 h\xF3a (CWE-319, WSTG-ATHN-01)
|
|
17
|
+
description: 'Form nh\u1EADp m\u1EADt kh\u1EA9u g\u1EEDi d\u1EEF li\u1EC7u qua HTTP kh\xF4ng m\xE3 h\xF3a (CWE-319, WSTG-ATHN-01), d\xF9ng method="GET" (CWE-598), khai b\xE1o formaction HTTP cleartext, ho\u1EB7c kh\xF4ng c\xF3 `action` m\xE0 c\u0169ng kh\xF4ng c\xF3 handler ch\u1EB7n submit \u2014 tr\u01B0\u1EDDng h\u1EE3p cu\u1ED1i khi\u1EBFn tr\xECnh duy\u1EC7t GET v\u1EC1 ch\xEDnh URL v\xE0 l\u1ED9 m\u1EADt kh\u1EA9u tr\xEAn query string/log m\xE1y ch\u1EE7.',
|
|
17
18
|
severity: "error",
|
|
18
19
|
category: "security",
|
|
20
|
+
sourceTools: ["fortify"],
|
|
19
21
|
languages: ["html", "text"],
|
|
20
22
|
scope: "general",
|
|
21
23
|
requires: "text",
|
|
@@ -51,6 +53,24 @@ var rule = {
|
|
|
51
53
|
});
|
|
52
54
|
}
|
|
53
55
|
}
|
|
56
|
+
const formActionMatch = formBody.match(
|
|
57
|
+
/<button\b[^>]*\bformaction\s*=\s*["'](http:\/\/[^"'\s>]+)["']/i
|
|
58
|
+
);
|
|
59
|
+
if (formActionMatch) {
|
|
60
|
+
const url = formActionMatch[1] ?? "";
|
|
61
|
+
const host = /^http:\/\/([A-Za-z0-9._\-]+(?::\d+)?)/i.exec(url)?.[1] ?? "";
|
|
62
|
+
if (host && !isExcludedHost(host)) {
|
|
63
|
+
const { line, column } = lineColumnAt(content, matchIndex);
|
|
64
|
+
findings.push({
|
|
65
|
+
message: `N\xFAt submit c\u1EE7a form m\u1EADt kh\u1EA9u khai b\xE1o formaction HTTP cleartext: ${url} (CWE-319).`,
|
|
66
|
+
file: file.path,
|
|
67
|
+
range: { line, column },
|
|
68
|
+
severity: "error",
|
|
69
|
+
confidence: 85,
|
|
70
|
+
suggestion: "B\u1ECF `formaction` ho\u1EB7c tr\u1ECF t\u1EDBi endpoint HTTPS c\xF3 ch\u1EE9ng ch\u1EC9 CA h\u1EE3p l\u1EC7."
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
54
74
|
const methodMatch = formAttrs.match(/\bmethod\s*=\s*["']get["']/i);
|
|
55
75
|
if (methodMatch) {
|
|
56
76
|
const { line, column } = lineColumnAt(content, matchIndex);
|
|
@@ -63,6 +83,18 @@ var rule = {
|
|
|
63
83
|
suggestion: 'S\u1EED d\u1EE5ng method="POST" \u0111\u1EC3 truy\u1EC1n th\xF4ng tin x\xE1c th\u1EF1c trong request body.'
|
|
64
84
|
});
|
|
65
85
|
}
|
|
86
|
+
const postsExplicitly = /\bmethod\s*=\s*["']post["']/i.test(formAttrs);
|
|
87
|
+
if (!/\baction\s*=/i.test(formAttrs) && !methodMatch && !postsExplicitly && !SUBMIT_INTERCEPTOR_RE.test(formAttrs) && !SUBMIT_INTERCEPTOR_RE.test(formBody)) {
|
|
88
|
+
const { line, column } = lineColumnAt(content, matchIndex);
|
|
89
|
+
findings.push({
|
|
90
|
+
message: "Form ch\u1EE9a \xF4 m\u1EADt kh\u1EA9u nh\u01B0ng kh\xF4ng c\xF3 `action` v\xE0 kh\xF4ng c\xF3 handler submit \u2192 tr\xECnh duy\u1EC7t g\u1EEDi m\u1EB7c \u0111\u1ECBnh b\u1EB1ng GET t\u1EDBi ch\xEDnh URL hi\u1EC7n t\u1EA1i, l\xE0m l\u1ED9 m\u1EADt kh\u1EA9u tr\xEAn query string v\xE0 log m\xE1y ch\u1EE7 (CWE-598).",
|
|
91
|
+
file: file.path,
|
|
92
|
+
range: { line, column },
|
|
93
|
+
severity: "error",
|
|
94
|
+
confidence: 80,
|
|
95
|
+
suggestion: 'Khai b\xE1o `method="post"` v\xE0 `action` tr\u1ECF t\u1EDBi endpoint HTTPS, ho\u1EB7c ch\u1EAFc ch\u1EAFn framework \u0111\xE3 ch\u1EB7n submit qua `(ngSubmit)`/`preventDefault()`.'
|
|
96
|
+
});
|
|
97
|
+
}
|
|
66
98
|
}
|
|
67
99
|
m = formRe.exec(content);
|
|
68
100
|
}
|
|
@@ -78,6 +78,7 @@ var rule = {
|
|
|
78
78
|
description: "Ph\xE1t hi\u1EC7n jQuery.html(), innerHTML/outerHTML, insertAdjacentHTML(), document.write() v\xE0 v-html c\u1EE7a Vue nh\u1EADn gi\xE1 tr\u1ECB \u0111\u1ED9ng. \u0110\xE2y l\xE0 HTML Injection; n\u1EBFu gi\xE1 tr\u1ECB \u0111\u01B0\u1EE3c l\u01B0u v\xE0 hi\u1EC3n th\u1ECB l\u1EA1i th\xEC c\xF3 th\u1EC3 l\xE0 Stored XSS.",
|
|
79
79
|
severity: "warning",
|
|
80
80
|
category: "security",
|
|
81
|
+
checklistIds: ["99"],
|
|
81
82
|
languages: ["typescript", "javascript", "html"],
|
|
82
83
|
scope: "general",
|
|
83
84
|
requires: "syntactic",
|
|
@@ -165,6 +165,7 @@ var rule = {
|
|
|
165
165
|
description: "Symbol \u0111\u01B0\u1EE3c export nh\u01B0ng kh\xF4ng c\xF3 file n\xE0o trong project import l\u1EA1i. Conservative: b\u1ECF qua export ki\u1EC3u (interface/type/enum \u2014 m\u1EB7c \u0111\u1ECBnh, v\xEC \u0111\xF3 l\xE0 h\u1EE3p \u0111\u1ED3ng d\xF9ng chung), wildcard re-export targets, default exports, orphan files, v\xE0 c\xE1c file public-API/entry-point/h\u1EE3p \u0111\u1ED3ng (index.ts, public-api.ts, *.module.ts, *.routes.ts, *.types.ts, *.interface.ts, *.const.ts, *.model.ts, *.d.ts, ...). \u26A0 CH\u1EC8 \u0111\xE1ng tin khi qu\xE9t TO\xC0N d\u1EF1 \xE1n: \u0111\u1ED3 th\u1ECB ch\u1EC9 ch\u1EE9a file \u0111\u01B0\u1EE3c qu\xE9t, n\xEAn qu\xE9t m\u1ED9t th\u01B0 m\u1EE5c con s\u1EBD l\xE0m m\u1ECDi export \u1EDF bi\xEAn module tr\xF4ng nh\u01B0 kh\xF4ng ai d\xF9ng.",
|
|
166
166
|
severity: "info",
|
|
167
167
|
category: "maintainability",
|
|
168
|
+
checklistIds: ["6"],
|
|
168
169
|
languages: ["typescript", "javascript"],
|
|
169
170
|
scope: "general",
|
|
170
171
|
requires: "semantic-ts",
|
|
@@ -9,6 +9,7 @@ var rule = {
|
|
|
9
9
|
description: "Ph\xE1t hi\u1EC7n password/token/secret/PII b\u1ECB \u0111\u01B0a v\xE0o Java logger, System.out/System.err, ho\u1EB7c browser console. D\xF9ng c\xF9ng b\u1EB1ng ch\u1EE9ng v\u1EDBi `cs assess` checklist #83 (CWE-532).",
|
|
10
10
|
severity: "warning",
|
|
11
11
|
category: "security",
|
|
12
|
+
sourceTools: ["fortify"],
|
|
12
13
|
languages: ["java", "typescript", "javascript"],
|
|
13
14
|
scope: "general",
|
|
14
15
|
requires: "syntactic",
|
|
@@ -9,6 +9,7 @@ var rule = {
|
|
|
9
9
|
description: "Ki\u1EC3m tra dependency spring-boot-devtools. Profile pentest ghi nh\u1EADn c\u1EA3 optional/developmentOnly \u0111\u1EC3 review profile build, JAR/WAR v\xE0 runtime; khai b\xE1o dependency ch\u01B0a ch\u1EE9ng minh DevTools \u0111ang b\u1EADt production.",
|
|
10
10
|
severity: "error",
|
|
11
11
|
category: "security",
|
|
12
|
+
sourceTools: ["fortify"],
|
|
12
13
|
languages: ["xml", "text"],
|
|
13
14
|
scope: "spring-boot",
|
|
14
15
|
requires: "text",
|
|
@@ -72,6 +72,7 @@ var rule = {
|
|
|
72
72
|
description: "`SimpleDateFormat`/`DateFormat`/`NumberFormat`/`DecimalFormat`/`Calendar` KH\xD4NG thread-safe (`format`/`parse` mutate state n\u1ED9i b\u1ED9). \u0110\u1EB7t ch\xFAng l\xE0m field `static` (d\xF9ng chung to\xE0n process) ho\u1EB7c field instance c\u1EE7a m\u1ED9t Spring bean singleton (`@Service`/`@Component`/\u2026 ph\u1EE5c v\u1EE5 m\u1ECDi request \u0111\u1ED3ng th\u1EDDi) \u2192 hai lu\u1ED3ng d\xF9ng chung m\u1ED9t instance s\u1EBD ph\xE1 k\u1EBFt qu\u1EA3 c\u1EE7a nhau (ng\xE0y sai, `NumberFormatException`, l\u1ED7i ng\u1EABu nhi\xEAn ch\u1EC9 xu\u1EA5t hi\u1EC7n d\u01B0\u1EDBi t\u1EA3i). Kh\u1EAFc ph\u1EE5c: d\xF9ng `DateTimeFormatter` (java.time, immutable + thread-safe), `ThreadLocal<SimpleDateFormat>`, ho\u1EB7c t\u1EA1o instance c\u1EE5c b\u1ED9 m\u1ED7i l\u1EA7n d\xF9ng. T\u01B0\u01A1ng \u0111\u01B0\u01A1ng SonarQube S2885 / SpotBugs STCAL.",
|
|
73
73
|
severity: "warning",
|
|
74
74
|
category: "thread-safety",
|
|
75
|
+
sourceTools: ["sonarqube"],
|
|
75
76
|
languages: ["java"],
|
|
76
77
|
scope: "spring-boot",
|
|
77
78
|
requires: "syntactic",
|
|
@@ -31,6 +31,7 @@ var rule = {
|
|
|
31
31
|
description: "G\u1ECDi `LocalDateTime.now()`, `new Date()`, `Calendar.getInstance()` kh\xF4ng truy\u1EC1n `Clock` ho\u1EB7c `ZoneId` ng\u1EA7m s\u1EED d\u1EE5ng m\xFAi gi\u1EDD c\u1EE7a m\xE1y ch\u1EE7. Khi ch\u1EA1y tr\xEAn m\xF4i tr\u01B0\u1EDDng Cloud/K8s c\xF3 m\xFAi gi\u1EDD UTC, \u0111i\u1EC1u n\xE0y d\u1EABn \u0111\u1EBFn sai l\u1EC7ch d\u1EEF li\u1EC7u ng\xE0y gi\u1EDD v\xE0 kh\xF4ng th\u1EC3 mock khi vi\u1EBFt test.",
|
|
32
32
|
severity: "warning",
|
|
33
33
|
category: "correctness",
|
|
34
|
+
sourceTools: ["sonarqube"],
|
|
34
35
|
languages: ["java"],
|
|
35
36
|
scope: "spring-boot",
|
|
36
37
|
requires: "syntactic",
|
|
@@ -83,6 +83,7 @@ var rule = {
|
|
|
83
83
|
description: "Kh\xF4ng c\xF3 @Valid \u2192 Spring skip JSR-303 validation; input kh\xF4ng h\u1EE3p l\u1EC7 (null fields, out-of-range, missing email) s\u1EBD chui v\xE0o service layer. Security + data integrity risk.",
|
|
84
84
|
severity: "error",
|
|
85
85
|
category: "security",
|
|
86
|
+
checklistIds: ["78", "79"],
|
|
86
87
|
languages: ["java"],
|
|
87
88
|
scope: "spring-boot",
|
|
88
89
|
requires: "syntactic",
|