seesec-dpdp-scanner 0.3.0__tar.gz

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.
@@ -0,0 +1,91 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity.
18
+
19
+ "You" (or "Your") shall mean an individual or Legal Entity
20
+ exercising permissions granted by this License.
21
+
22
+ "Source" form shall mean the preferred form for making modifications.
23
+
24
+ "Object" form shall mean any form resulting from mechanical
25
+ transformation or translation of a Source form.
26
+
27
+ "Work" shall mean the work of authorship made available under the License.
28
+
29
+ "Contribution" shall mean any work of authorship submitted to the Licensor
30
+ for inclusion in the Work.
31
+
32
+ "Contributor" shall mean Licensor and any Legal Entity on behalf of whom a
33
+ Contribution has been received by the Licensor.
34
+
35
+ 2. Grant of Copyright License. Subject to the terms and conditions of
36
+ this License, each Contributor hereby grants to You a perpetual,
37
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
38
+ copyright license to reproduce, prepare Derivative Works of,
39
+ publicly display, publicly perform, sublicense, and distribute the
40
+ Work and such Derivative Works in Source or Object form.
41
+
42
+ 3. Grant of Patent License. Subject to the terms and conditions of
43
+ this License, each Contributor hereby grants to You a perpetual,
44
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
45
+ patent license to make, have made, use, offer to sell, sell,
46
+ import, and otherwise transfer the Work.
47
+
48
+ 4. Redistribution. You may reproduce and distribute copies of the
49
+ Work or Derivative Works thereof in any medium, with or without
50
+ modifications, and in Source or Object form, provided that You
51
+ meet the following conditions:
52
+
53
+ (a) You must give any other recipients of the Work or
54
+ Derivative Works a copy of this License; and
55
+
56
+ (b) You must cause any modified files to carry prominent notices
57
+ stating that You changed the files; and
58
+
59
+ (c) You must retain, in the Source form of any Derivative Works
60
+ that You distribute, all copyright, patent, trademark, and
61
+ attribution notices from the Source form of the Work; and
62
+
63
+ (d) If the Work includes a "NOTICE" text file, You must include
64
+ a readable copy of the attribution notices contained within.
65
+
66
+ 5. Submission of Contributions.
67
+
68
+ 6. Trademarks. This License does not grant permission to use the trade
69
+ names, trademarks, service marks, or product names of the Licensor.
70
+
71
+ 7. Disclaimer of Warranty. The Work is provided on an "AS IS" BASIS,
72
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND.
73
+
74
+ 8. Limitation of Liability. In no event shall any Contributor be
75
+ liable to You for damages.
76
+
77
+ 9. Accepting Warranty or Additional Liability.
78
+
79
+ Copyright 2026 DPDP Scanner Contributors
80
+
81
+ Licensed under the Apache License, Version 2.0 (the "License");
82
+ you may not use this file except in compliance with the License.
83
+ You may obtain a copy of the License at
84
+
85
+ http://www.apache.org/licenses/LICENSE-2.0
86
+
87
+ Unless required by applicable law or agreed to in writing, software
88
+ distributed under the License is distributed on an "AS IS" BASIS,
89
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
90
+ See the License for the specific language governing permissions and
91
+ limitations under the License.
@@ -0,0 +1,198 @@
1
+ Metadata-Version: 2.4
2
+ Name: seesec-dpdp-scanner
3
+ Version: 0.3.0
4
+ Summary: Seesec DPDP Act 2023 Compliance Scanner โ€” audit AWS, code, and files for DPDP violations
5
+ Author-email: "Seesec Infotech Pvt. Ltd." <opensource@seesec.io>
6
+ Project-URL: Homepage, https://seesec.io/
7
+ Project-URL: Repository, https://github.com/seesec-infotech/dpdp-scanner
8
+ Project-URL: Documentation, https://github.com/seesec-infotech/dpdp-scanner#readme
9
+ Keywords: dpdp,compliance,security,aws,pii,scanner,india
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Intended Audience :: Information Technology
13
+ Classifier: License :: OSI Approved :: Apache Software License
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Topic :: Security
17
+ Requires-Python: >=3.11
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+ Requires-Dist: boto3>=1.34.0
21
+ Requires-Dist: typer>=0.12.0
22
+ Requires-Dist: rich>=13.7.0
23
+ Requires-Dist: cryptography>=41.0.0
24
+ Provides-Extra: dev
25
+ Requires-Dist: pytest>=8.0; extra == "dev"
26
+ Requires-Dist: pytest-cov>=5.0; extra == "dev"
27
+ Requires-Dist: moto[dynamodb,ec2,guardduty,iam,kms,lambda,logs,rds,s3,secretsmanager,sns,sqs,sts]>=5.0; extra == "dev"
28
+ Dynamic: license-file
29
+
30
+ # Seesec DPDP Scanner
31
+
32
+ > ๐Ÿ›ก๏ธ India's first DPDP Act 2023 compliance scanner โ€” audit AWS accounts, source code, and files for DPDP violations.
33
+
34
+ [![Tests](https://img.shields.io/badge/tests-64%20passed-green)]() [![Checks](https://img.shields.io/badge/AWS%20checks-51-blue)]() [![Python](https://img.shields.io/badge/python-3.11%2B-blue)]() [![License](https://img.shields.io/badge/license-Apache%202.0-orange)]()
35
+
36
+ Built by **[Seesec Infotech Pvt. Ltd.](https://seesec.io)** ๐Ÿ‡ฎ๐Ÿ‡ณ
37
+
38
+ ---
39
+
40
+ ## โšก Quick Start
41
+
42
+ ```bash
43
+ # Install
44
+ pip install seesec-dpdp-scanner
45
+
46
+ # Scan your AWS account (scans ALL regions by default)
47
+ aws sso login --profile your-profile
48
+ dpdp aws --profile your-profile -o report.html
49
+
50
+ # Scan only a specific region
51
+ dpdp aws --profile your-profile --region ap-south-1
52
+
53
+ # Scan files for PII leakage (Aadhaar, PAN, credit cards...)
54
+ dpdp pii /path/to/logs -o pii-report.html
55
+
56
+ # Scan source code for hardcoded secrets & crypto misuse
57
+ dpdp code /path/to/repo -o code-report.html
58
+
59
+ # Encrypt sensitive data (DPDP-compliant AES-256-GCM)
60
+ dpdp crypto encrypt --data "1234-5678-9012" --key-id alias/my-kms-key
61
+ ```
62
+
63
+ ## ๐Ÿ” What It Scans โ€” 51 AWS Checks
64
+
65
+ ```bash
66
+ # See all checks
67
+ dpdp aws --list-checks
68
+ ```
69
+
70
+ ### AWS Account (`dpdp aws`) โ€” Scans ALL Regions by Default
71
+ | Family | Checks | DPDP Section |
72
+ |--------|--------|-------------|
73
+ | ๐Ÿ” Encryption (ENC) | S3, RDS, DynamoDB, EBS, SQS, SNS, KMS, Redshift, ElastiCache, S3 versioning, MFA Delete, Account S3 Block | Sec 8(5), Rule 6(1)(a) |
74
+ | ๐Ÿ‘ค IAM (IAM) | Root MFA, password policy, user MFA, stale keys, wildcard policies, unused roles | Sec 8(5), Rule 6(1)(b) |
75
+ | ๐Ÿ“‹ Logging (LOG) | CloudTrail, CloudWatch, VPC Flow Logs, S3 access logs, API Gateway, SSM Session Manager | Sec 8(5), Rule 6(1)(c-d) |
76
+ | ๐ŸŒ Data Residency (RES) | S3/RDS/Lambda in Indian regions | Sec 16 |
77
+ | ๐Ÿšจ Breach Readiness (BRE) | GuardDuty, Security Hub | Sec 8(6) |
78
+ | ๐Ÿ”‘ Secrets (SEC) | Lambda env secrets, Secrets Manager rotation, ECR image scanning | Sec 8(5) |
79
+ | ๐ŸŒ Network (NET) | Security group DB ports, ELB TLS 1.2+, CloudFront HTTPS, ACM cert expiry, WAF on ALBs | Sec 8(5) |
80
+ | ๐Ÿ—‘๏ธ Retention (RET) | S3 lifecycle, RDS backups, RDS deletion protection, RDS Multi-AZ, DynamoDB PITR | Sec 8(7) |
81
+ | โš™๏ธ Config (CFG) | AWS Config recording, IAM Access Analyzer | Sec 8(5) |
82
+
83
+ **Smart scanning:** Global services (IAM, S3, CloudFront) are scanned once. Regional services are scanned per-region.
84
+
85
+ ### PII Scanner (`dpdp pii`)
86
+ Detects Indian PII with checksum validation to minimize false positives:
87
+ - **Aadhaar** (Verhoeff checksum) ยท **PAN** (4th-char type validation)
88
+ - **Credit Cards** (Luhn algorithm) ยท **Indian Mobiles** ยท **Emails**
89
+ - **Passports** ยท **Voter ID** ยท **GSTIN** ยท **UPI IDs** ยท **DOB patterns**
90
+
91
+ ### Code Scanner (`dpdp code`)
92
+ 18 static analysis rules detecting:
93
+ - Hardcoded passwords, API keys, AWS keys, connection strings
94
+ - Crypto misuse (ECB mode, DES/RC4, MD5/SHA1, static IVs)
95
+ - PII in log statements, URL parameters, and exception messages
96
+ - Disabled SSL verification
97
+
98
+ ### Crypto Toolkit (`dpdp crypto`)
99
+ - **Encrypt/Decrypt**: AES-256-GCM with KMS Envelope Encryption
100
+ - **Blind Indexing**: HMAC-SHA256 for searching encrypted fields
101
+ - **Format Validation**: Verify DPDP ciphertext structure
102
+
103
+ ## ๐Ÿ“Š Output Formats
104
+
105
+ | Format | Command | Use Case |
106
+ |--------|---------|----------|
107
+ | Terminal | `dpdp aws` | Interactive use |
108
+ | HTML | `dpdp aws -o report.html` | Share with management |
109
+ | JSON | `dpdp aws -o report.json` | CI/CD pipelines |
110
+ | SARIF | `dpdp aws -o report.sarif` | GitHub Code Scanning |
111
+ | CSV | `dpdp aws -o report.csv` | Spreadsheets / Excel |
112
+
113
+ ## ๐Ÿ›ก๏ธ Authentication
114
+
115
+ The scanner uses `boto3` and supports all standard AWS credential methods:
116
+
117
+ ```bash
118
+ # Option 1: AWS SSO (recommended for enterprises)
119
+ aws sso login --profile my-profile
120
+ dpdp aws --profile my-profile
121
+
122
+ # Option 2: Environment Variables (for CI/CD)
123
+ export AWS_ACCESS_KEY_ID="..."
124
+ export AWS_SECRET_ACCESS_KEY="..."
125
+ dpdp aws
126
+
127
+ # Option 3: IAM Instance Roles (for EC2/ECS)
128
+ # No configuration needed โ€” boto3 detects it automatically
129
+ dpdp aws
130
+ ```
131
+
132
+ ## ๐Ÿ”‡ Suppressing False Positives
133
+
134
+ Create a `.dpdpignore` file in your project root:
135
+
136
+ ```bash
137
+ # Ignore AWS-managed CloudFormation buckets
138
+ DPDP-ENC-001:cf-templates-*
139
+ DPDP-ENC-002:cf-templates-*
140
+
141
+ # Ignore a specific check entirely
142
+ DPDP-RES-001
143
+
144
+ # Ignore all checks for a test resource
145
+ *:my-test-bucket
146
+ ```
147
+
148
+ ## ๐Ÿ—๏ธ Multi-Region Scanning
149
+
150
+ ```bash
151
+ # Default: scans ALL enabled AWS regions
152
+ dpdp aws
153
+
154
+ # Scan only Mumbai
155
+ dpdp aws --region ap-south-1
156
+
157
+ # Filter by check family
158
+ dpdp aws --checks ENC # Only encryption checks
159
+ dpdp aws --checks IAM # Only IAM checks
160
+ dpdp aws --severity critical # Only critical findings
161
+ ```
162
+
163
+ ## ๐Ÿš€ CI/CD Integration
164
+
165
+ ### GitHub Actions
166
+ ```yaml
167
+ - name: DPDP Compliance Scan
168
+ run: |
169
+ pip install seesec-dpdp-scanner
170
+ dpdp aws -o dpdp-report.sarif
171
+
172
+ - name: Upload SARIF
173
+ uses: github/codeql-action/upload-sarif@v3
174
+ with:
175
+ sarif_file: dpdp-report.sarif
176
+ ```
177
+
178
+ Exit codes: `0` = no violations, `1` = violations found.
179
+
180
+ ## ๐Ÿงช Development
181
+
182
+ ```bash
183
+ git clone https://github.com/seesec-infotech/dpdp-scanner
184
+ cd dpdp-scanner
185
+ python3 -m venv .venv && source .venv/bin/activate
186
+ pip install -e ".[dev]"
187
+ pytest tests/ -v
188
+ ```
189
+
190
+ ## ๐Ÿ“œ License
191
+
192
+ Apache 2.0 โ€” see [LICENSE](LICENSE)
193
+
194
+ ---
195
+
196
+ <p align="center">
197
+ <strong>Made with โค๏ธ in India by <a href="https://seesec.io">Seesec Infotech</a></strong>
198
+ </p>
@@ -0,0 +1,169 @@
1
+ # Seesec DPDP Scanner
2
+
3
+ > ๐Ÿ›ก๏ธ India's first DPDP Act 2023 compliance scanner โ€” audit AWS accounts, source code, and files for DPDP violations.
4
+
5
+ [![Tests](https://img.shields.io/badge/tests-64%20passed-green)]() [![Checks](https://img.shields.io/badge/AWS%20checks-51-blue)]() [![Python](https://img.shields.io/badge/python-3.11%2B-blue)]() [![License](https://img.shields.io/badge/license-Apache%202.0-orange)]()
6
+
7
+ Built by **[Seesec Infotech Pvt. Ltd.](https://seesec.io)** ๐Ÿ‡ฎ๐Ÿ‡ณ
8
+
9
+ ---
10
+
11
+ ## โšก Quick Start
12
+
13
+ ```bash
14
+ # Install
15
+ pip install seesec-dpdp-scanner
16
+
17
+ # Scan your AWS account (scans ALL regions by default)
18
+ aws sso login --profile your-profile
19
+ dpdp aws --profile your-profile -o report.html
20
+
21
+ # Scan only a specific region
22
+ dpdp aws --profile your-profile --region ap-south-1
23
+
24
+ # Scan files for PII leakage (Aadhaar, PAN, credit cards...)
25
+ dpdp pii /path/to/logs -o pii-report.html
26
+
27
+ # Scan source code for hardcoded secrets & crypto misuse
28
+ dpdp code /path/to/repo -o code-report.html
29
+
30
+ # Encrypt sensitive data (DPDP-compliant AES-256-GCM)
31
+ dpdp crypto encrypt --data "1234-5678-9012" --key-id alias/my-kms-key
32
+ ```
33
+
34
+ ## ๐Ÿ” What It Scans โ€” 51 AWS Checks
35
+
36
+ ```bash
37
+ # See all checks
38
+ dpdp aws --list-checks
39
+ ```
40
+
41
+ ### AWS Account (`dpdp aws`) โ€” Scans ALL Regions by Default
42
+ | Family | Checks | DPDP Section |
43
+ |--------|--------|-------------|
44
+ | ๐Ÿ” Encryption (ENC) | S3, RDS, DynamoDB, EBS, SQS, SNS, KMS, Redshift, ElastiCache, S3 versioning, MFA Delete, Account S3 Block | Sec 8(5), Rule 6(1)(a) |
45
+ | ๐Ÿ‘ค IAM (IAM) | Root MFA, password policy, user MFA, stale keys, wildcard policies, unused roles | Sec 8(5), Rule 6(1)(b) |
46
+ | ๐Ÿ“‹ Logging (LOG) | CloudTrail, CloudWatch, VPC Flow Logs, S3 access logs, API Gateway, SSM Session Manager | Sec 8(5), Rule 6(1)(c-d) |
47
+ | ๐ŸŒ Data Residency (RES) | S3/RDS/Lambda in Indian regions | Sec 16 |
48
+ | ๐Ÿšจ Breach Readiness (BRE) | GuardDuty, Security Hub | Sec 8(6) |
49
+ | ๐Ÿ”‘ Secrets (SEC) | Lambda env secrets, Secrets Manager rotation, ECR image scanning | Sec 8(5) |
50
+ | ๐ŸŒ Network (NET) | Security group DB ports, ELB TLS 1.2+, CloudFront HTTPS, ACM cert expiry, WAF on ALBs | Sec 8(5) |
51
+ | ๐Ÿ—‘๏ธ Retention (RET) | S3 lifecycle, RDS backups, RDS deletion protection, RDS Multi-AZ, DynamoDB PITR | Sec 8(7) |
52
+ | โš™๏ธ Config (CFG) | AWS Config recording, IAM Access Analyzer | Sec 8(5) |
53
+
54
+ **Smart scanning:** Global services (IAM, S3, CloudFront) are scanned once. Regional services are scanned per-region.
55
+
56
+ ### PII Scanner (`dpdp pii`)
57
+ Detects Indian PII with checksum validation to minimize false positives:
58
+ - **Aadhaar** (Verhoeff checksum) ยท **PAN** (4th-char type validation)
59
+ - **Credit Cards** (Luhn algorithm) ยท **Indian Mobiles** ยท **Emails**
60
+ - **Passports** ยท **Voter ID** ยท **GSTIN** ยท **UPI IDs** ยท **DOB patterns**
61
+
62
+ ### Code Scanner (`dpdp code`)
63
+ 18 static analysis rules detecting:
64
+ - Hardcoded passwords, API keys, AWS keys, connection strings
65
+ - Crypto misuse (ECB mode, DES/RC4, MD5/SHA1, static IVs)
66
+ - PII in log statements, URL parameters, and exception messages
67
+ - Disabled SSL verification
68
+
69
+ ### Crypto Toolkit (`dpdp crypto`)
70
+ - **Encrypt/Decrypt**: AES-256-GCM with KMS Envelope Encryption
71
+ - **Blind Indexing**: HMAC-SHA256 for searching encrypted fields
72
+ - **Format Validation**: Verify DPDP ciphertext structure
73
+
74
+ ## ๐Ÿ“Š Output Formats
75
+
76
+ | Format | Command | Use Case |
77
+ |--------|---------|----------|
78
+ | Terminal | `dpdp aws` | Interactive use |
79
+ | HTML | `dpdp aws -o report.html` | Share with management |
80
+ | JSON | `dpdp aws -o report.json` | CI/CD pipelines |
81
+ | SARIF | `dpdp aws -o report.sarif` | GitHub Code Scanning |
82
+ | CSV | `dpdp aws -o report.csv` | Spreadsheets / Excel |
83
+
84
+ ## ๐Ÿ›ก๏ธ Authentication
85
+
86
+ The scanner uses `boto3` and supports all standard AWS credential methods:
87
+
88
+ ```bash
89
+ # Option 1: AWS SSO (recommended for enterprises)
90
+ aws sso login --profile my-profile
91
+ dpdp aws --profile my-profile
92
+
93
+ # Option 2: Environment Variables (for CI/CD)
94
+ export AWS_ACCESS_KEY_ID="..."
95
+ export AWS_SECRET_ACCESS_KEY="..."
96
+ dpdp aws
97
+
98
+ # Option 3: IAM Instance Roles (for EC2/ECS)
99
+ # No configuration needed โ€” boto3 detects it automatically
100
+ dpdp aws
101
+ ```
102
+
103
+ ## ๐Ÿ”‡ Suppressing False Positives
104
+
105
+ Create a `.dpdpignore` file in your project root:
106
+
107
+ ```bash
108
+ # Ignore AWS-managed CloudFormation buckets
109
+ DPDP-ENC-001:cf-templates-*
110
+ DPDP-ENC-002:cf-templates-*
111
+
112
+ # Ignore a specific check entirely
113
+ DPDP-RES-001
114
+
115
+ # Ignore all checks for a test resource
116
+ *:my-test-bucket
117
+ ```
118
+
119
+ ## ๐Ÿ—๏ธ Multi-Region Scanning
120
+
121
+ ```bash
122
+ # Default: scans ALL enabled AWS regions
123
+ dpdp aws
124
+
125
+ # Scan only Mumbai
126
+ dpdp aws --region ap-south-1
127
+
128
+ # Filter by check family
129
+ dpdp aws --checks ENC # Only encryption checks
130
+ dpdp aws --checks IAM # Only IAM checks
131
+ dpdp aws --severity critical # Only critical findings
132
+ ```
133
+
134
+ ## ๐Ÿš€ CI/CD Integration
135
+
136
+ ### GitHub Actions
137
+ ```yaml
138
+ - name: DPDP Compliance Scan
139
+ run: |
140
+ pip install seesec-dpdp-scanner
141
+ dpdp aws -o dpdp-report.sarif
142
+
143
+ - name: Upload SARIF
144
+ uses: github/codeql-action/upload-sarif@v3
145
+ with:
146
+ sarif_file: dpdp-report.sarif
147
+ ```
148
+
149
+ Exit codes: `0` = no violations, `1` = violations found.
150
+
151
+ ## ๐Ÿงช Development
152
+
153
+ ```bash
154
+ git clone https://github.com/seesec-infotech/dpdp-scanner
155
+ cd dpdp-scanner
156
+ python3 -m venv .venv && source .venv/bin/activate
157
+ pip install -e ".[dev]"
158
+ pytest tests/ -v
159
+ ```
160
+
161
+ ## ๐Ÿ“œ License
162
+
163
+ Apache 2.0 โ€” see [LICENSE](LICENSE)
164
+
165
+ ---
166
+
167
+ <p align="center">
168
+ <strong>Made with โค๏ธ in India by <a href="https://seesec.io">Seesec Infotech</a></strong>
169
+ </p>
@@ -0,0 +1,2 @@
1
+ """DPDP Scanner โ€” India's DPDP Act 2023 compliance auditing tool."""
2
+ __version__ = "0.3.0"