@neuralaxis/vibedoctor 0.1.2 → 0.2.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/README.md +215 -102
- package/dist/adapters/biome.d.ts +1 -1
- package/dist/adapters/biome.js +7 -4
- package/dist/adapters/coveragePy.js +3 -0
- package/dist/adapters/deptry.js +21 -2
- 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/knip.js +29 -4
- package/dist/adapters/lizard.d.ts +1 -1
- package/dist/adapters/lizard.js +51 -2
- package/dist/adapters/osvScanner.js +14 -2
- package/dist/adapters/presidio.js +3 -1
- package/dist/adapters/privacyDetector.d.ts +24 -1
- package/dist/adapters/privacyDetector.js +91 -7
- package/dist/adapters/ruff.d.ts +1 -1
- package/dist/adapters/ruff.js +4 -1
- package/dist/adapters/semgrep.d.ts +1 -1
- package/dist/adapters/semgrep.js +17 -3
- package/dist/adapters/shared.d.ts +7 -0
- package/dist/adapters/shared.js +22 -0
- package/dist/adapters/tsc.js +43 -18
- package/dist/adapters/vulture.d.ts +1 -1
- package/dist/adapters/vulture.js +25 -6
- package/dist/agentPack/templates/index.js +7 -4
- package/dist/agentPack/templates/skills.js +156 -44
- package/dist/cli/commands/agentPlan.js +9 -1
- package/dist/cli/commands/dpdp.d.ts +35 -0
- package/dist/cli/commands/dpdp.js +103 -0
- package/dist/cli/commands/init.js +12 -4
- package/dist/cli/commands/scan.d.ts +1 -1
- package/dist/cli/commands/scan.js +8 -1
- package/dist/cli/commands/setup.js +4 -2
- package/dist/cli/commands/tool.d.ts +4 -0
- package/dist/cli/commands/tool.js +11 -0
- package/dist/cli/index.js +96 -0
- package/dist/core/config.d.ts +27 -0
- package/dist/core/config.js +118 -5
- package/dist/core/engine.d.ts +32 -1
- package/dist/core/engine.js +195 -30
- package/dist/core/finding.d.ts +1 -1
- package/dist/core/finding.js +1 -0
- package/dist/core/projectDetector.d.ts +1 -1
- package/dist/core/projectDetector.js +29 -12
- package/dist/core/scanPlanner.js +10 -2
- package/dist/core/toolRunner.d.ts +1 -0
- package/dist/core/toolRunner.js +73 -11
- 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 +347 -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 +14 -0
- package/dist/dpdp/findings.js +99 -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 +31 -0
- package/dist/dpdp/scoring.js +211 -0
- package/dist/dpdp/types.d.ts +294 -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/mcp/tools/shared.js +8 -1
- package/dist/reporters/agent.js +8 -0
- package/dist/reporters/html.js +4 -2
- package/dist/reporters/json.js +8 -1
- package/dist/reporters/markdown.js +8 -1
- package/package.json +9 -2
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Finding } from "../core/finding";
|
|
2
|
+
import type { ControlResult, EvidenceItem } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* Build a stable, masked snippet for fingerprinting.
|
|
5
|
+
* When present, fingerprintFinding omits startLine so line-only moves do not thrash baselines.
|
|
6
|
+
*/
|
|
7
|
+
export declare function stableDpdpFindingSnippet(result: ControlResult, primary: EvidenceItem | undefined): string;
|
|
8
|
+
export declare function controlResultsToFindings(results: ControlResult[], evidenceById: Map<string, EvidenceItem>): Finding[];
|
|
9
|
+
/**
|
|
10
|
+
* Sync control `isNew` from baselined findings.
|
|
11
|
+
* Controls without a finding (not VIOLATED/PARTIAL/ERROR) keep isNew=false after baseline is applied
|
|
12
|
+
* so they do not look like "new issues" in matrices.
|
|
13
|
+
*/
|
|
14
|
+
export declare function syncControlIsNewFromFindings(controls: ControlResult[], findings: Finding[], baselineEnabled: boolean): ControlResult[];
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.stableDpdpFindingSnippet = stableDpdpFindingSnippet;
|
|
4
|
+
exports.controlResultsToFindings = controlResultsToFindings;
|
|
5
|
+
exports.syncControlIsNewFromFindings = syncControlIsNewFromFindings;
|
|
6
|
+
const STATUS_TO_INCLUDE = new Set(["VIOLATED", "PARTIAL", "ERROR"]);
|
|
7
|
+
/**
|
|
8
|
+
* Build a stable, masked snippet for fingerprinting.
|
|
9
|
+
* When present, fingerprintFinding omits startLine so line-only moves do not thrash baselines.
|
|
10
|
+
*/
|
|
11
|
+
function stableDpdpFindingSnippet(result, primary) {
|
|
12
|
+
return [
|
|
13
|
+
result.controlId,
|
|
14
|
+
result.status,
|
|
15
|
+
primary?.file ?? "repo",
|
|
16
|
+
primary?.field ?? primary?.symbol ?? "",
|
|
17
|
+
// Prefer classified summary over free-form explanation drift where possible
|
|
18
|
+
primary?.summary ?? result.explanation
|
|
19
|
+
]
|
|
20
|
+
.join("|")
|
|
21
|
+
.slice(0, 400);
|
|
22
|
+
}
|
|
23
|
+
function controlResultsToFindings(results, evidenceById) {
|
|
24
|
+
const findings = [];
|
|
25
|
+
for (const result of results) {
|
|
26
|
+
if (!STATUS_TO_INCLUDE.has(result.status)) {
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
const primary = result.evidenceIds.map((id) => evidenceById.get(id)).find(Boolean);
|
|
30
|
+
const severity = result.status === "VIOLATED"
|
|
31
|
+
? result.severity
|
|
32
|
+
: result.status === "ERROR"
|
|
33
|
+
? "medium"
|
|
34
|
+
: result.severity === "critical"
|
|
35
|
+
? "high"
|
|
36
|
+
: result.severity;
|
|
37
|
+
const snippet = primary?.snippet ?? stableDpdpFindingSnippet(result, primary);
|
|
38
|
+
findings.push({
|
|
39
|
+
id: `dpdp:${result.controlId}:${result.status}:${primary?.file ?? "repo"}:${primary?.line ?? 0}`,
|
|
40
|
+
source: "dpdp",
|
|
41
|
+
category: "privacy",
|
|
42
|
+
severity,
|
|
43
|
+
confidence: result.confidence,
|
|
44
|
+
title: `DPDP ${result.status}: ${result.title}`,
|
|
45
|
+
message: result.explanation,
|
|
46
|
+
file: primary?.file,
|
|
47
|
+
startLine: primary?.line,
|
|
48
|
+
isNew: result.isNew,
|
|
49
|
+
isAutofixable: false,
|
|
50
|
+
safeToAutofix: false,
|
|
51
|
+
agentInstruction: result.remediation,
|
|
52
|
+
tags: ["dpdp", result.controlId, result.domain, result.status.toLowerCase(), result.verificationClass.toLowerCase()],
|
|
53
|
+
evidence: {
|
|
54
|
+
detector: "dpdp",
|
|
55
|
+
// Always set snippet so fingerprints prefer content hash over line number
|
|
56
|
+
snippet,
|
|
57
|
+
fieldPath: primary?.field,
|
|
58
|
+
matchedPattern: result.controlId,
|
|
59
|
+
detectionPath: result.verificationClass,
|
|
60
|
+
reasons: [result.explanation, ...(result.limitations ?? [])],
|
|
61
|
+
recommendedAction: result.remediation,
|
|
62
|
+
rationale: result.humanReviewQuestion,
|
|
63
|
+
entityType: primary?.dataCategory,
|
|
64
|
+
sensitivity: result.severity === "critical" || result.severity === "high"
|
|
65
|
+
? result.severity === "critical"
|
|
66
|
+
? "regulated_identifier"
|
|
67
|
+
: "high"
|
|
68
|
+
: "moderate"
|
|
69
|
+
},
|
|
70
|
+
scoreImpact: 0
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
return findings;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Sync control `isNew` from baselined findings.
|
|
77
|
+
* Controls without a finding (not VIOLATED/PARTIAL/ERROR) keep isNew=false after baseline is applied
|
|
78
|
+
* so they do not look like "new issues" in matrices.
|
|
79
|
+
*/
|
|
80
|
+
function syncControlIsNewFromFindings(controls, findings, baselineEnabled) {
|
|
81
|
+
if (!baselineEnabled) {
|
|
82
|
+
return controls;
|
|
83
|
+
}
|
|
84
|
+
const findingByControl = new Map();
|
|
85
|
+
for (const finding of findings) {
|
|
86
|
+
const controlId = finding.tags.find((tag) => tag.startsWith("DPDP-"));
|
|
87
|
+
if (controlId) {
|
|
88
|
+
findingByControl.set(controlId, finding);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return controls.map((result) => {
|
|
92
|
+
const finding = findingByControl.get(result.controlId);
|
|
93
|
+
if (finding) {
|
|
94
|
+
return { ...result, isNew: finding.isNew };
|
|
95
|
+
}
|
|
96
|
+
// No open finding for this control → not a new open issue
|
|
97
|
+
return { ...result, isNew: false };
|
|
98
|
+
});
|
|
99
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { VibeDoctorConfig } from "../core/config";
|
|
2
|
+
import type { Finding, Severity } from "../core/finding";
|
|
3
|
+
import type { ControlResult, ControlStatus, VerificationClass } from "./types";
|
|
4
|
+
export type DpdpGateCandidate = {
|
|
5
|
+
controlId: string;
|
|
6
|
+
status: ControlStatus;
|
|
7
|
+
severity: Severity;
|
|
8
|
+
verificationClass: VerificationClass;
|
|
9
|
+
isNew: boolean;
|
|
10
|
+
};
|
|
11
|
+
export declare function controlToGateCandidate(control: ControlResult): DpdpGateCandidate;
|
|
12
|
+
export declare function findingToGateCandidate(finding: Finding): DpdpGateCandidate | undefined;
|
|
13
|
+
/** Shared CI policy for dedicated and normal DPDP scan entry points. */
|
|
14
|
+
export declare function evaluateDpdpFailureGate(candidates: DpdpGateCandidate[], config: VibeDoctorConfig): boolean;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.controlToGateCandidate = controlToGateCandidate;
|
|
4
|
+
exports.findingToGateCandidate = findingToGateCandidate;
|
|
5
|
+
exports.evaluateDpdpFailureGate = evaluateDpdpFailureGate;
|
|
6
|
+
function controlToGateCandidate(control) {
|
|
7
|
+
return {
|
|
8
|
+
controlId: control.controlId,
|
|
9
|
+
status: control.status,
|
|
10
|
+
severity: control.severity,
|
|
11
|
+
verificationClass: control.verificationClass,
|
|
12
|
+
isNew: control.isNew
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
function findingToGateCandidate(finding) {
|
|
16
|
+
if (finding.source !== "dpdp") {
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
const controlId = finding.tags.find((tag) => tag.startsWith("DPDP-"));
|
|
20
|
+
const statusTag = finding.tags.find((tag) => ["violated", "partial", "error"].includes(tag));
|
|
21
|
+
const verificationTag = finding.tags.find((tag) => ["deterministic", "technical_signal", "declared_evidence", "human_review"].includes(tag));
|
|
22
|
+
if (!controlId || !statusTag || !verificationTag) {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
controlId,
|
|
27
|
+
status: statusTag.toUpperCase(),
|
|
28
|
+
severity: finding.severity,
|
|
29
|
+
verificationClass: verificationTag.toUpperCase(),
|
|
30
|
+
isNew: finding.isNew
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/** Shared CI policy for dedicated and normal DPDP scan entry points. */
|
|
34
|
+
function evaluateDpdpFailureGate(candidates, config) {
|
|
35
|
+
const dpdp = config.checks.dpdp;
|
|
36
|
+
if (!dpdp.enabled) {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
const eligible = candidates.filter((candidate) => (dpdp.failOnlyOnNew ? candidate.isNew : true));
|
|
40
|
+
if (eligible.some((candidate) => candidate.status === "VIOLATED" && dpdp.failOnViolatedControls.includes(candidate.controlId))) {
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
const severities = new Set(dpdp.failOnSeverity);
|
|
44
|
+
return eligible.some((candidate) => (candidate.status === "VIOLATED" || candidate.status === "PARTIAL") &&
|
|
45
|
+
candidate.verificationClass === "DETERMINISTIC" &&
|
|
46
|
+
severities.has(candidate.severity));
|
|
47
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export * from "./types";
|
|
2
|
+
export * from "./legalSources";
|
|
3
|
+
export * from "./catalogue";
|
|
4
|
+
export * from "./context";
|
|
5
|
+
export * from "./evidence";
|
|
6
|
+
export * from "./paths";
|
|
7
|
+
export * from "./collectors";
|
|
8
|
+
export * from "./evaluators";
|
|
9
|
+
export * from "./scoring";
|
|
10
|
+
export * from "./dataMap";
|
|
11
|
+
export * from "./findings";
|
|
12
|
+
export * from "./gates";
|
|
13
|
+
export * from "./reviewQueue";
|
|
14
|
+
export * from "./artifacts";
|
|
15
|
+
export * from "./report";
|
|
16
|
+
export * from "./scan";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./types"), exports);
|
|
18
|
+
__exportStar(require("./legalSources"), exports);
|
|
19
|
+
__exportStar(require("./catalogue"), exports);
|
|
20
|
+
__exportStar(require("./context"), exports);
|
|
21
|
+
__exportStar(require("./evidence"), exports);
|
|
22
|
+
__exportStar(require("./paths"), exports);
|
|
23
|
+
__exportStar(require("./collectors"), exports);
|
|
24
|
+
__exportStar(require("./evaluators"), exports);
|
|
25
|
+
__exportStar(require("./scoring"), exports);
|
|
26
|
+
__exportStar(require("./dataMap"), exports);
|
|
27
|
+
__exportStar(require("./findings"), exports);
|
|
28
|
+
__exportStar(require("./gates"), exports);
|
|
29
|
+
__exportStar(require("./reviewQueue"), exports);
|
|
30
|
+
__exportStar(require("./artifacts"), exports);
|
|
31
|
+
__exportStar(require("./report"), exports);
|
|
32
|
+
__exportStar(require("./scan"), exports);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { LegalSourceRef } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Versioned offline legal-source baseline for reproducible DPDP technical scans.
|
|
4
|
+
* Agent reviews must verify current official sources at review time; this manifest
|
|
5
|
+
* is not proof of current law and is not legal advice.
|
|
6
|
+
*/
|
|
7
|
+
export declare const LEGAL_SOURCE_MANIFEST_VERSION = "2025.2-final-corrigendum";
|
|
8
|
+
export declare const LEGAL_SOURCES: LegalSourceRef[];
|
|
9
|
+
export declare function getLegalSource(id: string): LegalSourceRef | undefined;
|
|
10
|
+
export declare function formatLegalCitations(sourceIds: string[], sections: string[]): string[];
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LEGAL_SOURCES = exports.LEGAL_SOURCE_MANIFEST_VERSION = void 0;
|
|
4
|
+
exports.getLegalSource = getLegalSource;
|
|
5
|
+
exports.formatLegalCitations = formatLegalCitations;
|
|
6
|
+
/**
|
|
7
|
+
* Versioned offline legal-source baseline for reproducible DPDP technical scans.
|
|
8
|
+
* Agent reviews must verify current official sources at review time; this manifest
|
|
9
|
+
* is not proof of current law and is not legal advice.
|
|
10
|
+
*/
|
|
11
|
+
exports.LEGAL_SOURCE_MANIFEST_VERSION = "2025.2-final-corrigendum";
|
|
12
|
+
exports.LEGAL_SOURCES = [
|
|
13
|
+
{
|
|
14
|
+
id: "DPDP-ACT-2023",
|
|
15
|
+
title: "Digital Personal Data Protection Act, 2023",
|
|
16
|
+
version: "2023",
|
|
17
|
+
citation: "Act No. 22 of 2023 (India)",
|
|
18
|
+
notificationId: "Act No. 22 of 2023",
|
|
19
|
+
publishedAt: "2023-08-11",
|
|
20
|
+
sourceStatus: "enacted",
|
|
21
|
+
sections: [
|
|
22
|
+
"Section 2 (definitions)",
|
|
23
|
+
"Section 3 (application)",
|
|
24
|
+
"Section 4 (grounds for processing)",
|
|
25
|
+
"Section 5 (notice)",
|
|
26
|
+
"Section 6 (consent)",
|
|
27
|
+
"Section 7 (certain legitimate uses)",
|
|
28
|
+
"Section 8 (general obligations of Data Fiduciary)",
|
|
29
|
+
"Section 9 (processing of personal data of children)",
|
|
30
|
+
"Section 10 (Additional obligations of Significant Data Fiduciary)",
|
|
31
|
+
"Section 11 (Right to access information about personal data)",
|
|
32
|
+
"Section 12 (Right to correction and erasure)",
|
|
33
|
+
"Section 13 (Right of grievance redressal)",
|
|
34
|
+
"Section 14 (Right to nominate)",
|
|
35
|
+
"Section 16 (Transfer of personal data outside India)",
|
|
36
|
+
"Section 17 (exemptions)"
|
|
37
|
+
],
|
|
38
|
+
url: "https://www.meity.gov.in/static/uploads/2024/06/2bf1f0e9f04e6fb4f8fef35e82c42aa5.pdf"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
id: "DPDP-RULES-2025",
|
|
42
|
+
title: "Digital Personal Data Protection Rules, 2025",
|
|
43
|
+
version: "2025-final",
|
|
44
|
+
citation: "G.S.R. 846(E), dated 13 November 2025",
|
|
45
|
+
notificationId: "G.S.R. 846(E)",
|
|
46
|
+
publishedAt: "2025-11-14",
|
|
47
|
+
sourceStatus: "notified",
|
|
48
|
+
effectiveSchedule: [
|
|
49
|
+
"Rules 1, 2 and 17-21: on Gazette publication",
|
|
50
|
+
"Rule 4: one year after Gazette publication",
|
|
51
|
+
"Rules 3, 5-16, 22 and 23: eighteen months after Gazette publication"
|
|
52
|
+
],
|
|
53
|
+
sections: [
|
|
54
|
+
"Notice requirements",
|
|
55
|
+
"Consent manager related provisions",
|
|
56
|
+
"Security safeguards",
|
|
57
|
+
"Retention and erasure timelines",
|
|
58
|
+
"Breach intimation",
|
|
59
|
+
"Significant Data Fiduciary obligations",
|
|
60
|
+
"Children's data processing",
|
|
61
|
+
"Cross-border transfer conditions"
|
|
62
|
+
],
|
|
63
|
+
url: "https://www.meity.gov.in/static/uploads/2025/11/53450e6e5dc0bfa85ebd78686cadad39.pdf"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
id: "DPDP-CORRIGENDUM",
|
|
67
|
+
title: "DPDP corrigendum / rectification notifications",
|
|
68
|
+
version: "2025-12",
|
|
69
|
+
citation: "G.S.R. 892(E), corrigendum to G.S.R. 846(E)",
|
|
70
|
+
notificationId: "G.S.R. 892(E)",
|
|
71
|
+
publishedAt: "2025-12-12",
|
|
72
|
+
sourceStatus: "corrigendum",
|
|
73
|
+
sections: ["Corrections to the final Digital Personal Data Protection Rules, 2025"],
|
|
74
|
+
url: "https://www.meity.gov.in/documents/act-and-policies/digital-personal-data-protection-rules-2025-gDOxUjMtQWa"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
id: "DPDP-ENFORCEMENT-NOTIFICATION",
|
|
78
|
+
title: "DPDP enforcement / commencement notification",
|
|
79
|
+
version: "2025-11",
|
|
80
|
+
citation: "G.S.R. 843(E), dated 13 November 2025",
|
|
81
|
+
notificationId: "G.S.R. 843(E)",
|
|
82
|
+
publishedAt: "2025-11-14",
|
|
83
|
+
sourceStatus: "notified",
|
|
84
|
+
effectiveSchedule: [
|
|
85
|
+
"Specified institutional provisions: on Gazette publication",
|
|
86
|
+
"Section 6(9) and section 27(1)(d): one year after Gazette publication",
|
|
87
|
+
"Core processing, rights and obligation provisions: eighteen months after Gazette publication"
|
|
88
|
+
],
|
|
89
|
+
sections: ["Phased commencement of the Digital Personal Data Protection Act, 2023"],
|
|
90
|
+
url: "https://www.meity.gov.in/static/uploads/2025/11/c56ceae6c383460ca69577428d36828b.pdf"
|
|
91
|
+
}
|
|
92
|
+
];
|
|
93
|
+
function getLegalSource(id) {
|
|
94
|
+
return exports.LEGAL_SOURCES.find((source) => source.id === id);
|
|
95
|
+
}
|
|
96
|
+
function formatLegalCitations(sourceIds, sections) {
|
|
97
|
+
return [
|
|
98
|
+
...sourceIds.map((id) => {
|
|
99
|
+
const source = getLegalSource(id);
|
|
100
|
+
return source ? `${source.title} (${source.version})` : id;
|
|
101
|
+
}),
|
|
102
|
+
...sections
|
|
103
|
+
];
|
|
104
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ToolAdapterContext } from "../adapters/shared";
|
|
2
|
+
import type { DpdpCapabilityStatus } from "./types";
|
|
3
|
+
export type DpdpScanScope = "full" | "changed" | "changed-fallback-full";
|
|
4
|
+
export type DpdpCandidateResolution = {
|
|
5
|
+
/** Files to scan after include/exclude + text filters. */
|
|
6
|
+
files: string[];
|
|
7
|
+
/** How the candidate set was chosen. */
|
|
8
|
+
scope: DpdpScanScope;
|
|
9
|
+
/** Raw base set size before include/exclude (project or changed). */
|
|
10
|
+
baseFileCount: number;
|
|
11
|
+
/** Git changed file count from project context. */
|
|
12
|
+
changedFileCount: number;
|
|
13
|
+
/** Capability status for reports (changed scope / fallback). */
|
|
14
|
+
capability?: DpdpCapabilityStatus;
|
|
15
|
+
};
|
|
16
|
+
export declare function isDpdpTextCandidate(file: string): boolean;
|
|
17
|
+
export declare function normalizeDpdpPath(file: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* Resolve which repository files DPDP collectors should read.
|
|
20
|
+
*
|
|
21
|
+
* Changed mode scopes collection to `project.changedFiles` when non-empty.
|
|
22
|
+
* Empty changed set falls back to full project scope (never empty matrix).
|
|
23
|
+
* Control matrix evaluation always remains full-catalogue; only evidence collection is scoped.
|
|
24
|
+
*/
|
|
25
|
+
export declare function resolveDpdpCandidateFiles(ctx: ToolAdapterContext): DpdpCandidateResolution;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.isDpdpTextCandidate = isDpdpTextCandidate;
|
|
7
|
+
exports.normalizeDpdpPath = normalizeDpdpPath;
|
|
8
|
+
exports.resolveDpdpCandidateFiles = resolveDpdpCandidateFiles;
|
|
9
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
10
|
+
const paths_1 = require("../core/paths");
|
|
11
|
+
const TEXT_EXTENSIONS = new Set([
|
|
12
|
+
".ts",
|
|
13
|
+
".tsx",
|
|
14
|
+
".js",
|
|
15
|
+
".jsx",
|
|
16
|
+
".py",
|
|
17
|
+
".json",
|
|
18
|
+
".yml",
|
|
19
|
+
".yaml",
|
|
20
|
+
".toml",
|
|
21
|
+
".env",
|
|
22
|
+
".sql",
|
|
23
|
+
".prisma",
|
|
24
|
+
".graphql",
|
|
25
|
+
".gql",
|
|
26
|
+
".md",
|
|
27
|
+
".txt",
|
|
28
|
+
".log",
|
|
29
|
+
".csv"
|
|
30
|
+
]);
|
|
31
|
+
function isDpdpTextCandidate(file) {
|
|
32
|
+
const extension = node_path_1.default.extname(file).toLowerCase();
|
|
33
|
+
return TEXT_EXTENSIONS.has(extension) || /(^|\/)(\.env|Dockerfile|openapi)/i.test((0, paths_1.normalizeToPosix)(file));
|
|
34
|
+
}
|
|
35
|
+
function normalizeDpdpPath(file) {
|
|
36
|
+
return (0, paths_1.normalizeToPosix)(file.trim());
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Resolve which repository files DPDP collectors should read.
|
|
40
|
+
*
|
|
41
|
+
* Changed mode scopes collection to `project.changedFiles` when non-empty.
|
|
42
|
+
* Empty changed set falls back to full project scope (never empty matrix).
|
|
43
|
+
* Control matrix evaluation always remains full-catalogue; only evidence collection is scoped.
|
|
44
|
+
*/
|
|
45
|
+
function resolveDpdpCandidateFiles(ctx) {
|
|
46
|
+
const dpdpCfg = ctx.config.checks.dpdp;
|
|
47
|
+
const include = dpdpCfg.include.length > 0 ? dpdpCfg.include : ctx.config.paths.include;
|
|
48
|
+
const exclude = [...ctx.config.paths.exclude, ...dpdpCfg.exclude];
|
|
49
|
+
const projectFiles = ctx.project.projectFiles.map(normalizeDpdpPath);
|
|
50
|
+
const changedFiles = (ctx.project.changedFiles ?? []).map(normalizeDpdpPath).filter(Boolean);
|
|
51
|
+
const isChangedMode = ctx.scanMode === "changed";
|
|
52
|
+
let base = projectFiles;
|
|
53
|
+
let scope = "full";
|
|
54
|
+
let capability;
|
|
55
|
+
if (isChangedMode) {
|
|
56
|
+
if (changedFiles.length > 0) {
|
|
57
|
+
// Prefer intersection with known project files when available; keep git paths that may be new.
|
|
58
|
+
const projectSet = new Set(projectFiles);
|
|
59
|
+
const intersected = changedFiles.filter((file) => projectSet.has(file));
|
|
60
|
+
base = intersected.length > 0 ? intersected : changedFiles;
|
|
61
|
+
scope = "changed";
|
|
62
|
+
capability = {
|
|
63
|
+
id: "changed-scope",
|
|
64
|
+
status: "available",
|
|
65
|
+
message: `Scoped DPDP collection to ${base.length} changed file(s)`
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
scope = "changed-fallback-full";
|
|
70
|
+
capability = {
|
|
71
|
+
id: "changed-scope",
|
|
72
|
+
status: "skipped",
|
|
73
|
+
message: "No git changed files detected; ran full repository scope for DPDP collection"
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
const files = (0, paths_1.filterPaths)(base, include, exclude).filter(isDpdpTextCandidate).map(normalizeDpdpPath);
|
|
78
|
+
return {
|
|
79
|
+
files,
|
|
80
|
+
scope,
|
|
81
|
+
baseFileCount: base.length,
|
|
82
|
+
changedFileCount: changedFiles.length,
|
|
83
|
+
capability
|
|
84
|
+
};
|
|
85
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { DpdpScanResult } from "./types";
|
|
2
|
+
export declare function renderDpdpTerminalReport(result: DpdpScanResult): string;
|
|
3
|
+
export declare function renderDpdpMarkdownReport(result: DpdpScanResult): string;
|
|
4
|
+
export declare function renderDpdpHtmlReport(result: DpdpScanResult): string;
|
|
5
|
+
export declare function renderAgentHandoff(result: DpdpScanResult): string;
|
|
6
|
+
export declare function renderDpdpJsonReport(result: DpdpScanResult): string;
|