@neuralaxis/vibedoctor 0.1.3 → 0.2.1
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/README.md +298 -115
- package/dist/adapters/biome.js +135 -21
- package/dist/adapters/dpdp.d.ts +6 -0
- package/dist/adapters/dpdp.js +34 -0
- package/dist/adapters/index.d.ts +1 -0
- package/dist/adapters/index.js +3 -1
- package/dist/adapters/osvScanner.js +136 -17
- package/dist/adapters/presidio.js +6 -2
- package/dist/adapters/privacyDetector.d.ts +24 -1
- package/dist/adapters/privacyDetector.js +86 -2
- package/dist/adapters/shared.d.ts +6 -0
- package/dist/agentPack/templates/skills.js +159 -53
- package/dist/cli/commands/dpdp.d.ts +35 -0
- package/dist/cli/commands/dpdp.js +103 -0
- package/dist/cli/commands/init.js +105 -50
- package/dist/cli/commands/privacyReview.js +3 -4
- package/dist/cli/commands/scan.js +4 -1
- package/dist/cli/commands/setup.d.ts +13 -17
- package/dist/cli/commands/setup.js +138 -200
- package/dist/cli/index.js +84 -0
- package/dist/core/capability.d.ts +92 -0
- package/dist/core/capability.js +122 -0
- package/dist/core/config.d.ts +57 -0
- package/dist/core/config.js +194 -7
- package/dist/core/credentialHeuristics.d.ts +28 -0
- package/dist/core/credentialHeuristics.js +179 -0
- package/dist/core/engine.d.ts +21 -0
- package/dist/core/engine.js +484 -84
- package/dist/core/executable.d.ts +18 -0
- package/dist/core/executable.js +137 -0
- package/dist/core/fileRole.d.ts +24 -0
- package/dist/core/fileRole.js +125 -0
- package/dist/core/finding.d.ts +125 -1
- package/dist/core/finding.js +63 -5
- package/dist/core/findingNormalizer.d.ts +33 -0
- package/dist/core/findingNormalizer.js +171 -0
- package/dist/core/projectDetector.d.ts +13 -0
- package/dist/core/projectDetector.js +100 -15
- package/dist/core/relevance.d.ts +87 -0
- package/dist/core/relevance.js +367 -0
- package/dist/core/scanPlanner.d.ts +12 -0
- package/dist/core/scanPlanner.js +61 -29
- package/dist/core/semverLite.d.ts +27 -0
- package/dist/core/semverLite.js +163 -0
- package/dist/core/suppressions.d.ts +96 -0
- package/dist/core/suppressions.js +302 -0
- package/dist/core/toolRegistry.d.ts +58 -0
- package/dist/core/toolRegistry.js +247 -0
- package/dist/core/toolRunner.d.ts +23 -2
- package/dist/core/toolRunner.js +61 -93
- package/dist/core/toolVerification.d.ts +87 -0
- package/dist/core/toolVerification.js +370 -0
- package/dist/dpdp/artifacts.d.ts +11 -0
- package/dist/dpdp/artifacts.js +120 -0
- package/dist/dpdp/catalogue.d.ts +14 -0
- package/dist/dpdp/catalogue.js +661 -0
- package/dist/dpdp/collectors/confidence.d.ts +9 -0
- package/dist/dpdp/collectors/confidence.js +25 -0
- package/dist/dpdp/collectors/dependencies.d.ts +7 -0
- package/dist/dpdp/collectors/dependencies.js +63 -0
- package/dist/dpdp/collectors/index.d.ts +24 -0
- package/dist/dpdp/collectors/index.js +71 -0
- package/dist/dpdp/collectors/lifecycle.d.ts +2 -0
- package/dist/dpdp/collectors/lifecycle.js +202 -0
- package/dist/dpdp/collectors/optionalScanners.d.ts +14 -0
- package/dist/dpdp/collectors/optionalScanners.js +437 -0
- package/dist/dpdp/collectors/privacyBridge.d.ts +13 -0
- package/dist/dpdp/collectors/privacyBridge.js +152 -0
- package/dist/dpdp/collectors/safeguards.d.ts +5 -0
- package/dist/dpdp/collectors/safeguards.js +186 -0
- package/dist/dpdp/collectors/schema.d.ts +6 -0
- package/dist/dpdp/collectors/schema.js +122 -0
- package/dist/dpdp/collectors/shared.d.ts +10 -0
- package/dist/dpdp/collectors/shared.js +43 -0
- package/dist/dpdp/context.d.ts +28 -0
- package/dist/dpdp/context.js +195 -0
- package/dist/dpdp/dataMap.d.ts +7 -0
- package/dist/dpdp/dataMap.js +339 -0
- package/dist/dpdp/evaluators.d.ts +20 -0
- package/dist/dpdp/evaluators.js +522 -0
- package/dist/dpdp/evidence.d.ts +11 -0
- package/dist/dpdp/evidence.js +123 -0
- package/dist/dpdp/findings.d.ts +44 -0
- package/dist/dpdp/findings.js +286 -0
- package/dist/dpdp/gates.d.ts +14 -0
- package/dist/dpdp/gates.js +47 -0
- package/dist/dpdp/index.d.ts +16 -0
- package/dist/dpdp/index.js +32 -0
- package/dist/dpdp/legalSources.d.ts +10 -0
- package/dist/dpdp/legalSources.js +104 -0
- package/dist/dpdp/paths.d.ts +25 -0
- package/dist/dpdp/paths.js +85 -0
- package/dist/dpdp/report.d.ts +6 -0
- package/dist/dpdp/report.js +222 -0
- package/dist/dpdp/reviewQueue.d.ts +3 -0
- package/dist/dpdp/reviewQueue.js +88 -0
- package/dist/dpdp/scan.d.ts +26 -0
- package/dist/dpdp/scan.js +310 -0
- package/dist/dpdp/scoring.d.ts +41 -0
- package/dist/dpdp/scoring.js +237 -0
- package/dist/dpdp/types.d.ts +312 -0
- package/dist/dpdp/types.js +86 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/mcp/tools/dpdp.d.ts +11 -0
- package/dist/mcp/tools/dpdp.js +151 -0
- package/dist/mcp/tools/index.js +3 -1
- package/dist/reporters/html.js +57 -13
- package/dist/reporters/json.js +12 -1
- package/dist/reporters/markdown.js +46 -4
- package/dist/reporters/sarif.js +54 -5
- package/package.json +4 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Confidence } from "../../core/finding";
|
|
2
|
+
import type { TechnicalSignalBag } from "../types";
|
|
3
|
+
/** Whether a signal confidence meets checks.dpdp.minConfidenceToReport. */
|
|
4
|
+
export declare function confidenceMeetsThreshold(confidence: Confidence, min: Confidence): boolean;
|
|
5
|
+
/**
|
|
6
|
+
* Drop low-confidence technical signals below the DPDP threshold.
|
|
7
|
+
* Capability / skip signals are always retained.
|
|
8
|
+
*/
|
|
9
|
+
export declare function filterSignalsByConfidence(signals: TechnicalSignalBag[], min: Confidence): TechnicalSignalBag[];
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.confidenceMeetsThreshold = confidenceMeetsThreshold;
|
|
4
|
+
exports.filterSignalsByConfidence = filterSignalsByConfidence;
|
|
5
|
+
const CONFIDENCE_RANK = {
|
|
6
|
+
low: 1,
|
|
7
|
+
medium: 2,
|
|
8
|
+
high: 3
|
|
9
|
+
};
|
|
10
|
+
/** Whether a signal confidence meets checks.dpdp.minConfidenceToReport. */
|
|
11
|
+
function confidenceMeetsThreshold(confidence, min) {
|
|
12
|
+
return CONFIDENCE_RANK[confidence] >= CONFIDENCE_RANK[min];
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Drop low-confidence technical signals below the DPDP threshold.
|
|
16
|
+
* Capability / skip signals are always retained.
|
|
17
|
+
*/
|
|
18
|
+
function filterSignalsByConfidence(signals, min) {
|
|
19
|
+
return signals.filter((signal) => {
|
|
20
|
+
if (signal.kind === "skip" || signal.kind === "capability" || signal.tags.includes("capability")) {
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
return confidenceMeetsThreshold(signal.confidence, min);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { TechnicalSignalBag } from "../types";
|
|
2
|
+
export declare const EXTERNAL_PROCESSORS: Array<{
|
|
3
|
+
pattern: RegExp;
|
|
4
|
+
name: string;
|
|
5
|
+
kind: string;
|
|
6
|
+
}>;
|
|
7
|
+
export declare function collectDependencySignals(signals: TechnicalSignalBag[], file: string, content: string): void;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EXTERNAL_PROCESSORS = void 0;
|
|
4
|
+
exports.collectDependencySignals = collectDependencySignals;
|
|
5
|
+
const shared_1 = require("./shared");
|
|
6
|
+
exports.EXTERNAL_PROCESSORS = [
|
|
7
|
+
{ pattern: /\b(@sentry\/|sentry-sdk|Sentry\.init)\b/, name: "Sentry", kind: "error_tracking" },
|
|
8
|
+
{ pattern: /\b(mixpanel|segment|analytics\.track|posthog|amplitude|hotjar|fullstory)\b/i, name: "Analytics SDK", kind: "analytics" },
|
|
9
|
+
{ pattern: /\b(newrelic|datadog|@datadog|opentelemetry|otel)\b/i, name: "Telemetry platform", kind: "telemetry" },
|
|
10
|
+
{ pattern: /\b(twilio|sendgrid|@sendgrid|mailgun|ses\.send|nodemailer|msg91)\b/i, name: "Messaging provider", kind: "messaging" },
|
|
11
|
+
{ pattern: /\b(stripe|razorpay|paypal|braintree)\b/i, name: "Payment provider", kind: "payments" },
|
|
12
|
+
{ pattern: /\b(onfido|jumio|hyperverge|idfy|digilocker)\b/i, name: "Identity verification", kind: "identity" },
|
|
13
|
+
{ pattern: /\b(facebook-pixel|fbq\(|gtag\(|google-analytics|googletagmanager|adsense)\b/i, name: "Advertising SDK", kind: "advertising" },
|
|
14
|
+
{ pattern: /\b(openai|@openai|anthropic|@anthropic|google\.generativeai|vertexai|cohere|huggingface)\b/i, name: "LLM provider", kind: "llm" },
|
|
15
|
+
{ pattern: /\b(aws-sdk|@aws-sdk|@google-cloud|@azure|boto3|google\.cloud)\b/i, name: "Cloud platform", kind: "cloud" },
|
|
16
|
+
{ pattern: /\b(pinecone|weaviate|qdrant|chromadb|@pinecone|supabase)\b/i, name: "Vector/data store", kind: "vector_db" },
|
|
17
|
+
{ pattern: /\bmcpServers\b|\b@modelcontextprotocol\b/i, name: "MCP server", kind: "mcp" }
|
|
18
|
+
];
|
|
19
|
+
function collectDependencySignals(signals, file, content) {
|
|
20
|
+
const lowerFile = file.toLowerCase();
|
|
21
|
+
for (const processor of exports.EXTERNAL_PROCESSORS) {
|
|
22
|
+
if (processor.pattern.test(content)) {
|
|
23
|
+
(0, shared_1.pushSignal)(signals, {
|
|
24
|
+
kind: "external",
|
|
25
|
+
file,
|
|
26
|
+
summary: `External recipient signal: ${processor.name} (${processor.kind})`,
|
|
27
|
+
confidence: "high",
|
|
28
|
+
tags: ["external-processor", processor.kind, processor.name.toLowerCase()],
|
|
29
|
+
detectionMethod: "dependency-pattern",
|
|
30
|
+
relatedControls: ["DPDP-PROC-001", "DPDP-XBR-001", "DPDP-THIRD-001"]
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
if (/\b(region|aws_region|AWS_REGION|gcp_location|azure_location)\b/i.test(content) &&
|
|
35
|
+
/\b(us-|eu-|ap-|europe|virginia|frankfurt|singapore)\b/i.test(content)) {
|
|
36
|
+
(0, shared_1.pushSignal)(signals, {
|
|
37
|
+
kind: "external",
|
|
38
|
+
file,
|
|
39
|
+
summary: "Cross-border or multi-region configuration signal",
|
|
40
|
+
confidence: "medium",
|
|
41
|
+
tags: ["cross-border"],
|
|
42
|
+
detectionMethod: "region-config",
|
|
43
|
+
relatedControls: ["DPDP-XBR-001"]
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
if (lowerFile.endsWith("package.json") ||
|
|
47
|
+
lowerFile.endsWith("pyproject.toml") ||
|
|
48
|
+
lowerFile.endsWith("requirements.txt")) {
|
|
49
|
+
for (const processor of exports.EXTERNAL_PROCESSORS) {
|
|
50
|
+
if (processor.pattern.test(content)) {
|
|
51
|
+
(0, shared_1.pushSignal)(signals, {
|
|
52
|
+
kind: "external",
|
|
53
|
+
file,
|
|
54
|
+
summary: `Dependency indicates processor: ${processor.name}`,
|
|
55
|
+
confidence: "high",
|
|
56
|
+
tags: ["lockfile-processor", processor.kind],
|
|
57
|
+
detectionMethod: "manifest-scan",
|
|
58
|
+
relatedControls: ["DPDP-PROC-001"]
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ToolAdapterContext } from "../../adapters/shared";
|
|
2
|
+
import type { Finding } from "../../core/finding";
|
|
3
|
+
import type { DpdpCapabilityStatus, TechnicalSignalBag } from "../types";
|
|
4
|
+
import { type DpdpScanScope } from "../paths";
|
|
5
|
+
export type CollectionBundle = {
|
|
6
|
+
privacyFindings: Finding[];
|
|
7
|
+
signals: TechnicalSignalBag[];
|
|
8
|
+
filesScanned: number;
|
|
9
|
+
scope: DpdpScanScope;
|
|
10
|
+
scopeCapability?: DpdpCapabilityStatus;
|
|
11
|
+
optionalCapabilities: DpdpCapabilityStatus[];
|
|
12
|
+
candidateFiles: string[];
|
|
13
|
+
};
|
|
14
|
+
export { confidenceMeetsThreshold, filterSignalsByConfidence } from "./confidence";
|
|
15
|
+
export { classifyPrivacyFindingTags } from "./privacyBridge";
|
|
16
|
+
/**
|
|
17
|
+
* Deterministic DPDP signal collection.
|
|
18
|
+
* Orchestrates privacy bridge, optional scanners (Presidio/Semgrep, opt-out),
|
|
19
|
+
* dependencies, schema, lifecycle, and safeguard collectors.
|
|
20
|
+
*/
|
|
21
|
+
export declare function collectDpdpSignals(ctx: ToolAdapterContext, options?: {
|
|
22
|
+
optionalScannersEnabled?: boolean;
|
|
23
|
+
}): Promise<CollectionBundle>;
|
|
24
|
+
export declare function maskForDpdp(value: string, entityType: string, mask: boolean): string;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.classifyPrivacyFindingTags = exports.filterSignalsByConfidence = exports.confidenceMeetsThreshold = void 0;
|
|
4
|
+
exports.collectDpdpSignals = collectDpdpSignals;
|
|
5
|
+
exports.maskForDpdp = maskForDpdp;
|
|
6
|
+
const privacyDetector_1 = require("../../adapters/privacyDetector");
|
|
7
|
+
const paths_1 = require("../paths");
|
|
8
|
+
const confidence_1 = require("./confidence");
|
|
9
|
+
const dependencies_1 = require("./dependencies");
|
|
10
|
+
const lifecycle_1 = require("./lifecycle");
|
|
11
|
+
const optionalScanners_1 = require("./optionalScanners");
|
|
12
|
+
const privacyBridge_1 = require("./privacyBridge");
|
|
13
|
+
const safeguards_1 = require("./safeguards");
|
|
14
|
+
const schema_1 = require("./schema");
|
|
15
|
+
const shared_1 = require("./shared");
|
|
16
|
+
var confidence_2 = require("./confidence");
|
|
17
|
+
Object.defineProperty(exports, "confidenceMeetsThreshold", { enumerable: true, get: function () { return confidence_2.confidenceMeetsThreshold; } });
|
|
18
|
+
Object.defineProperty(exports, "filterSignalsByConfidence", { enumerable: true, get: function () { return confidence_2.filterSignalsByConfidence; } });
|
|
19
|
+
var privacyBridge_2 = require("./privacyBridge");
|
|
20
|
+
Object.defineProperty(exports, "classifyPrivacyFindingTags", { enumerable: true, get: function () { return privacyBridge_2.classifyPrivacyFindingTags; } });
|
|
21
|
+
/**
|
|
22
|
+
* Deterministic DPDP signal collection.
|
|
23
|
+
* Orchestrates privacy bridge, optional scanners (Presidio/Semgrep, opt-out),
|
|
24
|
+
* dependencies, schema, lifecycle, and safeguard collectors.
|
|
25
|
+
*/
|
|
26
|
+
async function collectDpdpSignals(ctx, options = {}) {
|
|
27
|
+
const privacyCfg = ctx.config.checks.privacy;
|
|
28
|
+
const dpdpCfg = ctx.config.checks.dpdp;
|
|
29
|
+
const resolution = (0, paths_1.resolveDpdpCandidateFiles)(ctx);
|
|
30
|
+
const candidates = resolution.files;
|
|
31
|
+
const { privacyFindings, signals: privacySignals } = await (0, privacyBridge_1.collectPrivacySignals)(ctx, candidates);
|
|
32
|
+
const optional = await (0, optionalScanners_1.collectOptionalScannerSignals)(ctx, candidates, {
|
|
33
|
+
enabled: options.optionalScannersEnabled
|
|
34
|
+
});
|
|
35
|
+
const signals = [...privacySignals, ...optional.signals];
|
|
36
|
+
let filesScanned = 0;
|
|
37
|
+
for (const file of candidates) {
|
|
38
|
+
const content = await (0, shared_1.readFileSafe)(ctx.root, file, privacyCfg.maxFileBytes);
|
|
39
|
+
if (!content) {
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
filesScanned += 1;
|
|
43
|
+
const lines = content.split(/\r?\n/);
|
|
44
|
+
(0, dependencies_1.collectDependencySignals)(signals, file, content);
|
|
45
|
+
(0, schema_1.collectSchemaSignals)(signals, file, content);
|
|
46
|
+
(0, lifecycle_1.collectLifecycleSignals)(signals, file, lines);
|
|
47
|
+
(0, safeguards_1.collectSafeguardSignals)(signals, file, content, lines);
|
|
48
|
+
}
|
|
49
|
+
const seen = new Set();
|
|
50
|
+
const deduped = signals.filter((signal) => {
|
|
51
|
+
const key = `${signal.kind}|${signal.file}|${signal.line}|${signal.summary}|${signal.tags.join(",")}`;
|
|
52
|
+
if (seen.has(key)) {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
seen.add(key);
|
|
56
|
+
return true;
|
|
57
|
+
});
|
|
58
|
+
const filtered = (0, confidence_1.filterSignalsByConfidence)(deduped, dpdpCfg.minConfidenceToReport);
|
|
59
|
+
return {
|
|
60
|
+
privacyFindings: [...privacyFindings, ...optional.findings],
|
|
61
|
+
signals: filtered,
|
|
62
|
+
filesScanned,
|
|
63
|
+
scope: resolution.scope,
|
|
64
|
+
scopeCapability: resolution.capability,
|
|
65
|
+
optionalCapabilities: optional.capabilities,
|
|
66
|
+
candidateFiles: candidates
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
function maskForDpdp(value, entityType, mask) {
|
|
70
|
+
return (0, privacyDetector_1.maskPiiValue)(value, entityType, mask);
|
|
71
|
+
}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.collectLifecycleSignals = collectLifecycleSignals;
|
|
4
|
+
const shared_1 = require("./shared");
|
|
5
|
+
function collectLifecycleSignals(signals, file, lines) {
|
|
6
|
+
for (const [index, line] of lines.entries()) {
|
|
7
|
+
const lineNumber = index + 1;
|
|
8
|
+
const window = (0, shared_1.windowAround)(lines, index, 3, 4);
|
|
9
|
+
if (/\b(app|router|route|fastify|express|@app\.(get|post|put|patch|delete)|APIRouter|@router\.|graphql|resolver|webhook|upload|multer|FormData|onSubmit)\b/i.test(line) &&
|
|
10
|
+
/\b(user|email|phone|profile|customer|consent|register|signup|login)\b/i.test(window)) {
|
|
11
|
+
(0, shared_1.pushSignal)(signals, {
|
|
12
|
+
kind: "collection",
|
|
13
|
+
file,
|
|
14
|
+
line: lineNumber,
|
|
15
|
+
summary: "Likely personal-data collection or handler surface",
|
|
16
|
+
confidence: "medium",
|
|
17
|
+
tags: ["collection-point"],
|
|
18
|
+
detectionMethod: "route-pattern",
|
|
19
|
+
relatedControls: ["DPDP-APP-001", "DPDP-NOTICE-001"]
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
if (/\b(consent|opt[_-]?in|accepted_terms|privacy_accepted)\b/i.test(line)) {
|
|
23
|
+
(0, shared_1.pushSignal)(signals, {
|
|
24
|
+
kind: "consent",
|
|
25
|
+
file,
|
|
26
|
+
line: lineNumber,
|
|
27
|
+
summary: "Consent capture signal",
|
|
28
|
+
confidence: "medium",
|
|
29
|
+
tags: ["consent-capture"],
|
|
30
|
+
detectionMethod: "consent-pattern",
|
|
31
|
+
relatedControls: ["DPDP-CONSENT-001", "DPDP-CONSENT-002"]
|
|
32
|
+
});
|
|
33
|
+
const metaBits = {
|
|
34
|
+
timestamp: /\b(consent_at|consented_at|consent_timestamp|given_at|created_at)\b/i.test(window),
|
|
35
|
+
purpose: /\b(purpose_id|purpose|processing_purpose)\b/i.test(window),
|
|
36
|
+
notice: /\b(notice_version|policy_version|privacy_version)\b/i.test(window)
|
|
37
|
+
};
|
|
38
|
+
if (metaBits.timestamp || metaBits.purpose || metaBits.notice) {
|
|
39
|
+
(0, shared_1.pushSignal)(signals, {
|
|
40
|
+
kind: "consent",
|
|
41
|
+
file,
|
|
42
|
+
line: lineNumber,
|
|
43
|
+
summary: `Consent metadata signals: timestamp=${metaBits.timestamp}, purpose=${metaBits.purpose}, notice=${metaBits.notice}`,
|
|
44
|
+
confidence: "medium",
|
|
45
|
+
tags: [
|
|
46
|
+
"consent-metadata",
|
|
47
|
+
metaBits.timestamp ? "has-timestamp" : "missing-timestamp",
|
|
48
|
+
metaBits.purpose ? "has-purpose" : "missing-purpose",
|
|
49
|
+
metaBits.notice ? "has-notice" : "missing-notice"
|
|
50
|
+
],
|
|
51
|
+
detectionMethod: "consent-metadata-pattern",
|
|
52
|
+
relatedControls: ["DPDP-CONSENT-002"]
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
if (/\b(withdraw[_-]?consent|revoke[_-]?consent|opt[_-]?out|unsubscribe)\b/i.test(line)) {
|
|
57
|
+
(0, shared_1.pushSignal)(signals, {
|
|
58
|
+
kind: "consent",
|
|
59
|
+
file,
|
|
60
|
+
line: lineNumber,
|
|
61
|
+
summary: "Consent withdrawal signal",
|
|
62
|
+
confidence: "high",
|
|
63
|
+
tags: ["consent-withdrawal"],
|
|
64
|
+
detectionMethod: "withdrawal-pattern",
|
|
65
|
+
relatedControls: ["DPDP-WITHDRAW-001"]
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
if (/\b(purpose_id|processing_purpose|purpose\s*[:=])\b/i.test(line)) {
|
|
69
|
+
(0, shared_1.pushSignal)(signals, {
|
|
70
|
+
kind: "consent",
|
|
71
|
+
file,
|
|
72
|
+
line: lineNumber,
|
|
73
|
+
summary: "Purpose identifier signal",
|
|
74
|
+
confidence: "medium",
|
|
75
|
+
tags: ["purpose-binding"],
|
|
76
|
+
detectionMethod: "purpose-pattern",
|
|
77
|
+
relatedControls: ["DPDP-PURPOSE-001"]
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
if (/\b(privacy[_-]?notice|notice_version|privacy[_-]?policy)\b/i.test(line)) {
|
|
81
|
+
(0, shared_1.pushSignal)(signals, {
|
|
82
|
+
kind: "collection",
|
|
83
|
+
file,
|
|
84
|
+
line: lineNumber,
|
|
85
|
+
summary: "Notice / privacy policy technical signal",
|
|
86
|
+
confidence: "medium",
|
|
87
|
+
tags: ["notice-signal"],
|
|
88
|
+
detectionMethod: "notice-pattern",
|
|
89
|
+
relatedControls: ["DPDP-NOTICE-001"]
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
if (/\b(delete[_-]?account|erase[_-]?user|hard[_-]?delete|soft[_-]?delete|destroy\(|\.delete\(|deletedAt\s*=)\b/i.test(line)) {
|
|
93
|
+
(0, shared_1.pushSignal)(signals, {
|
|
94
|
+
kind: "deletion",
|
|
95
|
+
file,
|
|
96
|
+
line: lineNumber,
|
|
97
|
+
summary: "Erasure / deletion path signal",
|
|
98
|
+
confidence: "medium",
|
|
99
|
+
tags: ["erasure-path"],
|
|
100
|
+
detectionMethod: "deletion-pattern",
|
|
101
|
+
relatedControls: ["DPDP-ERA-001", "DPDP-ERA-002"]
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
if (/\b(export[_-]?data|download[_-]?my[_-]?data|data[_-]?export|right[_-]?to[_-]?access|get[_-]?personal[_-]?data)\b/i.test(line)) {
|
|
105
|
+
(0, shared_1.pushSignal)(signals, {
|
|
106
|
+
kind: "rights",
|
|
107
|
+
file,
|
|
108
|
+
line: lineNumber,
|
|
109
|
+
summary: "Data access/export rights signal",
|
|
110
|
+
confidence: "medium",
|
|
111
|
+
tags: ["access-export"],
|
|
112
|
+
detectionMethod: "rights-pattern",
|
|
113
|
+
relatedControls: ["DPDP-ACC-RIGHT-001", "DPDP-EXPORT-001", "DPDP-REQ-001"]
|
|
114
|
+
});
|
|
115
|
+
if (!(0, shared_1.lineHasAuth)(line, window)) {
|
|
116
|
+
(0, shared_1.pushSignal)(signals, {
|
|
117
|
+
kind: "safeguard_gap",
|
|
118
|
+
file,
|
|
119
|
+
line: lineNumber,
|
|
120
|
+
summary: "Export/access endpoint without nearby authentication signal",
|
|
121
|
+
confidence: "medium",
|
|
122
|
+
tags: ["unprotected-export"],
|
|
123
|
+
detectionMethod: "export-auth-scan",
|
|
124
|
+
relatedControls: ["DPDP-EXPORT-001", "DPDP-SEC-006"]
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
if (/\b(correct[_-]?data|update[_-]?profile|rectif|fix[_-]?personal)\b/i.test(line)) {
|
|
129
|
+
(0, shared_1.pushSignal)(signals, {
|
|
130
|
+
kind: "rights",
|
|
131
|
+
file,
|
|
132
|
+
line: lineNumber,
|
|
133
|
+
summary: "Correction / profile update signal",
|
|
134
|
+
confidence: "medium",
|
|
135
|
+
tags: ["correction-path"],
|
|
136
|
+
detectionMethod: "correction-pattern",
|
|
137
|
+
relatedControls: ["DPDP-ACC-001", "DPDP-CORR-001"]
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
if (/\b(grievance|complaint|privacy@|dpo@|data[_-]?protection[_-]?officer)\b/i.test(line)) {
|
|
141
|
+
(0, shared_1.pushSignal)(signals, {
|
|
142
|
+
kind: "rights",
|
|
143
|
+
file,
|
|
144
|
+
line: lineNumber,
|
|
145
|
+
summary: "Grievance or privacy contact signal",
|
|
146
|
+
confidence: "medium",
|
|
147
|
+
tags: ["grievance"],
|
|
148
|
+
detectionMethod: "grievance-pattern",
|
|
149
|
+
relatedControls: ["DPDP-GRIEV-001", "DPDP-SDF-001"]
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
if (/\b(nominee|nomination|legal[_-]?heir)\b/i.test(line)) {
|
|
153
|
+
(0, shared_1.pushSignal)(signals, {
|
|
154
|
+
kind: "rights",
|
|
155
|
+
file,
|
|
156
|
+
line: lineNumber,
|
|
157
|
+
summary: "Nomination-related signal",
|
|
158
|
+
confidence: "medium",
|
|
159
|
+
tags: ["nomination"],
|
|
160
|
+
detectionMethod: "nomination-pattern",
|
|
161
|
+
relatedControls: ["DPDP-NOM-001"]
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
if (/\b(is[_-]?child|under[_-]?18|age[_-]?gate|parental[_-]?consent|guardian[_-]?consent|date_of_birth|age\s*[<>=])/i.test(line)) {
|
|
165
|
+
const isGuardian = /parental|guardian/i.test(line);
|
|
166
|
+
(0, shared_1.pushSignal)(signals, {
|
|
167
|
+
kind: "consent",
|
|
168
|
+
file,
|
|
169
|
+
line: lineNumber,
|
|
170
|
+
summary: isGuardian ? "Guardian/parental consent signal" : "Children's data / age gate signal",
|
|
171
|
+
confidence: "medium",
|
|
172
|
+
tags: isGuardian ? ["guardian-consent", "childrens-data"] : ["childrens-data"],
|
|
173
|
+
detectionMethod: "children-pattern",
|
|
174
|
+
relatedControls: ["DPDP-CHILD-001", "DPDP-CHILD-002"]
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
if (/\b(breach|security[_-]?incident|incident[_-]?response)\b/i.test(line)) {
|
|
178
|
+
(0, shared_1.pushSignal)(signals, {
|
|
179
|
+
kind: "protection",
|
|
180
|
+
file,
|
|
181
|
+
line: lineNumber,
|
|
182
|
+
summary: "Breach / incident preparedness signal",
|
|
183
|
+
confidence: "medium",
|
|
184
|
+
tags: ["breach-preparedness"],
|
|
185
|
+
detectionMethod: "breach-pattern",
|
|
186
|
+
relatedControls: ["DPDP-BREACH-001"]
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
if (/\b(request[_-]?id|ticket[_-]?id|rights[_-]?request|dsar)\b/i.test(line)) {
|
|
190
|
+
(0, shared_1.pushSignal)(signals, {
|
|
191
|
+
kind: "rights",
|
|
192
|
+
file,
|
|
193
|
+
line: lineNumber,
|
|
194
|
+
summary: "Rights request tracking signal",
|
|
195
|
+
confidence: "medium",
|
|
196
|
+
tags: ["rights-tracking"],
|
|
197
|
+
detectionMethod: "rights-tracking-pattern",
|
|
198
|
+
relatedControls: ["DPDP-REQ-001"]
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ToolAdapterContext } from "../../adapters/shared";
|
|
2
|
+
import type { Finding } from "../../core/finding";
|
|
3
|
+
import type { DpdpCapabilityStatus, TechnicalSignalBag } from "../types";
|
|
4
|
+
/**
|
|
5
|
+
* Run opt-out optional scanners (Presidio, Semgrep) when enabled.
|
|
6
|
+
* Missing tools are skipped — never counted as a pass.
|
|
7
|
+
*/
|
|
8
|
+
export declare function collectOptionalScannerSignals(ctx: ToolAdapterContext, candidates: string[], options?: {
|
|
9
|
+
enabled?: boolean;
|
|
10
|
+
}): Promise<{
|
|
11
|
+
signals: TechnicalSignalBag[];
|
|
12
|
+
capabilities: DpdpCapabilityStatus[];
|
|
13
|
+
findings: Finding[];
|
|
14
|
+
}>;
|