blackshield-sdk 0.2.0__tar.gz → 0.2.2__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.
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/PKG-INFO +11 -3
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/README.md +9 -1
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/pyproject.toml +1 -1
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/_version.py +1 -1
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/resources/ai_integrations.py +12 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/resources/easm.py +20 -4
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/types/easm.py +12 -2
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/types/ingestion.py +2 -2
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/tests/test_ai_governance_sdk.py +22 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/tests/test_client.py +1 -1
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/tests/test_easm.py +19 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/tests/test_ingestion.py +65 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/.gitignore +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/__init__.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/_async_client.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/_base_client.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/_client.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/_exceptions.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/_types.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/mcp.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/resources/__init__.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/resources/ai_assets.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/resources/ai_gateway.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/resources/alerts.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/resources/api_keys.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/resources/assertions.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/resources/audit.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/resources/compliance.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/resources/connectors.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/resources/customer_notifications.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/resources/dashboard.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/resources/dast.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/resources/evidence.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/resources/findings.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/resources/identity.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/resources/incidents.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/resources/ingestion.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/resources/oauth_apps.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/resources/policies.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/resources/remediation.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/resources/reports.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/resources/runbooks.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/resources/security_agents.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/resources/security_reviews.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/resources/services.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/resources/siem.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/resources/threat_intel.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/resources/threat_modeling.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/types/__init__.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/types/ai_assets.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/types/ai_gateway.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/types/ai_integrations.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/types/alerts.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/types/api_keys.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/types/assertions.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/types/audit.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/types/compliance.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/types/connectors.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/types/customer_notifications.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/types/dashboard.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/types/dast.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/types/evidence.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/types/findings.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/types/identity.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/types/incidents.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/types/oauth_apps.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/types/policies.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/types/remediation.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/types/reports.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/types/runbooks.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/types/security_agents.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/types/security_reviews.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/types/services.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/types/siem.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/types/threat_intel.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/types/threat_modeling.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/tests/conftest.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/tests/test_ai_gateway.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/tests/test_alerts.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/tests/test_api_keys.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/tests/test_assertions_dast_sdk.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/tests/test_audit.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/tests/test_compliance.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/tests/test_connectors.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/tests/test_dashboard.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/tests/test_evidence_siem_runbooks.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/tests/test_findings.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/tests/test_identity.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/tests/test_mcp.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/tests/test_notifications_threat_modeling_sdk.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/tests/test_policies.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/tests/test_remediation.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/tests/test_reports.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/tests/test_request_models.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/tests/test_security_agents.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/tests/test_security_reviews.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/tests/test_services_and_incidents.py +0 -0
- {blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/tests/test_threat_intel.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: blackshield-sdk
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: Official Python SDK for the BlackShield Security Platform
|
|
5
5
|
Project-URL: Homepage, https://blackshield.chaplau.com
|
|
6
6
|
Project-URL: Documentation, https://blackshield.chaplau.com/en/docs
|
|
@@ -100,11 +100,19 @@ asyncio.run(main())
|
|
|
100
100
|
| `client.oauth_apps` | OAuth app and grant governance | `client.oauth_apps.grants(status="pending_review")` |
|
|
101
101
|
| `client.threat_modeling` | Hosted threat-model sessions & exports | `client.threat_modeling.create_session(title="Review")` |
|
|
102
102
|
|
|
103
|
-
Version 0.2.0
|
|
103
|
+
Version 0.2.2 preserves the 0.2.0 surface and accepts both the legacy `job_id`
|
|
104
|
+
and current `id` ingestion job status fields. It also includes the 0.2.1 durable
|
|
105
|
+
EASM verification outcomes, explicit challenge rotation, and synchronous/asynchronous
|
|
106
|
+
AI provider configuration deletion. Version 0.2.0 added EASM asset-verification operations, AI Gateway client
|
|
104
107
|
updates/deactivation, OAuth token exchange and governed chat completions. Reports
|
|
105
108
|
v2 and Threat Intelligence v2 are part of the supported public surface. All new
|
|
106
109
|
resources have matching synchronous and asynchronous implementations.
|
|
107
110
|
|
|
111
|
+
Official packages are released only by the Jenkins `Publish SDK` stage after
|
|
112
|
+
the Python 3.10–3.13 matrix and repository security gates pass. The stage
|
|
113
|
+
publishes an immutable PyPI version and fingerprints its wheel checksum; it
|
|
114
|
+
does not depend on a GitHub workflow, release, or tag.
|
|
115
|
+
|
|
108
116
|
## Ingestion
|
|
109
117
|
|
|
110
118
|
```python
|
|
@@ -70,11 +70,19 @@ asyncio.run(main())
|
|
|
70
70
|
| `client.oauth_apps` | OAuth app and grant governance | `client.oauth_apps.grants(status="pending_review")` |
|
|
71
71
|
| `client.threat_modeling` | Hosted threat-model sessions & exports | `client.threat_modeling.create_session(title="Review")` |
|
|
72
72
|
|
|
73
|
-
Version 0.2.0
|
|
73
|
+
Version 0.2.2 preserves the 0.2.0 surface and accepts both the legacy `job_id`
|
|
74
|
+
and current `id` ingestion job status fields. It also includes the 0.2.1 durable
|
|
75
|
+
EASM verification outcomes, explicit challenge rotation, and synchronous/asynchronous
|
|
76
|
+
AI provider configuration deletion. Version 0.2.0 added EASM asset-verification operations, AI Gateway client
|
|
74
77
|
updates/deactivation, OAuth token exchange and governed chat completions. Reports
|
|
75
78
|
v2 and Threat Intelligence v2 are part of the supported public surface. All new
|
|
76
79
|
resources have matching synchronous and asynchronous implementations.
|
|
77
80
|
|
|
81
|
+
Official packages are released only by the Jenkins `Publish SDK` stage after
|
|
82
|
+
the Python 3.10–3.13 matrix and repository security gates pass. The stage
|
|
83
|
+
publishes an immutable PyPI version and fingerprints its wheel checksum; it
|
|
84
|
+
does not depend on a GitHub workflow, release, or tag.
|
|
85
|
+
|
|
78
86
|
## Ingestion
|
|
79
87
|
|
|
80
88
|
```python
|
{blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/resources/ai_integrations.py
RENAMED
|
@@ -26,6 +26,11 @@ class AiIntegrationsResource:
|
|
|
26
26
|
path = f"/api/v1/integrations/ai/config/{provider}"
|
|
27
27
|
return AiIntegration.model_validate(self._client.put(path, json=values).json())
|
|
28
28
|
|
|
29
|
+
def delete(self, provider: str, *, delete_credentials: bool = False) -> None:
|
|
30
|
+
"""Delete a provider configuration and optionally its stored credential."""
|
|
31
|
+
path = f"/api/v1/integrations/ai/config/{provider}"
|
|
32
|
+
self._client.delete(path, params={"delete_credentials": delete_credentials})
|
|
33
|
+
|
|
29
34
|
def preflight(self, provider: str, **values: object) -> AiIntegrationCheck:
|
|
30
35
|
path = f"/api/v1/integrations/ai/preflight/{provider}"
|
|
31
36
|
return AiIntegrationCheck.model_validate(self._client.post(path, json=values).json())
|
|
@@ -51,6 +56,13 @@ class AsyncAiIntegrationsResource:
|
|
|
51
56
|
response = await self._client.put(f"/api/v1/integrations/ai/config/{provider}", json=values)
|
|
52
57
|
return AiIntegration.model_validate(response.json())
|
|
53
58
|
|
|
59
|
+
async def delete(self, provider: str, *, delete_credentials: bool = False) -> None:
|
|
60
|
+
"""Delete a provider configuration and optionally its stored credential."""
|
|
61
|
+
await self._client.delete(
|
|
62
|
+
f"/api/v1/integrations/ai/config/{provider}",
|
|
63
|
+
params={"delete_credentials": delete_credentials},
|
|
64
|
+
)
|
|
65
|
+
|
|
54
66
|
async def preflight(self, provider: str, **values: object) -> AiIntegrationCheck:
|
|
55
67
|
response = await self._client.post(f"/api/v1/integrations/ai/preflight/{provider}", json=values)
|
|
56
68
|
return AiIntegrationCheck.model_validate(response.json())
|
|
@@ -62,9 +62,17 @@ class EasmResource:
|
|
|
62
62
|
path = f"/api/v1/easm/assets/{asset_id}/verification"
|
|
63
63
|
return EasmVerification.model_validate(self._client.get(path).json())
|
|
64
64
|
|
|
65
|
-
def create_verification(
|
|
65
|
+
def create_verification(
|
|
66
|
+
self,
|
|
67
|
+
asset_id: str,
|
|
68
|
+
*,
|
|
69
|
+
method: str,
|
|
70
|
+
rotate: bool = False,
|
|
71
|
+
**values: object,
|
|
72
|
+
) -> EasmVerification:
|
|
66
73
|
path = f"/api/v1/easm/assets/{asset_id}/verification"
|
|
67
|
-
|
|
74
|
+
payload = {"method": method, "rotate": rotate, **values}
|
|
75
|
+
return EasmVerification.model_validate(self._client.post(path, json=payload).json())
|
|
68
76
|
|
|
69
77
|
def check_verification(self, asset_id: str) -> EasmVerification:
|
|
70
78
|
path = f"/api/v1/easm/assets/{asset_id}/verification/check"
|
|
@@ -123,9 +131,17 @@ class AsyncEasmResource:
|
|
|
123
131
|
path = f"/api/v1/easm/assets/{asset_id}/verification"
|
|
124
132
|
return EasmVerification.model_validate((await self._client.get(path)).json())
|
|
125
133
|
|
|
126
|
-
async def create_verification(
|
|
134
|
+
async def create_verification(
|
|
135
|
+
self,
|
|
136
|
+
asset_id: str,
|
|
137
|
+
*,
|
|
138
|
+
method: str,
|
|
139
|
+
rotate: bool = False,
|
|
140
|
+
**values: object,
|
|
141
|
+
) -> EasmVerification:
|
|
127
142
|
path = f"/api/v1/easm/assets/{asset_id}/verification"
|
|
128
|
-
|
|
143
|
+
payload = {"method": method, "rotate": rotate, **values}
|
|
144
|
+
return EasmVerification.model_validate((await self._client.post(path, json=payload)).json())
|
|
129
145
|
|
|
130
146
|
async def check_verification(self, asset_id: str) -> EasmVerification:
|
|
131
147
|
path = f"/api/v1/easm/assets/{asset_id}/verification/check"
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
from datetime import datetime
|
|
6
|
-
from typing import Any
|
|
6
|
+
from typing import Any, Literal
|
|
7
7
|
|
|
8
8
|
from pydantic import BaseModel, Field
|
|
9
9
|
|
|
@@ -68,8 +68,18 @@ class EasmVerification(BaseModel):
|
|
|
68
68
|
"""Ownership verification state for an external asset."""
|
|
69
69
|
|
|
70
70
|
id: str | None = None
|
|
71
|
-
|
|
71
|
+
asset_id: str | None = None
|
|
72
|
+
asset_value: str | None = None
|
|
73
|
+
status: Literal["pending", "failed", "expired", "verified"]
|
|
72
74
|
method: str | None = None
|
|
73
75
|
token: str | None = None
|
|
76
|
+
challenge_name: str | None = None
|
|
77
|
+
challenge_value: str | None = None
|
|
78
|
+
checked_at: datetime | None = None
|
|
79
|
+
verified_at: datetime | None = None
|
|
80
|
+
expires_at: datetime | None = None
|
|
81
|
+
last_check_outcome: Literal["matched", "proof_absent", "transient_error"] | None = None
|
|
82
|
+
last_error_category: str | None = None
|
|
83
|
+
last_error: str | None = None
|
|
74
84
|
|
|
75
85
|
model_config = {"extra": "allow"}
|
|
@@ -7,7 +7,7 @@ import uuid
|
|
|
7
7
|
from datetime import datetime
|
|
8
8
|
from typing import Any
|
|
9
9
|
|
|
10
|
-
from pydantic import BaseModel, Field
|
|
10
|
+
from pydantic import AliasChoices, BaseModel, Field
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
class AffectedResource(BaseModel):
|
|
@@ -122,7 +122,7 @@ class IngestionJobAccepted(BaseModel):
|
|
|
122
122
|
class IngestionJobStatus(BaseModel):
|
|
123
123
|
"""Current status of an ingestion job."""
|
|
124
124
|
|
|
125
|
-
job_id: uuid.UUID
|
|
125
|
+
job_id: uuid.UUID = Field(validation_alias=AliasChoices("job_id", "id"))
|
|
126
126
|
status: str
|
|
127
127
|
job_type: str
|
|
128
128
|
accepted: int = 0
|
|
@@ -104,6 +104,20 @@ class TestAiIntegrationsResource:
|
|
|
104
104
|
with BlackShield(api_key=API_KEY, base_url=BASE_URL) as client:
|
|
105
105
|
assert client.ai_integrations.smoke_test("openai", model="sandbox").status == "pass"
|
|
106
106
|
|
|
107
|
+
@respx.mock(base_url=BASE_URL)
|
|
108
|
+
def test_delete_preserves_credentials_by_default(self, respx_mock: respx.MockRouter) -> None:
|
|
109
|
+
route = respx_mock.delete("/api/v1/integrations/ai/config/openai").respond(204)
|
|
110
|
+
with BlackShield(api_key=API_KEY, base_url=BASE_URL) as client:
|
|
111
|
+
client.ai_integrations.delete("openai")
|
|
112
|
+
assert route.calls.last.request.url.params["delete_credentials"] == "false"
|
|
113
|
+
|
|
114
|
+
@respx.mock(base_url=BASE_URL)
|
|
115
|
+
def test_delete_can_remove_credentials(self, respx_mock: respx.MockRouter) -> None:
|
|
116
|
+
route = respx_mock.delete("/api/v1/integrations/ai/config/openai").respond(204)
|
|
117
|
+
with BlackShield(api_key=API_KEY, base_url=BASE_URL) as client:
|
|
118
|
+
client.ai_integrations.delete("openai", delete_credentials=True)
|
|
119
|
+
assert route.calls.last.request.url.params["delete_credentials"] == "true"
|
|
120
|
+
|
|
107
121
|
@pytest.mark.asyncio
|
|
108
122
|
@respx.mock(base_url=BASE_URL)
|
|
109
123
|
async def test_async_preflight(self, respx_mock: respx.MockRouter) -> None:
|
|
@@ -113,6 +127,14 @@ class TestAiIntegrationsResource:
|
|
|
113
127
|
async with AsyncBlackShield(api_key=API_KEY, base_url=BASE_URL) as client:
|
|
114
128
|
assert not (await client.ai_integrations.preflight("openai", model="sandbox")).can_enable
|
|
115
129
|
|
|
130
|
+
@pytest.mark.asyncio
|
|
131
|
+
@respx.mock(base_url=BASE_URL)
|
|
132
|
+
async def test_async_delete(self, respx_mock: respx.MockRouter) -> None:
|
|
133
|
+
route = respx_mock.delete("/api/v1/integrations/ai/config/anthropic").respond(204)
|
|
134
|
+
async with AsyncBlackShield(api_key=API_KEY, base_url=BASE_URL) as client:
|
|
135
|
+
await client.ai_integrations.delete("anthropic", delete_credentials=True)
|
|
136
|
+
assert route.calls.last.request.url.params["delete_credentials"] == "true"
|
|
137
|
+
|
|
116
138
|
|
|
117
139
|
class TestOAuthAppsResource:
|
|
118
140
|
@respx.mock(base_url=BASE_URL)
|
|
@@ -52,7 +52,7 @@ class TestBlackShieldInit:
|
|
|
52
52
|
assert client.findings is not None
|
|
53
53
|
|
|
54
54
|
def test_version_is_set(self) -> None:
|
|
55
|
-
assert __version__ == "0.2.
|
|
55
|
+
assert __version__ == "0.2.2"
|
|
56
56
|
|
|
57
57
|
def test_bearer_token_client(self) -> None:
|
|
58
58
|
with BlackShield(access_token="gateway-token", base_url=BASE_URL) as client:
|
|
@@ -79,8 +79,27 @@ class TestEasmVerification:
|
|
|
79
79
|
)
|
|
80
80
|
with BlackShield(api_key=API_KEY, base_url=BASE_URL) as client:
|
|
81
81
|
assert client.easm.create_verification("asset-1", method="dns_txt").status == "pending"
|
|
82
|
+
assert respx_mock.calls[0].request.content == b'{"method":"dns_txt","rotate":false}'
|
|
82
83
|
assert client.easm.check_verification("asset-1").status == "verified"
|
|
83
84
|
|
|
85
|
+
@respx.mock(base_url=BASE_URL)
|
|
86
|
+
def test_create_with_explicit_rotation(self, respx_mock: respx.MockRouter) -> None:
|
|
87
|
+
route = respx_mock.post("/api/v1/easm/assets/asset-1/verification").respond(
|
|
88
|
+
201, json={"status": "pending"}
|
|
89
|
+
)
|
|
90
|
+
with BlackShield(api_key=API_KEY, base_url=BASE_URL) as client:
|
|
91
|
+
client.easm.create_verification("asset-1", method="dns", rotate=True)
|
|
92
|
+
assert route.calls[0].request.content == b'{"method":"dns","rotate":true}'
|
|
93
|
+
|
|
94
|
+
def test_typed_check_outcome(self) -> None:
|
|
95
|
+
verification = EasmVerification(
|
|
96
|
+
status="verified",
|
|
97
|
+
asset_id="asset-1",
|
|
98
|
+
last_check_outcome="matched",
|
|
99
|
+
last_error_category=None,
|
|
100
|
+
)
|
|
101
|
+
assert verification.last_check_outcome == "matched"
|
|
102
|
+
|
|
84
103
|
@pytest.mark.asyncio
|
|
85
104
|
@respx.mock(base_url=BASE_URL)
|
|
86
105
|
async def test_async_check(self, respx_mock: respx.MockRouter) -> None:
|
|
@@ -128,3 +128,68 @@ class TestGetJob:
|
|
|
128
128
|
assert isinstance(job, IngestionJobStatus)
|
|
129
129
|
assert job.status == "completed"
|
|
130
130
|
assert job.created == 5
|
|
131
|
+
|
|
132
|
+
@respx.mock(base_url=BASE_URL)
|
|
133
|
+
def test_get_job_accepts_api_id_field(self, respx_mock: respx.MockRouter) -> None:
|
|
134
|
+
job_id = "550e8400-e29b-41d4-a716-446655440099"
|
|
135
|
+
respx_mock.get(f"/api/v1/ingest/jobs/{job_id}").respond(
|
|
136
|
+
200,
|
|
137
|
+
json={
|
|
138
|
+
"id": job_id,
|
|
139
|
+
"status": "completed",
|
|
140
|
+
"job_type": "findings_ingestion",
|
|
141
|
+
"accepted": 1,
|
|
142
|
+
"created": 1,
|
|
143
|
+
"updated": 0,
|
|
144
|
+
"errors": [],
|
|
145
|
+
},
|
|
146
|
+
)
|
|
147
|
+
with BlackShield(api_key=API_KEY, base_url=BASE_URL, max_retries=1) as client:
|
|
148
|
+
job = client.ingestion.get_job(job_id)
|
|
149
|
+
assert str(job.job_id) == job_id
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
def test_ingestion_job_status_accepts_legacy_job_id() -> None:
|
|
153
|
+
job_id = "550e8400-e29b-41d4-a716-446655440099"
|
|
154
|
+
job = IngestionJobStatus.model_validate(
|
|
155
|
+
{"job_id": job_id, "status": "completed", "job_type": "findings_ingestion"}
|
|
156
|
+
)
|
|
157
|
+
assert str(job.job_id) == job_id
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
def test_ingestion_job_status_accepts_current_api_id() -> None:
|
|
161
|
+
job_id = "550e8400-e29b-41d4-a716-446655440099"
|
|
162
|
+
job = IngestionJobStatus.model_validate(
|
|
163
|
+
{"id": job_id, "status": "completed", "job_type": "findings_ingestion"}
|
|
164
|
+
)
|
|
165
|
+
assert str(job.job_id) == job_id
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
def test_ingestion_job_status_prefers_legacy_job_id_when_both_are_present() -> None:
|
|
169
|
+
legacy_id = "550e8400-e29b-41d4-a716-446655440099"
|
|
170
|
+
current_id = "660e8400-e29b-41d4-a716-446655440098"
|
|
171
|
+
job = IngestionJobStatus.model_validate(
|
|
172
|
+
{
|
|
173
|
+
"job_id": legacy_id,
|
|
174
|
+
"id": current_id,
|
|
175
|
+
"status": "completed",
|
|
176
|
+
"job_type": "findings_ingestion",
|
|
177
|
+
}
|
|
178
|
+
)
|
|
179
|
+
assert str(job.job_id) == legacy_id
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
def test_ingestion_job_status_serializes_with_stable_sdk_field_name() -> None:
|
|
183
|
+
job_id = "550e8400-e29b-41d4-a716-446655440099"
|
|
184
|
+
job = IngestionJobStatus.model_validate(
|
|
185
|
+
{"id": job_id, "status": "completed", "job_type": "findings_ingestion"}
|
|
186
|
+
)
|
|
187
|
+
assert job.model_dump(mode="json")["job_id"] == job_id
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
def test_ingestion_job_status_requires_one_identifier_alias() -> None:
|
|
191
|
+
import pytest
|
|
192
|
+
from pydantic import ValidationError
|
|
193
|
+
|
|
194
|
+
with pytest.raises(ValidationError):
|
|
195
|
+
IngestionJobStatus.model_validate({"status": "completed", "job_type": "findings_ingestion"})
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/resources/customer_notifications.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/resources/security_agents.py
RENAMED
|
File without changes
|
{blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/resources/security_reviews.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/resources/threat_modeling.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/src/blackshield/types/customer_notifications.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{blackshield_sdk-0.2.0 → blackshield_sdk-0.2.2}/tests/test_notifications_threat_modeling_sdk.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|