pandoraspec 0.1.1__py3-none-any.whl → 0.2.7__py3-none-any.whl
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.
- pandoraspec/cli.py +28 -20
- pandoraspec/config.py +23 -0
- pandoraspec/constants.py +17 -0
- pandoraspec/core.py +52 -329
- pandoraspec/modules/__init__.py +0 -0
- pandoraspec/modules/drift.py +180 -0
- pandoraspec/modules/resilience.py +174 -0
- pandoraspec/modules/security.py +234 -0
- pandoraspec/orchestrator.py +69 -0
- pandoraspec/reporting/__init__.py +0 -0
- pandoraspec/reporting/generator.py +111 -0
- pandoraspec/{reporting.py → reporting/templates.py} +10 -88
- pandoraspec/seed.py +181 -0
- pandoraspec/utils/__init__.py +0 -0
- pandoraspec/utils/logger.py +21 -0
- pandoraspec/utils/parsing.py +35 -0
- pandoraspec/utils/url.py +23 -0
- pandoraspec-0.2.7.dist-info/METADATA +200 -0
- pandoraspec-0.2.7.dist-info/RECORD +23 -0
- pandoraspec-0.2.7.dist-info/entry_points.txt +2 -0
- pandoraspec-0.1.1.dist-info/METADATA +0 -72
- pandoraspec-0.1.1.dist-info/RECORD +0 -9
- pandoraspec-0.1.1.dist-info/entry_points.txt +0 -2
- {pandoraspec-0.1.1.dist-info → pandoraspec-0.2.7.dist-info}/WHEEL +0 -0
- {pandoraspec-0.1.1.dist-info → pandoraspec-0.2.7.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pandoraspec
|
|
3
|
+
Version: 0.2.7
|
|
4
|
+
Summary: DORA Compliance Auditor for OpenAPI Specs
|
|
5
|
+
Author-email: Ulises Merlan <ulimerlan@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Requires-Python: >=3.9
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
Requires-Dist: schemathesis==4.9.1
|
|
10
|
+
Requires-Dist: typer[all]
|
|
11
|
+
Requires-Dist: rich
|
|
12
|
+
Requires-Dist: weasyprint
|
|
13
|
+
Requires-Dist: requests
|
|
14
|
+
Requires-Dist: pydantic
|
|
15
|
+
Provides-Extra: dev
|
|
16
|
+
Requires-Dist: pytest; extra == "dev"
|
|
17
|
+
Requires-Dist: responses; extra == "dev"
|
|
18
|
+
|
|
19
|
+
# PanDoraSpec
|
|
20
|
+
|
|
21
|
+
**The Open DORA Compliance Engine for OpenAPI Specs.**
|
|
22
|
+
|
|
23
|
+
PanDoraSpec is a CLI tool that performs deep technical due diligence on APIs to verify compliance with **DORA (Digital Operational Resilience Act)** requirements. It compares OpenAPI/Swagger specifications against real-world implementation to detect schema drift, resilience gaps, and security issues.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## 📦 Installation
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pip install pandoraspec
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### System Requirements
|
|
34
|
+
The PDF report generation requires `weasyprint`, which depends on **Pango**.
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
## 🚀 Usage
|
|
38
|
+
|
|
39
|
+
Run the audit directly from your terminal.
|
|
40
|
+
|
|
41
|
+
### Basic Scan
|
|
42
|
+
```bash
|
|
43
|
+
pandoraspec https://petstore.swagger.io/v2/swagger.json
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### JSON Output (CI/CD)
|
|
47
|
+
To generate a machine-readable JSON report for automated pipelines:
|
|
48
|
+
```bash
|
|
49
|
+
pandoraspec https://api.example.com/spec.json --format json --output report.json
|
|
50
|
+
```
|
|
51
|
+
This outputs a file like `report.json` containing the full audit results and compliance score.
|
|
52
|
+
|
|
53
|
+
**Included CI/CD Resources:**
|
|
54
|
+
- [`scripts/check_compliance.py`](scripts/check_compliance.py): Script to parse the JSON report and exit with error if non-compliant.
|
|
55
|
+
- [`examples/github_pipeline.yml`](examples/github_pipeline.yml): Example GitHub Actions workflow.
|
|
56
|
+
|
|
57
|
+
### With Options
|
|
58
|
+
```bash
|
|
59
|
+
pandoraspec https://api.example.com/spec.json --vendor "Stripe" --key "sk_live_..."
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Local File
|
|
63
|
+
```bash
|
|
64
|
+
pandoraspec ./openapi.yaml
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Override Base URL
|
|
68
|
+
If your OpenAPI spec uses variables (e.g. `https://{env}.api.com`) or you want to audit a specific target:
|
|
69
|
+
```bash
|
|
70
|
+
pandoraspec https://api.example.com/spec.json --base-url https://staging.api.example.com
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## 🏎️ Zero-Config Testing (DORA Compliance)
|
|
76
|
+
|
|
77
|
+
For standard **DORA compliance**, you simply need to verify that your API implementation matches its specification. **No configuration is required.**
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
pandoraspec https://petstore.swagger.io/v2/swagger.json
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
This runs a **fuzzing** audit where random data is generated based on your schema types (e.g., sending random integers for IDs).
|
|
84
|
+
- **Value:** This is sufficient to prove that your API correctly handles unexpected inputs and adheres to the basic contract (e.g., returning 400 Bad Request instead of 500 Server Error).
|
|
85
|
+
- **Limitation:** Detailed business logic requiring valid IDs (e.g., `GET /user/{id}` where `{id}` must exist) may return `404 Not Found`. This is acceptable for a compliance scan but may not fully exercise deeper code paths.
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## 🧠 Advanced Testing with Seed Data
|
|
90
|
+
|
|
91
|
+
To test **specific business workflows** (e.g., successfully retrieving a user profile), you can provide "Seed Data". This tells PanDoraSpec to use known, valid values instead of random fuzzing data.
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
pandoraspec https://petstore.swagger.io/v2/swagger.json --config seed_parameters.yaml
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Configuration Hierarchy
|
|
98
|
+
You can define seed values at three levels of specificity. The engine resolves values in this order: **Endpoints > Verbs > General**.
|
|
99
|
+
|
|
100
|
+
```yaml
|
|
101
|
+
seed_data:
|
|
102
|
+
# 1. General: Applies to EVERYTHING (path params, query params, headers)
|
|
103
|
+
general:
|
|
104
|
+
username: "test_user"
|
|
105
|
+
limit: 50
|
|
106
|
+
|
|
107
|
+
# 2. Verbs: Applies only to specific HTTP methods (Overwrites General)
|
|
108
|
+
verbs:
|
|
109
|
+
POST:
|
|
110
|
+
username: "admin_user" # Creation requests use a different user
|
|
111
|
+
|
|
112
|
+
# 3. Endpoints: Applies only to specific routes (Overwrites Everything)
|
|
113
|
+
endpoints:
|
|
114
|
+
/users/me:
|
|
115
|
+
GET:
|
|
116
|
+
limit: 10
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### 🔗 Dynamic Seed Data (Recursive Chaining)
|
|
120
|
+
You can even test **dependency chains** where one endpoint requires data from another. PanDoraSpec handles **recursion** automatically: if Endpoint A needs data from B, and B needs data from C, it will resolve the entire chain in order.
|
|
121
|
+
|
|
122
|
+
**Supported Features:**
|
|
123
|
+
- **Recursive Resolution:** Automatically resolves upstream dependencies (chains of `from_endpoint`).
|
|
124
|
+
- **Deep Extraction:** Extract values from nested JSON using dot notation, including list indices (e.g., `data.items.0.id`).
|
|
125
|
+
- **Parameter Interpolation:** Use `{param}` in the dependency URL to chain multiple steps.
|
|
126
|
+
- **Smart Logging:** Fuzzed values are masked as `random` in logs to keep output clean, while your seeded values are shown clearly.
|
|
127
|
+
|
|
128
|
+
```yaml
|
|
129
|
+
endpoints:
|
|
130
|
+
# Level 1: Get the current user ID
|
|
131
|
+
/user/me:
|
|
132
|
+
GET:
|
|
133
|
+
authorization: "Bearer static-token"
|
|
134
|
+
|
|
135
|
+
# Level 2: Use that ID to get their orders
|
|
136
|
+
/users/{userId}/orders:
|
|
137
|
+
GET:
|
|
138
|
+
userId:
|
|
139
|
+
from_endpoint: "GET /user/me"
|
|
140
|
+
extract: "data.id" # JSON extraction
|
|
141
|
+
|
|
142
|
+
# Level 3: Get details of the FIRST order from that list (Recursive!)
|
|
143
|
+
/orders/{orderId}:
|
|
144
|
+
GET:
|
|
145
|
+
orderId:
|
|
146
|
+
# This calls Level 2 first (which calls Level 1), then extracts the first order ID
|
|
147
|
+
from_endpoint: "GET /users/{userId}/orders"
|
|
148
|
+
extract: "data.items.0.id" # Supports list index '0'
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## 🛠️ Development Setup
|
|
154
|
+
|
|
155
|
+
To run the CLI locally without reinstalling after every change:
|
|
156
|
+
|
|
157
|
+
1. **Clone & CD**:
|
|
158
|
+
```bash
|
|
159
|
+
git clone ...
|
|
160
|
+
cd pandoraspec
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
2. **Create & Activate Virtual Environment**:
|
|
164
|
+
It's recommended to use a virtual environment to keep dependencies isolated.
|
|
165
|
+
```bash
|
|
166
|
+
python3 -m venv venv
|
|
167
|
+
source venv/bin/activate # On Windows: venv\Scripts\activate
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
3. **Editable Install**:
|
|
171
|
+
```bash
|
|
172
|
+
pip install -e .
|
|
173
|
+
```
|
|
174
|
+
This links the `pandoraspec` command directly to your source code. Any changes you make will be reflected immediately.
|
|
175
|
+
|
|
176
|
+
## 🛡️ What It Checks
|
|
177
|
+
|
|
178
|
+
### Module A: The Integrity Test (Drift)
|
|
179
|
+
Checks if your API implementation matches your documentation.
|
|
180
|
+
- **Why?** DORA requires you to monitor if the service effectively supports your critical functions. If the API behaves differently than documented, it's a risk.
|
|
181
|
+
|
|
182
|
+
### Module B: The Resilience Test
|
|
183
|
+
Stress tests the API to ensure it handles invalid inputs gracefully (`4xx` vs `5xx`).
|
|
184
|
+
- **Why?** DORA Article 25 calls for "Digital operational resilience testing".
|
|
185
|
+
|
|
186
|
+
### Module C: Security Hygiene
|
|
187
|
+
Checks for common security headers and configurations.
|
|
188
|
+
|
|
189
|
+
### Module D: The Report
|
|
190
|
+
Generates a PDF report: **"DORA ICT Third-Party Technical Risk Assessment"**.
|
|
191
|
+
Alternatively, use `--format json` to get a structured JSON object for:
|
|
192
|
+
- CI/CD Gates (e.g., fail build if `is_compliant` is false).
|
|
193
|
+
- Custom Dashboards.
|
|
194
|
+
- Archival purposes.
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
## 📄 License
|
|
199
|
+
|
|
200
|
+
MIT
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
pandoraspec/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
pandoraspec/cli.py,sha256=a4T9sIzwqjyS6NO9XyfQq9g0m25H31zp9xV_X5Gqx4A,3526
|
|
3
|
+
pandoraspec/config.py,sha256=CVfHxxR_VEm2UOZkuOHLlAUDaJr-ooZxIgJWnvRyj3Q,857
|
|
4
|
+
pandoraspec/constants.py,sha256=JWCglaqqEf6581pLK0EzySP1vrLJn49Tnza1L5rb0AA,422
|
|
5
|
+
pandoraspec/core.py,sha256=DUq5JFDL5O3mtehxVQX7cQm7GXhFl3n9gC5AJaQb7oo,3635
|
|
6
|
+
pandoraspec/orchestrator.py,sha256=NQJGdSU0hRFVUw68tz2PFEKLFxv9aS0pYnXdWgYs8q4,2021
|
|
7
|
+
pandoraspec/seed.py,sha256=CJzpm3Oci5Dr0cSnWTLTxV4ePAe8tG7cbF0Vwv5qO4A,7547
|
|
8
|
+
pandoraspec/modules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
|
+
pandoraspec/modules/drift.py,sha256=8a8psZLnd3BO-fTp72LiBko0CPuhn0GbNtqdXFRjWsU,8502
|
|
10
|
+
pandoraspec/modules/resilience.py,sha256=XcdWgiJ4M6PL1fadPsnwBujoH889aS5E6e2RIdP1B_A,6348
|
|
11
|
+
pandoraspec/modules/security.py,sha256=9uEZaqyL6jp5JYwYgFe_si3vjjbQcgb-hKdSGl9ysrI,8310
|
|
12
|
+
pandoraspec/reporting/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
13
|
+
pandoraspec/reporting/generator.py,sha256=khFJw7cJB3lRgE3zHBSQ2vfH8jtQQgvk0k7Y-PjAjYo,4255
|
|
14
|
+
pandoraspec/reporting/templates.py,sha256=k81vZEVqG18xxKGnSMHdk6R5iQ1j15qY7Oz0IOKp05g,6246
|
|
15
|
+
pandoraspec/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
16
|
+
pandoraspec/utils/logger.py,sha256=MC7JEQcSFvUIYLwjhiM1nq0gccGUSNt_KhZiA_tSJWg,644
|
|
17
|
+
pandoraspec/utils/parsing.py,sha256=hdptWR4Bh-IZqs5LsJ0U7kn8t9j-yMz4_D5WqcPjXCo,1008
|
|
18
|
+
pandoraspec/utils/url.py,sha256=1KD6F0aa0-lNbHR2OdHY_w5dSnX_NF12qLn5Cs3gc-c,799
|
|
19
|
+
pandoraspec-0.2.7.dist-info/METADATA,sha256=Q1h1rIdR0JWP4N0i6Oqit7NoZwu2WX8gr_3HSRsKzfs,6718
|
|
20
|
+
pandoraspec-0.2.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
21
|
+
pandoraspec-0.2.7.dist-info/entry_points.txt,sha256=6sqB0v21PGWnZXD74EK5jPbFAdZd7IWyfO7QHKiXWm8,53
|
|
22
|
+
pandoraspec-0.2.7.dist-info/top_level.txt,sha256=8It7kimNf30-5ZUI7CZl6kCBeImIG8H49ZjSU26dRuc,12
|
|
23
|
+
pandoraspec-0.2.7.dist-info/RECORD,,
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: pandoraspec
|
|
3
|
-
Version: 0.1.1
|
|
4
|
-
Summary: DORA Compliance Auditor for OpenAPI Specs
|
|
5
|
-
Author-email: Ulises Merlan <ulimerlan@gmail.com>
|
|
6
|
-
License: MIT
|
|
7
|
-
Requires-Python: >=3.9
|
|
8
|
-
Description-Content-Type: text/markdown
|
|
9
|
-
Requires-Dist: fastapi
|
|
10
|
-
Requires-Dist: schemathesis==4.9.1
|
|
11
|
-
Requires-Dist: typer[all]
|
|
12
|
-
Requires-Dist: rich
|
|
13
|
-
Requires-Dist: weasyprint
|
|
14
|
-
Requires-Dist: jinja2
|
|
15
|
-
Requires-Dist: requests
|
|
16
|
-
|
|
17
|
-
# PanDoraSpec
|
|
18
|
-
|
|
19
|
-
**The Open DORA Compliance Engine for OpenAPI Specs.**
|
|
20
|
-
|
|
21
|
-
PanDoraSpec is a CLI tool that performs deep technical due diligence on your APIs to verify compliance with **DORA (Digital Operational Resilience Act)** requirements. It compares your OpenAPI/Swagger specifications against real-world implementation to detect schema drift, resilience gaps, and security issues.
|
|
22
|
-
|
|
23
|
-
---
|
|
24
|
-
|
|
25
|
-
## 📦 Installation
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
pip install pandoraspec
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
## 🚀 Usage
|
|
32
|
-
|
|
33
|
-
Run the audit directly from your terminal.
|
|
34
|
-
|
|
35
|
-
### Basic Scan
|
|
36
|
-
```bash
|
|
37
|
-
pandoraspec https://petstore.swagger.io/v2/swagger.json
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
### With Options
|
|
41
|
-
```bash
|
|
42
|
-
pandoraspec https://api.example.com/spec.json --vendor "Stripe" --key "sk_live_..."
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
### Local File
|
|
46
|
-
```bash
|
|
47
|
-
pandoraspec ./openapi.yaml
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
---
|
|
51
|
-
|
|
52
|
-
## 🛡️ What It Checks
|
|
53
|
-
|
|
54
|
-
### Module A: The Integrity Test (Drift)
|
|
55
|
-
Checks if your API implementation matches your documentation.
|
|
56
|
-
- **Why?** DORA requires you to monitor if the service effectively supports your critical functions. If the API behaves differently than documented, it's a risk.
|
|
57
|
-
|
|
58
|
-
### Module B: The Resilience Test
|
|
59
|
-
Stress tests the API to ensure it handles invalid inputs gracefully (`4xx` vs `5xx`).
|
|
60
|
-
- **Why?** DORA Article 25 calls for "Digital operational resilience testing".
|
|
61
|
-
|
|
62
|
-
### Module C: Security Hygiene
|
|
63
|
-
Checks for common security headers and configurations.
|
|
64
|
-
|
|
65
|
-
### Module D: The Report
|
|
66
|
-
Generates a branded PDF report: **"DORA ICT Third-Party Technical Risk Assessment"**.
|
|
67
|
-
|
|
68
|
-
---
|
|
69
|
-
|
|
70
|
-
## 📄 License
|
|
71
|
-
|
|
72
|
-
MIT
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
pandoraspec/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
pandoraspec/cli.py,sha256=sJsVHMmQ_UHQf_lap--aLuf99_HUS_0rOAA5nTAxF54,3087
|
|
3
|
-
pandoraspec/core.py,sha256=bKoPYSfqQa4Yn7CxOX6QPCZXCLMLoiagD8aMfzLtC6o,16059
|
|
4
|
-
pandoraspec/reporting.py,sha256=aAFImWkhi5Ho6AQUCANJy-9MpIbzCJlsCWBSRmivOSQ,8804
|
|
5
|
-
pandoraspec-0.1.1.dist-info/METADATA,sha256=-YMhZl-uwnYuBS64UhgYZrr0oQgluAqCOiZR-w5Jq8k,1892
|
|
6
|
-
pandoraspec-0.1.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
7
|
-
pandoraspec-0.1.1.dist-info/entry_points.txt,sha256=gmXGBQNpfy0IeOjB_SqunmaitLbyFsUZdgfwQOto2P0,52
|
|
8
|
-
pandoraspec-0.1.1.dist-info/top_level.txt,sha256=8It7kimNf30-5ZUI7CZl6kCBeImIG8H49ZjSU26dRuc,12
|
|
9
|
-
pandoraspec-0.1.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|