cloudmorph-tessera 0.1.1__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.
- cloudmorph_tessera-0.1.1.dist-info/METADATA +307 -0
- cloudmorph_tessera-0.1.1.dist-info/RECORD +36 -0
- cloudmorph_tessera-0.1.1.dist-info/WHEEL +5 -0
- cloudmorph_tessera-0.1.1.dist-info/entry_points.txt +2 -0
- cloudmorph_tessera-0.1.1.dist-info/licenses/LICENSE +202 -0
- cloudmorph_tessera-0.1.1.dist-info/top_level.txt +1 -0
- tessera/__init__.py +6 -0
- tessera/audit/__init__.py +19 -0
- tessera/audit/canonical_json.py +71 -0
- tessera/audit/chain.py +91 -0
- tessera/audit/emitter.py +138 -0
- tessera/audit/sinks/__init__.py +1 -0
- tessera/audit/sinks/base.py +16 -0
- tessera/audit/sinks/buffered.py +124 -0
- tessera/audit/sinks/sqlite.py +124 -0
- tessera/audit/sinks/stdout.py +37 -0
- tessera/audit/verifier.py +86 -0
- tessera/auth/__init__.py +1 -0
- tessera/auth/base.py +22 -0
- tessera/auth/bearer.py +218 -0
- tessera/cli.py +557 -0
- tessera/config.py +239 -0
- tessera/errors.py +32 -0
- tessera/integrations/__init__.py +0 -0
- tessera/integrations/cursor_hooks.py +131 -0
- tessera/intent.py +57 -0
- tessera/pluggable.py +29 -0
- tessera/policy/__init__.py +7 -0
- tessera/policy/action_verbs.py +207 -0
- tessera/policy/conditions.py +252 -0
- tessera/policy/engine.py +72 -0
- tessera/policy/loader.py +235 -0
- tessera/policy/matchers.py +46 -0
- tessera/policy/regex_safety.py +54 -0
- tessera/policy/schema.py +191 -0
- tessera/proxy.py +792 -0
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cloudmorph-tessera
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: The open-source MCP firewall for AI agents
|
|
5
|
+
Author-email: CloudMorph AI <oss@cloudmorph.io>
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/CloudMorphAI/cloudmorph-tessera
|
|
8
|
+
Project-URL: Repository, https://github.com/CloudMorphAI/cloudmorph-tessera
|
|
9
|
+
Project-URL: Documentation, https://cloudmorph.ai/docs
|
|
10
|
+
Project-URL: Changelog, https://github.com/CloudMorphAI/cloudmorph-tessera/blob/main/CHANGELOG.md
|
|
11
|
+
Project-URL: Issues, https://github.com/CloudMorphAI/cloudmorph-tessera/issues
|
|
12
|
+
Keywords: mcp,model-context-protocol,firewall,security,policy-as-code,ai-agents,audit,cursor,claude-code
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Intended Audience :: System Administrators
|
|
16
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
17
|
+
Classifier: Operating System :: OS Independent
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Topic :: Security
|
|
21
|
+
Classifier: Topic :: System :: Networking :: Firewalls
|
|
22
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
23
|
+
Requires-Python: >=3.12
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Requires-Dist: fastapi==0.136.1
|
|
27
|
+
Requires-Dist: uvicorn[standard]==0.46.0
|
|
28
|
+
Requires-Dist: httpx==0.28.1
|
|
29
|
+
Requires-Dist: pydantic==2.12.5
|
|
30
|
+
Requires-Dist: typer==0.25.1
|
|
31
|
+
Requires-Dist: regex==2026.4.4
|
|
32
|
+
Requires-Dist: watchdog==6.0.0
|
|
33
|
+
Requires-Dist: PyYAML==6.0.3
|
|
34
|
+
Provides-Extra: dev
|
|
35
|
+
Requires-Dist: pytest==9.0.3; extra == "dev"
|
|
36
|
+
Requires-Dist: pytest-asyncio==1.3.0; extra == "dev"
|
|
37
|
+
Requires-Dist: pytest-cov==7.1.0; extra == "dev"
|
|
38
|
+
Requires-Dist: hypothesis==6.152.4; extra == "dev"
|
|
39
|
+
Requires-Dist: ruff==0.15.12; extra == "dev"
|
|
40
|
+
Requires-Dist: mypy==1.20.2; extra == "dev"
|
|
41
|
+
Requires-Dist: pre-commit==4.6.0; extra == "dev"
|
|
42
|
+
Requires-Dist: httpx==0.28.1; extra == "dev"
|
|
43
|
+
Requires-Dist: respx==0.23.1; extra == "dev"
|
|
44
|
+
Requires-Dist: tzdata==2026.2; extra == "dev"
|
|
45
|
+
Requires-Dist: jsonschema==4.23.0; extra == "dev"
|
|
46
|
+
Requires-Dist: bandit==1.9.4; extra == "dev"
|
|
47
|
+
Requires-Dist: pip-audit==2.10.0; extra == "dev"
|
|
48
|
+
Requires-Dist: cyclonedx-bom==7.3.0; extra == "dev"
|
|
49
|
+
Provides-Extra: runtime
|
|
50
|
+
Requires-Dist: fastapi==0.136.1; extra == "runtime"
|
|
51
|
+
Requires-Dist: uvicorn[standard]==0.46.0; extra == "runtime"
|
|
52
|
+
Requires-Dist: httpx==0.28.1; extra == "runtime"
|
|
53
|
+
Requires-Dist: pydantic==2.12.5; extra == "runtime"
|
|
54
|
+
Requires-Dist: typer==0.25.1; extra == "runtime"
|
|
55
|
+
Requires-Dist: regex==2026.4.4; extra == "runtime"
|
|
56
|
+
Requires-Dist: watchdog==6.0.0; extra == "runtime"
|
|
57
|
+
Requires-Dist: PyYAML==6.0.3; extra == "runtime"
|
|
58
|
+
Dynamic: license-file
|
|
59
|
+
|
|
60
|
+
# Tessera
|
|
61
|
+
|
|
62
|
+
<!-- mcp-name: io.github.CloudMorphAI/tessera -->
|
|
63
|
+
|
|
64
|
+
**The open-source MCP firewall for AI agents**
|
|
65
|
+
|
|
66
|
+
**See Tessera block a destructive Cursor action in 60 seconds → [cursor-hooks recipe](recipes/cursor-hooks.md)**
|
|
67
|
+
|
|
68
|
+
[](https://pypi.org/project/cloudmorph-tessera/)
|
|
69
|
+
[](https://pypi.org/project/cloudmorph-tessera/)
|
|
70
|
+
[](https://github.com/CloudMorphAI/cloudmorph-tessera/blob/main/LICENSE)
|
|
71
|
+
[](https://ghcr.io/cloudmorphai/tessera)
|
|
72
|
+
[](https://github.com/CloudMorphAI/cloudmorph-tessera/pkgs/container/tessera)
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## Why Tessera
|
|
77
|
+
|
|
78
|
+
AI agents calling MCP tools can delete production data, exfiltrate secrets, and exceed cost caps — all in a single tool call your code never explicitly authorized. Tessera is an HTTP proxy that sits between the agent and every MCP server; every `tools/call` request is evaluated against a YAML policy set before it reaches the upstream. Decisions are written to a hash-chain audit log so tampering is detectable. The engine is pure Python — no OPA, no ML, no cloud credentials — so the policy outcome for a given input is always the same. The 14 policies (7 core reference + 7 integration-specific) ship with the container; core policies are the same ones sold separately by other vendors.
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Installation
|
|
83
|
+
|
|
84
|
+
### Option 1: Docker (recommended for production)
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
docker pull ghcr.io/cloudmorphai/tessera:0.1.1
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Option 2: Python package (for local development and CLI use)
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
pip install cloudmorph-tessera
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
After install, verify:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
tessera version
|
|
100
|
+
# tessera 0.1.1
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Docker is the primary path for users running Tessera as a service. PyPI is the path for users who want to author policies locally or run `tessera policy lint` / `tessera policy test` in CI.
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## 5-minute quickstart
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
# Step 1: Pull
|
|
111
|
+
docker pull ghcr.io/cloudmorphai/tessera:0.1.1
|
|
112
|
+
|
|
113
|
+
# Step 2: Scaffold
|
|
114
|
+
docker run --rm -v "$PWD:/out" ghcr.io/cloudmorphai/tessera:0.1.1 tessera init --dir /out
|
|
115
|
+
# Creates tessera.yaml (mode: log_only), policies/, .env.example
|
|
116
|
+
|
|
117
|
+
# Step 3: Edit tessera.yaml — change upstreams[].url to your real MCP server URL
|
|
118
|
+
|
|
119
|
+
# Step 4: Start Tessera (log_only by default — safe to try, nothing is blocked yet)
|
|
120
|
+
docker run -d --name tessera \
|
|
121
|
+
-p 8080:8080 \
|
|
122
|
+
-v "$PWD/tessera.yaml:/etc/tessera/tessera.yaml:ro" \
|
|
123
|
+
-v "$PWD/policies:/etc/tessera/policies:ro" \
|
|
124
|
+
-v tessera_audit:/var/lib/tessera \
|
|
125
|
+
-e TESSERA_BEARER_TOKEN="tk_$(openssl rand -hex 16)" \
|
|
126
|
+
ghcr.io/cloudmorphai/tessera:0.1.1
|
|
127
|
+
|
|
128
|
+
# Step 5: Wire your agent — add to ~/.cursor/mcp.json:
|
|
129
|
+
# {
|
|
130
|
+
# "mcpServers": {
|
|
131
|
+
# "aws-via-tessera": {
|
|
132
|
+
# "url": "http://localhost:8080/mcp/aws",
|
|
133
|
+
# "headers": {"Authorization": "Bearer <your-token>"}
|
|
134
|
+
# }
|
|
135
|
+
# }
|
|
136
|
+
# }
|
|
137
|
+
# See docs/INTEGRATIONS.md for Claude Code, Claude Desktop, Windsurf.
|
|
138
|
+
|
|
139
|
+
# Step 6: Verify a tool call was logged
|
|
140
|
+
docker exec tessera tessera audit verify --scope default
|
|
141
|
+
|
|
142
|
+
# Step 7: When ready, switch to enforcement
|
|
143
|
+
# Edit tessera.yaml: change mode: log_only -> mode: enforcement
|
|
144
|
+
# Restart Tessera. Now block decisions fire.
|
|
145
|
+
|
|
146
|
+
# IMPORTANT: If exposing Tessera beyond localhost, put it behind nginx/Caddy
|
|
147
|
+
# with a rate-limit rule. Native rate limiting is on the v0.2 roadmap.
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## What ships
|
|
153
|
+
|
|
154
|
+
- **Multi-token bearer auth** — inline env var, YAML file, or single legacy token; per-token scope isolates audit streams. See [docs/CONFIGURATION.md](docs/CONFIGURATION.md).
|
|
155
|
+
- **Three enforcement modes** — `enforcement` (blocks fire), `log_only` (advisory, always forwards), `observation` (engine skipped). See [docs/CONFIGURATION.md](docs/CONFIGURATION.md).
|
|
156
|
+
- **16-condition pure-Python policy engine** — `arg_equals`, `arg_greater_than`, `arg_less_than`, `arg_matches_regex`, `arg_in_set`, `arg_contains_pattern`, `arg_size_greater_than`, `tool_name_in`, `action_class_in`, `intent_class_in`, `intent_purpose_matches`, `region_in`, `time_of_day_outside`, `meta_field_equals`, `any_of`, `none_of`. See [docs/POLICIES.md](docs/POLICIES.md).
|
|
157
|
+
- **Hash-chain audit log** — every event is chained to the previous via SHA-256; `tessera audit verify` detects any gap or tamper. Per-token scope isolation. See [docs/AUDIT.md](docs/AUDIT.md).
|
|
158
|
+
- **14 policies** — 7 core reference policies (`read-only-mode`, `prod-protection`, `secret-leak-block`, `pii-block`, `cost-cap`, `write-action-approval`, `data-residency-eu`) and 7 integration-specific protection policies (`github-mcp-protection`, `jira-mcp-protection`, `owasp-mcp-prompt-injection`, `owasp-mcp-tool-poisoning`, `postgres-mcp-protection`, `salesforce-mcp-protection`, `slack-mcp-protection`). See [docs/POLICIES.md](docs/POLICIES.md).
|
|
159
|
+
- **Per-file reload error isolation** — a bad YAML file is skipped and logged; the rest of the policy set remains live. See [docs/CONFIGURATION.md](docs/CONFIGURATION.md).
|
|
160
|
+
- **Regex safety (ReDoS defense)** — all regex conditions are evaluated via the `regex` library with a 100 ms timeout; a timeout returns `false` and tags the audit event. See [docs/POLICIES.md](docs/POLICIES.md).
|
|
161
|
+
- **Intent-blind agent support** — agents that do not declare intent in `_meta.tessera_intent` are handled by tool-name and argument policies. `intent.required: false` is the default. See [docs/INTEGRATIONS.md](docs/INTEGRATIONS.md).
|
|
162
|
+
- **CLI** — `tessera serve`, `tessera audit verify`, `tessera policy test`, `tessera policy lint`, `tessera version`, `tessera init`. See [docs/CONFIGURATION.md](docs/CONFIGURATION.md).
|
|
163
|
+
- **Multi-stage Docker image** — builder + slim runtime; runs as UID 10001 (non-root). See [docs/INSTALL.md](docs/INSTALL.md).
|
|
164
|
+
- **Three pluggable Protocols** — `Authenticator`, `PolicyLoader`, `AuditSink` are resolved via importlib at startup; swap implementations without modifying core code. See [tessera/pluggable.py](tessera/pluggable.py).
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## How it works
|
|
169
|
+
|
|
170
|
+
```
|
|
171
|
+
Agent --> [Tessera: auth --> engine --> audit] --> Upstream MCP
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Every inbound `POST /mcp/{upstream}` is:
|
|
175
|
+
|
|
176
|
+
1. Authenticated — bearer token matched against configured tokens; `AuthContext.scope` assigned.
|
|
177
|
+
2. Evaluated — policy engine walks the sorted policy set (first-match-wins) and returns `allow`, `block`, `log_only`, or `require_approval`.
|
|
178
|
+
3. Audited — the decision (and response, if forwarded) is written to the hash-chain.
|
|
179
|
+
|
|
180
|
+
In `enforcement` mode a `block` decision returns a JSON-RPC error (code `-32603`) over HTTP 200 to the agent and does not touch the upstream. In `log_only` mode the upstream is always called and the decision is returned in response headers (`X-Tessera-Decision`, `X-Tessera-Policy-Id`, `X-Tessera-Reason`).
|
|
181
|
+
|
|
182
|
+
Source code is under [tessera/](tessera/); contributor notes in [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## Configuration at a glance
|
|
187
|
+
|
|
188
|
+
```yaml
|
|
189
|
+
listen:
|
|
190
|
+
host: 0.0.0.0
|
|
191
|
+
port: 8080
|
|
192
|
+
|
|
193
|
+
auth:
|
|
194
|
+
type: bearer
|
|
195
|
+
|
|
196
|
+
policies:
|
|
197
|
+
dir: /etc/tessera/policies
|
|
198
|
+
reload: watch # watch | sighup | none
|
|
199
|
+
mode: log_only # enforcement | log_only | observation
|
|
200
|
+
default_action: block
|
|
201
|
+
|
|
202
|
+
upstreams:
|
|
203
|
+
- name: aws
|
|
204
|
+
url: https://mcp.aws.example.com
|
|
205
|
+
credentials:
|
|
206
|
+
header: Authorization
|
|
207
|
+
value: "Bearer ${AWS_MCP_TOKEN}" # resolved from environment at startup
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
Full reference: [docs/CONFIGURATION.md](docs/CONFIGURATION.md). Annotated example: [tessera.example.yaml](tessera.example.yaml).
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
## Authoring policies
|
|
215
|
+
|
|
216
|
+
```yaml
|
|
217
|
+
id: block-delete-prod
|
|
218
|
+
name: Block Delete in Production
|
|
219
|
+
description: Block delete calls targeting prod-suffixed resources.
|
|
220
|
+
match:
|
|
221
|
+
upstream: "*"
|
|
222
|
+
when:
|
|
223
|
+
- condition: action_class_in
|
|
224
|
+
values: ["write.delete"]
|
|
225
|
+
- condition: arg_matches_regex
|
|
226
|
+
arg: resource_name
|
|
227
|
+
pattern: ".*-prod$"
|
|
228
|
+
action: block
|
|
229
|
+
reason: "Delete blocked on production resource"
|
|
230
|
+
priority: 90
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
Policies are one YAML file per rule in the directory set by `policies.dir`. Files prefixed with `_` are skipped. The engine evaluates policies in descending `priority` order; the first matching policy wins. `when: []` (empty) matches every call.
|
|
234
|
+
|
|
235
|
+
Test before deploying:
|
|
236
|
+
|
|
237
|
+
```bash
|
|
238
|
+
tessera policy lint --policy-dir policies/
|
|
239
|
+
tessera policy test --policy-dir policies/ --fixture-dir tests/fixtures/
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
Full condition catalog and fixture format: [docs/POLICIES.md](docs/POLICIES.md).
|
|
243
|
+
|
|
244
|
+
---
|
|
245
|
+
|
|
246
|
+
## Routing your AI agent through Tessera (CLAUDE.md / system-prompt pattern)
|
|
247
|
+
|
|
248
|
+
Adding Tessera as one of many available MCP servers isn't enough — your agent will often prefer the direct cloud MCP server because it sees that one too. To make Tessera the default route for cloud tool calls, instruct the agent in its system context.
|
|
249
|
+
|
|
250
|
+
For **Claude Code**, drop a `CLAUDE.md` at your project root (or `~/.claude/CLAUDE.md` for global default):
|
|
251
|
+
|
|
252
|
+
```markdown
|
|
253
|
+
# Tool routing — use Tessera as the MCP firewall
|
|
254
|
+
|
|
255
|
+
When this project calls MCP tools that touch cloud resources (AWS, GCP, Azure,
|
|
256
|
+
Databricks, Snowflake, GitHub, Slack, Postgres, Kubernetes):
|
|
257
|
+
|
|
258
|
+
- **Always prefer the `tessera` MCP server** if the same tool is reachable
|
|
259
|
+
through it. Tessera enforces deterministic policy + writes a hash-chained
|
|
260
|
+
audit log of every call.
|
|
261
|
+
- If a tool is only available via a direct cloud MCP server, **stop and ask
|
|
262
|
+
the user before proceeding** — don't silently bypass the firewall.
|
|
263
|
+
- Read-only operations (list, describe, get) typically pass through normally.
|
|
264
|
+
- Destructive operations (delete, terminate, drop, force-push) WILL be blocked
|
|
265
|
+
by the shipped reference policies if they touch prod resources. When the
|
|
266
|
+
block response carries `error.data._meta.tessera_audit_event_id`, surface
|
|
267
|
+
the policy reason to the user verbatim.
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
For **Cursor**, equivalent goes in `.cursorrules` at project root, or in user-level Cursor settings. For **Claude Desktop**, put it in the global system prompt via Settings → "Personalization".
|
|
271
|
+
|
|
272
|
+
This pattern is the difference between "a firewall the user must remember to use" and "a firewall the agent uses by default." Combined with the 14 reference policies, it gives you defense-in-depth without per-call vigilance.
|
|
273
|
+
|
|
274
|
+
See [docs/INTEGRATIONS.md](docs/INTEGRATIONS.md) for per-client config recipes (Cursor, Claude Code, Claude Desktop).
|
|
275
|
+
|
|
276
|
+
---
|
|
277
|
+
|
|
278
|
+
## Tessera Cloud
|
|
279
|
+
|
|
280
|
+
Want hosted? Multi-tenant? SSO? Compliance evidence export? Tessera Cloud is the same engine with hosted orchestration. The same `Authenticator`, `PolicyLoader`, and `AuditSink` Protocols are used — the implementations are swapped (e.g., `DynamoDBPolicyLoader` instead of `FilesystemPolicyLoader`). Your existing `tessera.yaml` and policy files work without changes when you migrate. https://cloudmorph.ai
|
|
281
|
+
|
|
282
|
+
---
|
|
283
|
+
|
|
284
|
+
## Roadmap
|
|
285
|
+
|
|
286
|
+
Deferred from v0.1; detail and rationale in [docs/ROADMAP.md](docs/ROADMAP.md).
|
|
287
|
+
|
|
288
|
+
- **OAuth 2.1 PKCE** — v0.2; needed for SaaS/CI deployments where the identity issuer is a third-party IdP.
|
|
289
|
+
- **Native rate limiting** — v0.2; per-token token bucket; workaround in v0.1 is nginx/Caddy in front.
|
|
290
|
+
- **Postgres audit sink** — v0.2; the `AuditSink` Protocol is already designed for it; SQLite covers v0.1 write volume.
|
|
291
|
+
- **stdio transport** — v0.2; for Claude Desktop and agent runtimes that launch MCP servers as subprocesses.
|
|
292
|
+
- **Rego escape hatch** — v0.2; gated on a concrete use case the YAML condition catalog cannot express.
|
|
293
|
+
- **Multi-tenant isolation** — not planned for OSS; available in Tessera Cloud.
|
|
294
|
+
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
## Contributing
|
|
298
|
+
|
|
299
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md). Run `pip install -e ".[dev]"` and `pre-commit install` to get started.
|
|
300
|
+
|
|
301
|
+
## License
|
|
302
|
+
|
|
303
|
+
Apache-2.0. See [LICENSE](LICENSE).
|
|
304
|
+
|
|
305
|
+
## Security
|
|
306
|
+
|
|
307
|
+
Report vulnerabilities privately via [SECURITY.md](SECURITY.md).
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
cloudmorph_tessera-0.1.1.dist-info/licenses/LICENSE,sha256=YdF_UdSt6aaFr4X2SVED9Q5t51WwTJhr9z4ZTKBCLQk,11552
|
|
2
|
+
tessera/__init__.py,sha256=jecNhwTki6tTXQEsmF_Ke9DI-7pm3Ldn_uXhdXSoOf8,153
|
|
3
|
+
tessera/cli.py,sha256=yZL4KIgKl1f9vqV0sdsgkj2FBtEjYrXNIC-lI_dmJAc,17805
|
|
4
|
+
tessera/config.py,sha256=hhw7I5jlqREjyYaymDuWKrunCxaY2CEswPLbhsbe8Tc,7417
|
|
5
|
+
tessera/errors.py,sha256=RvETwtL0YtlxtLKGbuzw1EvdMmE_Y_5USZeuu5D-QjE,869
|
|
6
|
+
tessera/intent.py,sha256=EZrJJyo6TnFyparieu5N2xOEvL33yYHCYViTublV8HQ,1820
|
|
7
|
+
tessera/pluggable.py,sha256=TaghkfgY2I7vn6PoAk4Krozs3GAXIqK3SLeSYFuBGg8,1016
|
|
8
|
+
tessera/proxy.py,sha256=aSFIzrKEILYJkQSuhuhx6IdeE0AKsYecPtqal-0qT9M,31786
|
|
9
|
+
tessera/audit/__init__.py,sha256=Oa_qO7Euu-yVnw36NXSHMhryj5q6UGuXzddCiEuf1Iw,544
|
|
10
|
+
tessera/audit/canonical_json.py,sha256=jao3_WL0FTOAd2RWASPBGOZK1dowTaxcb4woF0TCKKM,2725
|
|
11
|
+
tessera/audit/chain.py,sha256=FrMs0YlauAI52GIorjsl48Ul_gwda96YHHNmxn1Nth0,3996
|
|
12
|
+
tessera/audit/emitter.py,sha256=oDLREXfJ2rc2D_rNm6zir2xP-hzEh1zWu0QEtLWPsk8,5139
|
|
13
|
+
tessera/audit/verifier.py,sha256=XBaso-tI4kUJB22blgKjBanE-04OVWc5FeMpCFzKaaY,2937
|
|
14
|
+
tessera/audit/sinks/__init__.py,sha256=v-t2baoS4knY9KJJ6bL95ijReicyPpe99SSgrTWzwwk,28
|
|
15
|
+
tessera/audit/sinks/base.py,sha256=bTagMhclNmn6bTE0vq6vcCOou0Jy62-DRPiluB8X0Wk,496
|
|
16
|
+
tessera/audit/sinks/buffered.py,sha256=ND5JZxvdEyBBsjw9Pfux3JfDJT507s1c2An6OwDmQGI,4531
|
|
17
|
+
tessera/audit/sinks/sqlite.py,sha256=uXOqQVba_8JmnVUMZQ1sqktxG58ln5Djtu6qzLvNIeI,4370
|
|
18
|
+
tessera/audit/sinks/stdout.py,sha256=dv-PJzy9gdfWBPKRin69AJxUywAlNT4cM47bJdqr-E8,1185
|
|
19
|
+
tessera/auth/__init__.py,sha256=gNaUe5KLmfEXT4C7ID9M_Ap2uYzY6EpCDyTc3GFU4FY,31
|
|
20
|
+
tessera/auth/base.py,sha256=Jr_9ZlHdNFsZbBWOsxv3jbXRgIELQcmvelssGxL3Ubo,652
|
|
21
|
+
tessera/auth/bearer.py,sha256=EklhDKk5wMrdIBMVCQIACU5YmNZkGxF920MAUY6falQ,7720
|
|
22
|
+
tessera/integrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
23
|
+
tessera/integrations/cursor_hooks.py,sha256=0BampFSrfjU0aiVoBArSGRUrGjePTr1qfnTg4RNiySs,4513
|
|
24
|
+
tessera/policy/__init__.py,sha256=ieoVxfpSQmKYl-q1oa04W50pGLWl4L169royWg40uQk,310
|
|
25
|
+
tessera/policy/action_verbs.py,sha256=IYVmwaB9kP6rf1j4mPAjC4bFNSqF4PNzOWorSZWYTqE,7992
|
|
26
|
+
tessera/policy/conditions.py,sha256=T8GvVih84sy7HTlHzapRXhUsrh0c0WWPZqgXNQzANpA,8685
|
|
27
|
+
tessera/policy/engine.py,sha256=Eq6KgSpznDTMehH7O6X-gGFFjJPyjvojQZxku_aKZJw,2542
|
|
28
|
+
tessera/policy/loader.py,sha256=A9soUAYvC662JJ1aSd2f_TuakDnevYw2AE_4eIlwlMA,9649
|
|
29
|
+
tessera/policy/matchers.py,sha256=foqQMvwo2_Y0Hxo2eEmP1YOT-AaSuSkwgVXQxAlvPhU,1361
|
|
30
|
+
tessera/policy/regex_safety.py,sha256=VtUHqvZA9J05YGVKVKSij7DxJ-_vpMowmB3Dj4VlnyQ,1879
|
|
31
|
+
tessera/policy/schema.py,sha256=_IfMfKDRFIwoklXO_Pul22GcBhLSWYpvRA3_xledeFk,4831
|
|
32
|
+
cloudmorph_tessera-0.1.1.dist-info/METADATA,sha256=_Ne8SwYzoCQSq8ia_eiNrxq2DZCAtGML7vf0p5Uv6ao,14788
|
|
33
|
+
cloudmorph_tessera-0.1.1.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
34
|
+
cloudmorph_tessera-0.1.1.dist-info/entry_points.txt,sha256=oVMcEWOXXJyZVLXxtDPbbIrZEQUO586qc8Yi_b5ott0,44
|
|
35
|
+
cloudmorph_tessera-0.1.1.dist-info/top_level.txt,sha256=joYc6MMtKOuVa-O6Kv_MMWu74pecOm0BEuAsX3G2Y3M,8
|
|
36
|
+
cloudmorph_tessera-0.1.1.dist-info/RECORD,,
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2026 CloudMorph AI, Inc.
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
tessera
|
tessera/__init__.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"""Tessera audit subsystem — public API."""
|
|
2
|
+
|
|
3
|
+
from tessera.audit import canonical_json
|
|
4
|
+
from tessera.audit.chain import HashChain
|
|
5
|
+
from tessera.audit.emitter import AuditEmitter
|
|
6
|
+
from tessera.audit.sinks.base import AuditSink
|
|
7
|
+
from tessera.audit.sinks.buffered import BufferedSink
|
|
8
|
+
from tessera.audit.sinks.sqlite import SqliteSink
|
|
9
|
+
from tessera.audit.sinks.stdout import StdoutSink
|
|
10
|
+
|
|
11
|
+
__all__ = [
|
|
12
|
+
"HashChain",
|
|
13
|
+
"AuditEmitter",
|
|
14
|
+
"AuditSink",
|
|
15
|
+
"SqliteSink",
|
|
16
|
+
"StdoutSink",
|
|
17
|
+
"BufferedSink",
|
|
18
|
+
"canonical_json",
|
|
19
|
+
]
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"""Canonical JSON serialization (RFC 8785 JCS).
|
|
2
|
+
|
|
3
|
+
Produces a byte-stable JSON representation across Python and TypeScript
|
|
4
|
+
implementations. Used as the input to the audit hash chain so that
|
|
5
|
+
auditors using either language compute identical event hashes.
|
|
6
|
+
|
|
7
|
+
Key invariants:
|
|
8
|
+
- UTF-8 encoded
|
|
9
|
+
- No whitespace
|
|
10
|
+
- Object keys sorted lexicographically (UTF-16 code units per spec)
|
|
11
|
+
- Numbers: integers as integers; floats round-trip per JSON.stringify semantics
|
|
12
|
+
- No NaN, no +/-Infinity (spec rejects these — we raise ValueError)
|
|
13
|
+
|
|
14
|
+
Reference: https://www.rfc-editor.org/rfc/rfc8785
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
from __future__ import annotations
|
|
18
|
+
|
|
19
|
+
import json
|
|
20
|
+
import math
|
|
21
|
+
from typing import Any
|
|
22
|
+
|
|
23
|
+
__all__ = ["canonical_json", "canonical_json_str"]
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def _normalize(value: Any) -> Any:
|
|
27
|
+
"""Recursively normalize a value into something json.dumps can handle deterministically."""
|
|
28
|
+
if value is None:
|
|
29
|
+
return None
|
|
30
|
+
if isinstance(value, bool):
|
|
31
|
+
return value
|
|
32
|
+
if isinstance(value, int):
|
|
33
|
+
return value
|
|
34
|
+
if isinstance(value, float):
|
|
35
|
+
if math.isnan(value) or math.isinf(value):
|
|
36
|
+
raise ValueError("canonical_json: NaN/Infinity not permitted by RFC 8785")
|
|
37
|
+
# Per JCS §3.2.2: integers must serialize as integers even if they came in as floats.
|
|
38
|
+
if value.is_integer() and abs(value) < 2**53:
|
|
39
|
+
return int(value)
|
|
40
|
+
return value
|
|
41
|
+
if isinstance(value, str):
|
|
42
|
+
return value
|
|
43
|
+
if isinstance(value, (list, tuple)):
|
|
44
|
+
return [_normalize(item) for item in value]
|
|
45
|
+
if isinstance(value, dict):
|
|
46
|
+
# Sort keys lexicographically. Reject non-string keys (would be ambiguous).
|
|
47
|
+
normalized: dict[str, Any] = {}
|
|
48
|
+
for key in sorted(value.keys()):
|
|
49
|
+
if not isinstance(key, str):
|
|
50
|
+
raise ValueError(f"canonical_json: non-string key not permitted: {key!r}")
|
|
51
|
+
normalized[key] = _normalize(value[key])
|
|
52
|
+
return normalized
|
|
53
|
+
if hasattr(value, "model_dump"): # pydantic v2 model
|
|
54
|
+
return _normalize(value.model_dump())
|
|
55
|
+
raise TypeError(f"canonical_json: unsupported type {type(value).__name__}")
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def canonical_json(value: Any) -> bytes:
|
|
59
|
+
"""Return RFC 8785 canonical JSON encoding of value as UTF-8 bytes.
|
|
60
|
+
|
|
61
|
+
Raises:
|
|
62
|
+
ValueError: on NaN/Infinity or non-string dict keys.
|
|
63
|
+
TypeError: on unsupported types.
|
|
64
|
+
"""
|
|
65
|
+
normalized = _normalize(value)
|
|
66
|
+
return json.dumps(normalized, ensure_ascii=False, separators=(",", ":"), sort_keys=True).encode("utf-8")
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def canonical_json_str(value: Any) -> str:
|
|
70
|
+
"""Same as canonical_json but returns a str (for use cases that need it)."""
|
|
71
|
+
return canonical_json(value).decode("utf-8")
|