OpenLatch detection-tool SDK — Standard Webhooks v1 verify/sign + FastAPI decorator.
Project description
openlatch-tool-sdk
Standard Webhooks v1 verify/sign + FastAPI decorator for OpenLatch
detection tools (Python). Pairs with openlatch-provider listen (HMAC
verification happens there) or stands on its own when the tool server is
exposed publicly.
Install
pip install 'openlatch-tool-sdk[fastapi]'
FastAPI
from openlatch_tool_sdk import CloudEvent, Verdict, tool
from fastapi import FastAPI
app = FastAPI()
@tool(app, path="/event", secret=None) # secret=os.environ["OPENLATCH_WHSEC"] for standalone
async def detect(event: CloudEvent) -> Verdict:
text = str((event.tool_call.input if event.tool_call else None) or {})
if "AKIA" in text:
return Verdict(
risk_score=99,
severity_hint="critical",
verdict_hint="deny",
rule_id="aws.access_key",
rationale_summary="AWS access key detected",
)
return Verdict(risk_score=5, severity_hint="low", verdict_hint="allow")
Direct API
from openlatch_tool_sdk import compute_signature, sign_response, verify
Verdict shape
Pydantic models are configured with alias_generator=to_camel, so wire
JSON uses camelCase (riskScore, severityHint, …) per
provider-call.schema.json, while Python code uses snake_case naturally.
Cross-impl HMAC parity
Test fixtures and signed outputs are byte-identical between this SDK,
@openlatch/tool-sdk (npm), and runtime/webhook.rs in the
openlatch-provider Rust binary. The same whsec_<base64> secret +
<id>.<timestamp>.<raw-body> payload + base64(HMAC-SHA256) framing is
used by all three.
Releases
openlatch-tool-sdk is released in lock-step with openlatch-provider
via release-please. Land conventional-commit PRs against main;
release-please opens a Release PR bumping all three packages
(openlatch-provider on crates.io + npm, openlatch-tool-sdk on PyPI,
@openlatch/tool-sdk on npm). Merging the Release PR creates a v*
tag and the unified publish.yml workflow publishes everything via
OIDC trusted publishing.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file openlatch_tool_sdk-1.0.0.tar.gz.
File metadata
- Download URL: openlatch_tool_sdk-1.0.0.tar.gz
- Upload date:
- Size: 35.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
71e401fac72da6fe9fb3db90e0fe8ae0b64ff1b9053624d9fd9f64e1bdb6b133
|
|
| MD5 |
0658070d423345e2702f36861ca56fd5
|
|
| BLAKE2b-256 |
a6973153adfc06e8e8f54c4bd43fa55bcb71f3ab5c4a57cefa0fcf12727241e1
|
Provenance
The following attestation bundles were made for openlatch_tool_sdk-1.0.0.tar.gz:
Publisher:
publish.yml on OpenLatch/openlatch-provider
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
openlatch_tool_sdk-1.0.0.tar.gz -
Subject digest:
71e401fac72da6fe9fb3db90e0fe8ae0b64ff1b9053624d9fd9f64e1bdb6b133 - Sigstore transparency entry: 1470346956
- Sigstore integration time:
-
Permalink:
OpenLatch/openlatch-provider@3a01aa9ae97c0826f564b2d1e4a51b95505b84a8 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/OpenLatch
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3a01aa9ae97c0826f564b2d1e4a51b95505b84a8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file openlatch_tool_sdk-1.0.0-py3-none-any.whl.
File metadata
- Download URL: openlatch_tool_sdk-1.0.0-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
41b692ce909b4ad06dab2670b8ad94344f06e78b26fb5fd72a6f6decb7164de5
|
|
| MD5 |
e0e6b00c3eede006acdbac8b68e85a6d
|
|
| BLAKE2b-256 |
f8ef004b68171b0bbc20440c17b38e41d79df17c34b95e9053c34e393699e983
|
Provenance
The following attestation bundles were made for openlatch_tool_sdk-1.0.0-py3-none-any.whl:
Publisher:
publish.yml on OpenLatch/openlatch-provider
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
openlatch_tool_sdk-1.0.0-py3-none-any.whl -
Subject digest:
41b692ce909b4ad06dab2670b8ad94344f06e78b26fb5fd72a6f6decb7164de5 - Sigstore transparency entry: 1470347184
- Sigstore integration time:
-
Permalink:
OpenLatch/openlatch-provider@3a01aa9ae97c0826f564b2d1e4a51b95505b84a8 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/OpenLatch
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3a01aa9ae97c0826f564b2d1e4a51b95505b84a8 -
Trigger Event:
push
-
Statement type: