dpdp-scanner 0.0.0-stage → 1.0.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/CHANGELOG.md +6 -0
- package/LICENSE +21 -0
- package/README.md +177 -2
- package/dist/cli.js +774 -0
- package/dist/index.cjs +743 -0
- package/dist/index.d.cts +134 -0
- package/dist/index.d.ts +134 -0
- package/dist/index.js +693 -0
- package/package.json +83 -4
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 1.0.0
|
|
4
|
+
|
|
5
|
+
- First release: finds personal data in schemas and models (SQL, Prisma, GraphQL, Django, SQLAlchemy, TypeORM, Mongoose, Sequelize, Drizzle, Rails, Laravel, JSON Schema, OpenAPI) and personal data values written into files.
|
|
6
|
+
- Reports as a terminal table, Markdown personal data inventory, JSON or SARIF. `--fail-on` for CI.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 CK Giri
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,178 @@
|
|
|
1
|
-
#
|
|
1
|
+
# dpdp-scanner
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**Find the personal data in your code and database schemas.** One command lists every table and field that holds Aadhaar, PAN, phone numbers, dates of birth, addresses, bank and card details, health or biometric data, and any personal data written into your code, fixtures or seeds. Then it gives you a personal data inventory you can hand to your DPO or legal team.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/dpdp-scanner)
|
|
6
|
+
[](https://github.com/ckgiri/dpdp-scanner/actions/workflows/ci.yml)
|
|
7
|
+
[](https://github.com/ckgiri/dpdp-scanner/blob/main/LICENSE)
|
|
8
|
+
|
|
9
|
+
> **Disclaimer:** dpdp-scanner is an independent open-source project, built and maintained by an individual. It is **not an official tool** and is not affiliated with, endorsed by or connected to the Government of India, the Ministry of Electronics and Information Technology (MeitY) or the Data Protection Board of India. Its output is not legal advice. [Full disclaimer](#disclaimer).
|
|
10
|
+
|
|
11
|
+

|
|
12
|
+
|
|
13
|
+
<sub>A real run on a made-up sample app.</sub>
|
|
14
|
+
|
|
15
|
+
India's [Digital Personal Data Protection (DPDP) Act](https://www.meity.gov.in/) starts with a simple question: what personal data do you hold, and where? dpdp-scanner answers it from your code, in seconds.
|
|
16
|
+
|
|
17
|
+
- **Reads your data model.** SQL, Prisma, GraphQL, Django, SQLAlchemy, TypeORM, Mongoose, Sequelize, Drizzle, Rails, Laravel, JSON Schema and OpenAPI.
|
|
18
|
+
- **Knows Indian data.** Aadhaar, PAN, GSTIN, voter ID, UPI, IFSC, ABHA, CIBIL score and more, in `snake_case`, `camelCase` or any other style.
|
|
19
|
+
- **Finds personal data written into files.** Real-looking Aadhaar, PAN, phone, UPI and card numbers in code, fixtures, seeds and logs, checked with Verhoeff, GSTIN and Luhn checksums by [dpdp-india](https://www.npmjs.com/package/dpdp-india). Reports only ever show masked values.
|
|
20
|
+
- **Flags what matters most.** Every finding has a sensitivity (high, medium or low), and the report says what to do: never store a CVV, parental consent for anyone under 18, encrypt health data.
|
|
21
|
+
- **Reports for people and for CI.** A terminal summary, a Markdown inventory, JSON, and SARIF for GitHub's Security tab. `--fail-on high` fails the build.
|
|
22
|
+
|
|
23
|
+
## Quick start
|
|
24
|
+
|
|
25
|
+
**1. Scan your project** (no install needed)
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
npx dpdp-scanner
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**2. Save a personal data inventory**
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
npx dpdp-scanner --format markdown -o personal-data.md
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**3. Keep it from coming back in CI**
|
|
38
|
+
|
|
39
|
+
```sh
|
|
40
|
+
npx dpdp-scanner --fail-on high
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
That's it. Point it at specific folders with `npx dpdp-scanner ./prisma ./db` if you don't want the whole project.
|
|
44
|
+
|
|
45
|
+
## What it finds
|
|
46
|
+
|
|
47
|
+
**Fields in schemas and models**
|
|
48
|
+
|
|
49
|
+
| Category | Sensitivity | Field names it recognises (examples) |
|
|
50
|
+
|---|---|---|
|
|
51
|
+
| Government ID | high | `aadhaar_number`, `pan`, `gstin`, `passport_no`, `voter_id`, `dl_number`, `ration_card` |
|
|
52
|
+
| Financial | high | `card_number`, `cvv`, `bank_account_number`, `ifsc`, `upi_id`, `salary`, `cibil_score` |
|
|
53
|
+
| Health | high | `diagnosis`, `blood_group`, `prescription`, `allergies`, `disability`, `abha_number` |
|
|
54
|
+
| Biometric | high | `fingerprint`, `face_embedding`, `iris_scan`, `voice_print`, `palm_print` |
|
|
55
|
+
| Children's data | high | `guardian_name`, `parent_consent`, `is_minor` |
|
|
56
|
+
| Date of birth / age | medium | `dob`, `date_of_birth`, `birth_year`, `age` |
|
|
57
|
+
| Demographic | medium | `gender`, `religion`, `caste`, `marital_status` |
|
|
58
|
+
| Contact | medium | `email`, `mobile_no`, `phone_number`, `whatsapp` |
|
|
59
|
+
| Address | medium | `address_line_1`, `shipping_address`, `landmark`, `pincode` |
|
|
60
|
+
| Location | medium | `latitude`, `longitude`, `gps_location` |
|
|
61
|
+
| Name | medium | `first_name`, `full_name`, `father_name`, and `name` in a table of people |
|
|
62
|
+
| Online identifier | low | `ip_address`, `last_login_ip`, `imei`, `device_id` |
|
|
63
|
+
|
|
64
|
+
It's careful not to cry wolf: `company_name`, `product_name`, `bank_name`, `username`, `mac_address`, `callback_url`, a version's `minor` field, `span` and `japan` are all ignored. A bare `name` only counts in a table of people, like `users` or `patients`, not in `products`.
|
|
65
|
+
|
|
66
|
+
**Values written in files**
|
|
67
|
+
|
|
68
|
+
Aadhaar, PAN, GSTIN, voter ID, passport, phone, UPI, card and bank account numbers, checked the same way [dpdp-india](https://www.npmjs.com/package/dpdp-india) checks them. Order numbers, prices, timestamps and IDs aren't flagged.
|
|
69
|
+
|
|
70
|
+
**Where it looks**
|
|
71
|
+
|
|
72
|
+
| Format | Files |
|
|
73
|
+
|---|---|
|
|
74
|
+
| SQL | `*.sql`: `CREATE TABLE`, `ALTER TABLE … ADD COLUMN` |
|
|
75
|
+
| Prisma | `*.prisma` models |
|
|
76
|
+
| GraphQL | `*.graphql`, `*.gql` types and inputs |
|
|
77
|
+
| Django, SQLAlchemy | `*.py` models |
|
|
78
|
+
| TypeORM, Mongoose, Sequelize, Drizzle | `*.ts`, `*.js` entities, schemas and tables |
|
|
79
|
+
| Rails, Laravel | `schema.rb` and migrations, `Schema::create` migrations |
|
|
80
|
+
| JSON Schema, OpenAPI | `*.json`, `*.yaml`, `*.yml` with `properties` |
|
|
81
|
+
|
|
82
|
+
`node_modules`, `.git`, build output, lock files, minified files and binary files are skipped.
|
|
83
|
+
|
|
84
|
+
## The personal data inventory
|
|
85
|
+
|
|
86
|
+
`--format markdown` writes a document you can review, share and keep in your repo:
|
|
87
|
+
|
|
88
|
+
```md
|
|
89
|
+
# Personal data inventory
|
|
90
|
+
|
|
91
|
+
## Summary
|
|
92
|
+
|
|
93
|
+
| Category | Sensitivity | Fields | Values in files |
|
|
94
|
+
|---|---|---|---|
|
|
95
|
+
| Government ID | high | 3 | 0 |
|
|
96
|
+
| Financial | high | 3 | 0 |
|
|
97
|
+
| Contact | medium | 2 | 0 |
|
|
98
|
+
|
|
99
|
+
## Where personal data is stored
|
|
100
|
+
|
|
101
|
+
### users
|
|
102
|
+
|
|
103
|
+
`db/schema.sql` (sql)
|
|
104
|
+
|
|
105
|
+
| Field | Personal data | Category | Sensitivity | Line |
|
|
106
|
+
|---|---|---|---|---|
|
|
107
|
+
| `aadhaar_number` | Aadhaar number | Government ID | high | 7 |
|
|
108
|
+
| `pan` | PAN | Government ID | high | 8 |
|
|
109
|
+
| `email` | Email address | Contact | medium | 5 |
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
It ends with what to do about each kind of data found.
|
|
113
|
+
|
|
114
|
+
## In CI
|
|
115
|
+
|
|
116
|
+
```yaml
|
|
117
|
+
- run: npx dpdp-scanner --fail-on high --format sarif -o dpdp.sarif
|
|
118
|
+
- uses: github/codeql-action/upload-sarif@v3
|
|
119
|
+
if: always()
|
|
120
|
+
with:
|
|
121
|
+
sarif_file: dpdp.sarif
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
`--fail-on high` exits with code 1 when anything highly sensitive is found. Use `medium`, `low` or `any` to be stricter. With the SARIF upload, each finding appears in the repository's **Security** tab, on the right line.
|
|
125
|
+
|
|
126
|
+
## Options
|
|
127
|
+
|
|
128
|
+
| Option | Default | |
|
|
129
|
+
|---|---|---|
|
|
130
|
+
| `-f`, `--format` | `table` | `table`, `markdown`, `json` or `sarif` |
|
|
131
|
+
| `-o`, `--output` | | Write the report to a file |
|
|
132
|
+
| `--fail-on` | | Exit 1 when anything at this sensitivity or above is found: `high`, `medium`, `low` or `any` |
|
|
133
|
+
| `--min-confidence` | `medium` | `low` also shows ambiguous names like a bare `name` or `location`; `high` shows only clear-cut ones |
|
|
134
|
+
| `--no-values` | | Only look at schemas and models |
|
|
135
|
+
| `--no-schemas` | | Only look for values written in files |
|
|
136
|
+
| `--exclude` | | More folders or files to skip, comma-separated |
|
|
137
|
+
| `--limit` | `50` | Rows per section in the table |
|
|
138
|
+
|
|
139
|
+
**Exit codes:** `0` done, `1` `--fail-on` matched, `2` a usage error such as a path that doesn't exist.
|
|
140
|
+
|
|
141
|
+
## Use it from code
|
|
142
|
+
|
|
143
|
+
```js
|
|
144
|
+
import { writeFile } from "node:fs/promises";
|
|
145
|
+
import { scan, toMarkdown, classifyField } from "dpdp-scanner";
|
|
146
|
+
|
|
147
|
+
const report = await scan(["./prisma", "./db"]);
|
|
148
|
+
report.fields; // [{ table: "users", field: "aadhaar_number", category: "government-id", sensitivity: "high", file, line, … }]
|
|
149
|
+
report.values; // [{ type: "pan", preview: "******234F", file, line, … }]
|
|
150
|
+
await writeFile("personal-data.md", toMarkdown(report));
|
|
151
|
+
|
|
152
|
+
classifyField("guardianPhone");
|
|
153
|
+
// { category: "children", label: "Child or guardian information", sensitivity: "high", confidence: "high" }
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Also exported: `toTable`, `toJson`, `toSarif`, `shouldFail`, `extractFields` and a reader for each format (`sqlFields`, `prismaFields`, …). TypeScript types included.
|
|
157
|
+
|
|
158
|
+
## How accurate is it?
|
|
159
|
+
|
|
160
|
+
- **Field names are a strong signal, not proof.** A column called `pan` almost always holds a PAN in an Indian app, but not always. Each finding has a confidence, and ambiguous names (a bare `name`, `location`, `tin`) are `low` and hidden by default.
|
|
161
|
+
- **It reads code, not data.** It sees that `users.mobile_no` exists, not what's in it. Data in JSON blobs, free-text notes or columns with unhelpful names (`field_7`) won't be found.
|
|
162
|
+
- **The schema readers are pattern-based.** They handle the common way each tool declares fields, not every feature of every format. If it misses a field in your schema, [open an issue](https://github.com/ckgiri/dpdp-scanner/issues) with a made-up example.
|
|
163
|
+
- **Values use dpdp-india's checks.** See [how accurate dpdp-india is](https://github.com/ckgiri/dpdp-india#how-accurate-is-it). Email addresses in files are skipped because code is full of `support@` and test addresses.
|
|
164
|
+
|
|
165
|
+
## Disclaimer
|
|
166
|
+
|
|
167
|
+
- **Not official.** dpdp-scanner is an independent open-source project, built and maintained by an individual. It is not affiliated with, endorsed by or connected to the Government of India, the Ministry of Electronics and Information Technology (MeitY), the Data Protection Board of India, UIDAI or any other government body. "DPDP" refers to the Digital Personal Data Protection Act, 2023, which the project is built to help with.
|
|
168
|
+
- **Not legal advice.** It's engineering tooling. An inventory of personal data is a starting point, not compliance with the DPDP Act on its own. Check your obligations with your legal team.
|
|
169
|
+
- **No guarantee.** It can miss personal data or flag fields that aren't. Review the results before relying on them. The software is provided "as is", without warranty, under the [MIT License](https://github.com/ckgiri/dpdp-scanner/blob/main/LICENSE).
|
|
170
|
+
- **Sample data is made up.** Every Aadhaar, PAN, phone number and other identifier in this README, the tests and the images is invented and doesn't belong to anyone.
|
|
171
|
+
|
|
172
|
+
## Related
|
|
173
|
+
|
|
174
|
+
- [dpdp-india](https://www.npmjs.com/package/dpdp-india): find and mask Indian personal data in logs, AI prompts and any text.
|
|
175
|
+
|
|
176
|
+
## License
|
|
177
|
+
|
|
178
|
+
MIT
|