odkn 0.5.0__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.
- odkn/README.md +42 -0
- odkn/__init__.py +195 -0
- odkn/__main__.py +8 -0
- odkn/_schemas/__init__.py +1 -0
- odkn/_schemas/odkn-access-descriptor.schema.json +323 -0
- odkn/_schemas/odkn-attestation.schema.json +89 -0
- odkn/_schemas/odkn-drift.schema.json +269 -0
- odkn/_schemas/odkn-frontmatter.schema.json +561 -0
- odkn/_schemas/odkn-governance-hint.schema.json +99 -0
- odkn/_schemas/odkn-manifest.schema.json +100 -0
- odkn/_schemas/odkn-origin.schema.json +36 -0
- odkn/_schemas/odkn-policy-lock.schema.json +48 -0
- odkn/_schemas/odkn-provider-cid.schema.json +140 -0
- odkn/_schemas/odkn-verify-result.schema.json +107 -0
- odkn/_wiring.py +633 -0
- odkn/adapters/README.md +25 -0
- odkn/adapters/__init__.py +82 -0
- odkn/adapters/contract_adapters.py +419 -0
- odkn/adapters/crypto_ed25519.py +169 -0
- odkn/adapters/csv_profiler.py +148 -0
- odkn/adapters/fs_bundle.py +358 -0
- odkn/adapters/git_probe.py +79 -0
- odkn/adapters/jsonschema_validator.py +94 -0
- odkn/adapters/provider_registry.py +91 -0
- odkn/adapters/snapshot_state.py +170 -0
- odkn/adapters/yaml_parser.py +243 -0
- odkn/application/README.md +24 -0
- odkn/application/__init__.py +64 -0
- odkn/application/bundle_verifier.py +636 -0
- odkn/application/crosswalk_service.py +578 -0
- odkn/application/manifest_service.py +99 -0
- odkn/application/profile_bundle.py +354 -0
- odkn/application/schema_index_service.py +393 -0
- odkn/application/sign_bundle.py +355 -0
- odkn/application/validate_bundle.py +1436 -0
- odkn/application/verify_bundle.py +979 -0
- odkn/attestation.py +48 -0
- odkn/cli.py +34 -0
- odkn/client.py +8 -0
- odkn/contracts.py +59 -0
- odkn/crosswalk.py +28 -0
- odkn/domain/README.md +25 -0
- odkn/domain/__init__.py +146 -0
- odkn/domain/crosswalk_rules.py +201 -0
- odkn/domain/drift_rules.py +108 -0
- odkn/domain/memory_bundle.py +158 -0
- odkn/domain/models.py +424 -0
- odkn/domain/okf_rules.py +192 -0
- odkn/domain/ports.py +245 -0
- odkn/domain/schema_markdown.py +226 -0
- odkn/domain/security.py +71 -0
- odkn/domain/tlp.py +88 -0
- odkn/domain/trust_policy.py +197 -0
- odkn/domain/value_objects.py +195 -0
- odkn/entrypoints/README.md +24 -0
- odkn/entrypoints/__init__.py +21 -0
- odkn/entrypoints/cli.py +647 -0
- odkn/entrypoints/client.py +113 -0
- odkn/entrypoints/mcp_stdio.py +306 -0
- odkn/mcp_server.py +20 -0
- odkn/models.py +52 -0
- odkn/okf.py +30 -0
- odkn/packager.py +14 -0
- odkn/profiler.py +23 -0
- odkn/providers.py +25 -0
- odkn/py.typed +0 -0
- odkn/schemas.py +20 -0
- odkn/tlp.py +30 -0
- odkn/validator.py +49 -0
- odkn/verifier.py +23 -0
- odkn-0.5.0.dist-info/METADATA +98 -0
- odkn-0.5.0.dist-info/RECORD +74 -0
- odkn-0.5.0.dist-info/WHEEL +4 -0
- odkn-0.5.0.dist-info/entry_points.txt +2 -0
odkn/README.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# odkn
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Native Python 3.11+ SDK, Draft 2020-12 JSON Schema validator, offline Ed25519 DSSE v1.0 signer/verifier, fail-closed `BundleVerifier`, `.tar.gz` packager, offline JSON-RPC 2.0 MCP stdio server, and Click CLI (`odkn`) implementing the Open Data Knowledge Network (`ODKN v0.3`–`v0.4.1`) profile over Open Knowledge Format (`OKF v0.3`).
|
|
6
|
+
|
|
7
|
+
The package is structured as a **Hexagonal (Ports & Adapters)** + **Tactical Domain-Driven Design (DDD)** architecture:
|
|
8
|
+
|
|
9
|
+
- `domain/` (`src/odkn/domain/`): Pure-stdlib domain models, `12` Ubiquitous Language `StrEnum`s, `6` frozen Value Objects (`ConceptId`, `BundleRelPath`, `Sha256Digest`, `Timestamp`, `HalfOpenInterval`, `SecurityClassification`), `MemoryBundle`/`OverlayBundle`, stateless domain policies, and `8` `typing.Protocol` driven ports (`domain/ports.py`).
|
|
10
|
+
- `application/` (`src/odkn/application/`): Stateless port-injected workflows (`validate_bundle`, `verify_bundle`, `bundle_verifier`, `sign_bundle`, `manifest_service`, `crosswalk_service`, `schema_index_service`, `profile_bundle`) with zero OS/third-party imports.
|
|
11
|
+
- `adapters/` (`src/odkn/adapters/`): Concrete outbound infrastructure (`BundleFS`, `AtomicFileSystemWriter`, YAML 1.2 Core Schema `_HardenedYAMLLoader`, `Draft202012Validator`, Ed25519 DSSE + PEM loaders, `ProviderRegistry`, cross-platform `FileLockSnapshotStateStore`, `GitSubprocessRevisionProbe`, Frictionless/ODCS/OpenAPI contract adapters, and streaming `CSVDistributionProfiler`).
|
|
12
|
+
- `entrypoints/` (`src/odkn/entrypoints/`): Driving interfaces (`ODKNClient`, `MCPServer`, and Click `cli`).
|
|
13
|
+
- `_wiring.py` (`src/odkn/_wiring.py`): Acyclic downward Composition Root binding default adapters into pure workflows.
|
|
14
|
+
- Backward-compatible flat shims (`models.py`, `tlp.py`, `okf.py`, `schemas.py`, `providers.py`, `attestation.py`, `validator.py`, `verifier.py`, `packager.py`, `contracts.py`, `crosswalk.py`, `profiler.py`, `mcp_server.py`, `client.py`, `cli.py`): Zero-logic re-export shims preserving `is` object identity for all `164` baseline public submodule definitions.
|
|
15
|
+
|
|
16
|
+
## Interface
|
|
17
|
+
|
|
18
|
+
- Public package exports (`__init__.py:__all__`, `88` symbols): `68` preserved v0.4.1 exports plus `6` Value Objects, `12` `StrEnum`s, `VerifiedConceptView`, and `BundleSizeLimitError`.
|
|
19
|
+
- Canonical extension & test-injection seams (prefer over monkeypatching legacy flat shims):
|
|
20
|
+
- Custom cryptographic providers: pass `providers: ProviderLookupPort | Mapping[str, VerificationProvider]` to `ODKNClient`, `BundleVerifier`, `MCPServer`, or `VerifyOptions`.
|
|
21
|
+
- Custom contract adapters / distribution profilers: register on `ContractAdapterRegistry` or `ProfilerRegistry`.
|
|
22
|
+
- Schema overrides & deterministic evaluation clocks: pass `ValidationOptions`, `VerifyOptions(now=...)`, or `BundleVerifier(..., now=...)`.
|
|
23
|
+
|
|
24
|
+
## Invariants
|
|
25
|
+
|
|
26
|
+
- All bundle reads and path resolutions stay strictly confined to bundle root; `..`, whitespace/backslashes, and escaping symlinks are rejected (`domain/value_objects.py:BundleRelPath`, `adapters/fs_bundle.py:BundleFS`).
|
|
27
|
+
- `ReadableBundlePort.read_verified_blob` opens regular files with `O_NOFOLLOW`, verifies `S_ISREG` and `<= 4 MiB` on the open descriptor, and returns `(raw_bytes, sha256_hex)` in one pass; `validate_and_verify_bundle` reuses verified control-plane bytes via `OverlayBundle` without re-reading disk.
|
|
28
|
+
- YAML parsing across frontmatter, data contracts, and `trust_providers.yaml` enforces the **YAML 1.2.2 §10.3.2 Core Schema** (zero aliases, zero duplicate keys, depth `<= 32`, `<= 10,000` nodes), emitting `ODKN-W007` on plain-style YAML 1.1 divergent mapping keys (`adapters/yaml_parser.py`).
|
|
29
|
+
- Authority inversion (`domain/trust_policy.py`, `application/verify_bundle.py`): `entity_type`, `trusted_by_node`, role scoping, and `custodians` prefix authority derive exclusively from local `NodeTrustConfig`.
|
|
30
|
+
- `MCPServer` (`entrypoints/mcp_stdio.py`) enforces session-wide anti-oracle masking (`-32000` `UNIFORM_MCP_ERROR_MESSAGE`) whenever `min_trust != "discovery"`, `bundle_restricted`, or `verifier.has_restricted_concepts` is true, pre-filters `Variable` concepts by resolved contract path before reading bytes, and caches extracted contract schemas by `(contract_path, sha256)`.
|
|
31
|
+
|
|
32
|
+
## Side Effects
|
|
33
|
+
|
|
34
|
+
- Confined exclusively to `adapters/` and `entrypoints/`: atomic `.sig.json`, `variables/index.md`, `.odkn/drift/`, and `0o600` `trust_providers.yaml` writes (`adapters/fs_bundle.py`), cross-platform file locks (`adapters/snapshot_state.py`), offline `git` HEAD probing (`adapters/git_probe.py`), and CLI/MCP stdio I/O (`entrypoints/`). `domain/` and `application/` perform zero I/O, lock, or subprocess operations.
|
|
35
|
+
|
|
36
|
+
## Verification
|
|
37
|
+
|
|
38
|
+
- Air-gapped / fast test suite: `PYTHONPATH=src pytest -v`
|
|
39
|
+
- Full CI property + branch-coverage gate (`>= 90%` overall, `>= 95%` `domain/`+`application/`):
|
|
40
|
+
- `ODKN_REQUIRE_HYPOTHESIS=1 HYPOTHESIS_PROFILE=ci PYTHONPATH=src pytest --cov=odkn --cov-branch --cov-fail-under=90 -v`
|
|
41
|
+
- `python3 -m coverage report --include="*odkn/domain/*,*odkn/application/*" --fail-under=95`
|
|
42
|
+
- Lint check: `ruff check src tests`
|
odkn/__init__.py
ADDED
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
"""Open Data Knowledge Network (ODKN v0.3) Hexagonal + Tactical DDD Python SDK."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import logging as _logging
|
|
6
|
+
|
|
7
|
+
from ._wiring import (
|
|
8
|
+
BundleVerifier,
|
|
9
|
+
generate_manifest,
|
|
10
|
+
load_node_trust_config,
|
|
11
|
+
pack_bundle_tar_gz,
|
|
12
|
+
profile_bundle_dir,
|
|
13
|
+
sign_artifact_ed25519,
|
|
14
|
+
sign_bundle_layers,
|
|
15
|
+
sign_concept_ed25519,
|
|
16
|
+
sign_index_ed25519,
|
|
17
|
+
sign_snapshot_ed25519,
|
|
18
|
+
sync_schema_indexes,
|
|
19
|
+
validate_bundle_dir,
|
|
20
|
+
validate_bundle_fs,
|
|
21
|
+
validate_crosswalks_and_variables,
|
|
22
|
+
verify_bundle_fs,
|
|
23
|
+
walk_concepts,
|
|
24
|
+
)
|
|
25
|
+
from .adapters.contract_adapters import default_contract_registry
|
|
26
|
+
from .adapters.crypto_ed25519 import LocalPubKeyProvider
|
|
27
|
+
from .adapters.csv_profiler import default_profiler_registry
|
|
28
|
+
from .adapters.fs_bundle import BundleFS, open_bundle
|
|
29
|
+
from .adapters.provider_registry import ProviderRegistry
|
|
30
|
+
from .adapters.yaml_parser import parse_document
|
|
31
|
+
from .domain.models import (
|
|
32
|
+
ODKN_VERSION,
|
|
33
|
+
ROLE_BUNDLE_MAINTAINER,
|
|
34
|
+
ROLE_CLI_EXECUTOR_SIGNER,
|
|
35
|
+
ROLE_CONCEPT_SIGNER,
|
|
36
|
+
ROLE_GOVERNANCE_SIGNER,
|
|
37
|
+
ROLE_OPS_SIGNER,
|
|
38
|
+
SCHEMA_VERSION,
|
|
39
|
+
AccessKind,
|
|
40
|
+
AccessTierHint,
|
|
41
|
+
AttestationRole,
|
|
42
|
+
AttributionResult,
|
|
43
|
+
BundleSizeLimitError,
|
|
44
|
+
BundleVerifyResult,
|
|
45
|
+
ConceptEntry,
|
|
46
|
+
ContractField,
|
|
47
|
+
ContractParseError,
|
|
48
|
+
CryptoTier,
|
|
49
|
+
DriftStatus,
|
|
50
|
+
EntityType,
|
|
51
|
+
Finding,
|
|
52
|
+
MinTrustProfile,
|
|
53
|
+
NodeProviderOverride,
|
|
54
|
+
NodeTrustConfig,
|
|
55
|
+
OKFDocument,
|
|
56
|
+
ProfileResult,
|
|
57
|
+
ProviderEvidence,
|
|
58
|
+
Severity,
|
|
59
|
+
SignerRole,
|
|
60
|
+
TLPLevel,
|
|
61
|
+
TrustTier,
|
|
62
|
+
ValidationOptions,
|
|
63
|
+
VariableBinding,
|
|
64
|
+
VerificationReport,
|
|
65
|
+
VerifiedConceptView,
|
|
66
|
+
VerifyConceptResult,
|
|
67
|
+
WrapperProvenance,
|
|
68
|
+
sort_findings,
|
|
69
|
+
)
|
|
70
|
+
from .domain.okf_rules import resolve_bundle_path
|
|
71
|
+
from .domain.ports import (
|
|
72
|
+
ContractAdapterRegistry,
|
|
73
|
+
ContractSchemaAdapter,
|
|
74
|
+
DistributionProfiler,
|
|
75
|
+
ProfilerRegistry,
|
|
76
|
+
VerificationContext,
|
|
77
|
+
VerificationProvider,
|
|
78
|
+
VerifyOptions,
|
|
79
|
+
)
|
|
80
|
+
from .domain.schema_markdown import render_schema_markdown
|
|
81
|
+
from .domain.tlp import (
|
|
82
|
+
TLP_AMBER,
|
|
83
|
+
TLP_AMBER_STRICT,
|
|
84
|
+
TLP_CLEAR,
|
|
85
|
+
TLP_GREEN,
|
|
86
|
+
TLP_RED,
|
|
87
|
+
extract_bundle_tlp_ceiling,
|
|
88
|
+
extract_tlp_tags,
|
|
89
|
+
is_restricted_tlp,
|
|
90
|
+
parse_tlp,
|
|
91
|
+
tlp_rank,
|
|
92
|
+
)
|
|
93
|
+
from .domain.value_objects import (
|
|
94
|
+
BundleRelPath,
|
|
95
|
+
ConceptId,
|
|
96
|
+
HalfOpenInterval,
|
|
97
|
+
SecurityClassification,
|
|
98
|
+
Sha256Digest,
|
|
99
|
+
Timestamp,
|
|
100
|
+
)
|
|
101
|
+
from .entrypoints.client import ODKNClient
|
|
102
|
+
from .entrypoints.mcp_stdio import UNIFORM_MCP_ERROR_MESSAGE, MCPServer
|
|
103
|
+
|
|
104
|
+
_logging.getLogger("odkn").addHandler(_logging.NullHandler())
|
|
105
|
+
|
|
106
|
+
__all__ = [
|
|
107
|
+
"AccessKind",
|
|
108
|
+
"AccessTierHint",
|
|
109
|
+
"AttestationRole",
|
|
110
|
+
"AttributionResult",
|
|
111
|
+
"BundleFS",
|
|
112
|
+
"BundleRelPath",
|
|
113
|
+
"BundleSizeLimitError",
|
|
114
|
+
"BundleVerifier",
|
|
115
|
+
"BundleVerifyResult",
|
|
116
|
+
"ConceptEntry",
|
|
117
|
+
"ConceptId",
|
|
118
|
+
"ContractAdapterRegistry",
|
|
119
|
+
"ContractField",
|
|
120
|
+
"ContractParseError",
|
|
121
|
+
"ContractSchemaAdapter",
|
|
122
|
+
"CryptoTier",
|
|
123
|
+
"DistributionProfiler",
|
|
124
|
+
"DriftStatus",
|
|
125
|
+
"EntityType",
|
|
126
|
+
"Finding",
|
|
127
|
+
"HalfOpenInterval",
|
|
128
|
+
"LocalPubKeyProvider",
|
|
129
|
+
"MCPServer",
|
|
130
|
+
"MinTrustProfile",
|
|
131
|
+
"NodeProviderOverride",
|
|
132
|
+
"NodeTrustConfig",
|
|
133
|
+
"ODKNClient",
|
|
134
|
+
"ODKN_VERSION",
|
|
135
|
+
"OKFDocument",
|
|
136
|
+
"ProfileResult",
|
|
137
|
+
"ProfilerRegistry",
|
|
138
|
+
"ProviderEvidence",
|
|
139
|
+
"ProviderRegistry",
|
|
140
|
+
"ROLE_BUNDLE_MAINTAINER",
|
|
141
|
+
"ROLE_CLI_EXECUTOR_SIGNER",
|
|
142
|
+
"ROLE_CONCEPT_SIGNER",
|
|
143
|
+
"ROLE_GOVERNANCE_SIGNER",
|
|
144
|
+
"ROLE_OPS_SIGNER",
|
|
145
|
+
"SCHEMA_VERSION",
|
|
146
|
+
"SecurityClassification",
|
|
147
|
+
"Severity",
|
|
148
|
+
"Sha256Digest",
|
|
149
|
+
"SignerRole",
|
|
150
|
+
"TLPLevel",
|
|
151
|
+
"TLP_AMBER",
|
|
152
|
+
"TLP_AMBER_STRICT",
|
|
153
|
+
"TLP_CLEAR",
|
|
154
|
+
"TLP_GREEN",
|
|
155
|
+
"TLP_RED",
|
|
156
|
+
"Timestamp",
|
|
157
|
+
"TrustTier",
|
|
158
|
+
"UNIFORM_MCP_ERROR_MESSAGE",
|
|
159
|
+
"ValidationOptions",
|
|
160
|
+
"VariableBinding",
|
|
161
|
+
"VerificationContext",
|
|
162
|
+
"VerificationProvider",
|
|
163
|
+
"VerificationReport",
|
|
164
|
+
"VerifiedConceptView",
|
|
165
|
+
"VerifyConceptResult",
|
|
166
|
+
"VerifyOptions",
|
|
167
|
+
"WrapperProvenance",
|
|
168
|
+
"default_contract_registry",
|
|
169
|
+
"default_profiler_registry",
|
|
170
|
+
"extract_bundle_tlp_ceiling",
|
|
171
|
+
"extract_tlp_tags",
|
|
172
|
+
"generate_manifest",
|
|
173
|
+
"is_restricted_tlp",
|
|
174
|
+
"load_node_trust_config",
|
|
175
|
+
"open_bundle",
|
|
176
|
+
"pack_bundle_tar_gz",
|
|
177
|
+
"parse_document",
|
|
178
|
+
"parse_tlp",
|
|
179
|
+
"profile_bundle_dir",
|
|
180
|
+
"render_schema_markdown",
|
|
181
|
+
"resolve_bundle_path",
|
|
182
|
+
"sign_artifact_ed25519",
|
|
183
|
+
"sign_bundle_layers",
|
|
184
|
+
"sign_concept_ed25519",
|
|
185
|
+
"sign_index_ed25519",
|
|
186
|
+
"sign_snapshot_ed25519",
|
|
187
|
+
"sort_findings",
|
|
188
|
+
"sync_schema_indexes",
|
|
189
|
+
"tlp_rank",
|
|
190
|
+
"validate_bundle_dir",
|
|
191
|
+
"validate_bundle_fs",
|
|
192
|
+
"validate_crosswalks_and_variables",
|
|
193
|
+
"verify_bundle_fs",
|
|
194
|
+
"walk_concepts",
|
|
195
|
+
]
|
odkn/__main__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Packaged ODKN v0.3 JSON Schemas (synchronized with usecases/odkn/schema/)."""
|
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://odkn.org/schemas/odkn-access-descriptor-v0.3.json",
|
|
4
|
+
"title": "ODKN v0.3 Access Descriptor Schema (Layer 2)",
|
|
5
|
+
"description": "RE2-safe Draft 2020-12 schema for .odkn/access/<concept_id>.access.json.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"schema_version": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"enum": ["0.3", "0.4"]
|
|
11
|
+
},
|
|
12
|
+
"concept_id": {
|
|
13
|
+
"$ref": "#/$defs/conceptId"
|
|
14
|
+
},
|
|
15
|
+
"resources": {
|
|
16
|
+
"type": "array",
|
|
17
|
+
"minItems": 1
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"required": ["schema_version", "concept_id", "resources"],
|
|
21
|
+
"if": {
|
|
22
|
+
"properties": { "schema_version": { "const": "0.3" } },
|
|
23
|
+
"required": ["schema_version"]
|
|
24
|
+
},
|
|
25
|
+
"then": {
|
|
26
|
+
"properties": {
|
|
27
|
+
"resources": {
|
|
28
|
+
"items": {
|
|
29
|
+
"allOf": [
|
|
30
|
+
{
|
|
31
|
+
"oneOf": [
|
|
32
|
+
{ "$ref": "#/$defs/tabularDescriptor" },
|
|
33
|
+
{ "$ref": "#/$defs/serverSQL" },
|
|
34
|
+
{ "$ref": "#/$defs/apiStream" },
|
|
35
|
+
{ "$ref": "#/$defs/cliSandbox" }
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"not": { "required": ["capabilities"] }
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"else": {
|
|
47
|
+
"properties": {
|
|
48
|
+
"resources": {
|
|
49
|
+
"items": {
|
|
50
|
+
"oneOf": [
|
|
51
|
+
{ "$ref": "#/$defs/tabularDescriptor" },
|
|
52
|
+
{ "$ref": "#/$defs/serverSQL" },
|
|
53
|
+
{ "$ref": "#/$defs/apiStream" },
|
|
54
|
+
{ "$ref": "#/$defs/cliSandbox" },
|
|
55
|
+
{ "$ref": "#/$defs/dataService" }
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"additionalProperties": false,
|
|
62
|
+
"$defs": {
|
|
63
|
+
"conceptId": {
|
|
64
|
+
"type": "string",
|
|
65
|
+
"pattern": "^[a-z0-9][a-z0-9/_-]*$",
|
|
66
|
+
"not": {
|
|
67
|
+
"anyOf": [
|
|
68
|
+
{ "pattern": "(^|/)\\.\\.($|/)" },
|
|
69
|
+
{ "pattern": "\\.md$" }
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
"resourceId": {
|
|
74
|
+
"type": "string",
|
|
75
|
+
"pattern": "^[a-z0-9][a-z0-9._-]{0,63}$"
|
|
76
|
+
},
|
|
77
|
+
"connectorId": {
|
|
78
|
+
"type": "string",
|
|
79
|
+
"pattern": "^[a-z0-9][a-z0-9._-]{1,63}$"
|
|
80
|
+
},
|
|
81
|
+
"capabilityTrait": {
|
|
82
|
+
"type": "string",
|
|
83
|
+
"pattern": "^[a-z0-9][a-z0-9._-]{1,63}$"
|
|
84
|
+
},
|
|
85
|
+
"httpsUri": {
|
|
86
|
+
"type": "string",
|
|
87
|
+
"format": "uri",
|
|
88
|
+
"pattern": "^https://[^\\s/?#]+(/[^\\s?#]*)?(\\?[^\\s#]*)?(#[^\\s]*)?$"
|
|
89
|
+
},
|
|
90
|
+
"locatorRef": {
|
|
91
|
+
"type": "string",
|
|
92
|
+
"minLength": 1,
|
|
93
|
+
"oneOf": [
|
|
94
|
+
{
|
|
95
|
+
"pattern": "^https://[^\\s\\x00-\\x1f\\x7f\\\\]+$"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"pattern": "^[a-z][a-z0-9_-]*:[^\\s\\x00-\\x1f\\x7f\\\\]+$",
|
|
99
|
+
"not": {
|
|
100
|
+
"anyOf": [
|
|
101
|
+
{ "pattern": "^(http|https|urn|mailto|file|data|javascript|ftp):" },
|
|
102
|
+
{ "pattern": "(^|/)\\.\\.($|/)" }
|
|
103
|
+
]
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"pattern": "^(?:[A-Za-z0-9._-]|%[0-9A-Fa-f]{2})+(?:/(?:[A-Za-z0-9._-]|%[0-9A-Fa-f]{2})+)*$",
|
|
108
|
+
"not": {
|
|
109
|
+
"pattern": "(^|/)\\.\\.($|/)"
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
]
|
|
113
|
+
},
|
|
114
|
+
"tabularDescriptor": {
|
|
115
|
+
"type": "object",
|
|
116
|
+
"properties": {
|
|
117
|
+
"id": { "$ref": "#/$defs/resourceId" },
|
|
118
|
+
"access_kind": { "type": "string", "const": "tabular-descriptor" },
|
|
119
|
+
"distribution_ref": { "$ref": "#/$defs/locatorRef" },
|
|
120
|
+
"contract_ref": { "$ref": "#/$defs/locatorRef" },
|
|
121
|
+
"connector_id": { "$ref": "#/$defs/connectorId" },
|
|
122
|
+
"capabilities": {
|
|
123
|
+
"type": "array",
|
|
124
|
+
"maxItems": 32,
|
|
125
|
+
"uniqueItems": true,
|
|
126
|
+
"items": { "$ref": "#/$defs/capabilityTrait" }
|
|
127
|
+
},
|
|
128
|
+
"max_bytes_hint": { "type": "integer", "minimum": 1 }
|
|
129
|
+
},
|
|
130
|
+
"required": ["id", "access_kind", "distribution_ref", "connector_id"],
|
|
131
|
+
"additionalProperties": false
|
|
132
|
+
},
|
|
133
|
+
"serverSQL": {
|
|
134
|
+
"type": "object",
|
|
135
|
+
"properties": {
|
|
136
|
+
"id": { "$ref": "#/$defs/resourceId" },
|
|
137
|
+
"access_kind": { "type": "string", "const": "server-sql" },
|
|
138
|
+
"protocol": { "type": "string", "enum": ["arrow-flight-sql"] },
|
|
139
|
+
"endpoint_uri": { "$ref": "#/$defs/httpsUri" },
|
|
140
|
+
"dialect": { "type": "string", "enum": ["duckdb", "trino", "postgres", "ansi"] },
|
|
141
|
+
"connector_id": { "$ref": "#/$defs/connectorId" },
|
|
142
|
+
"max_rows_hint": { "type": "integer", "minimum": 1 }
|
|
143
|
+
},
|
|
144
|
+
"required": ["id", "access_kind", "protocol", "endpoint_uri", "dialect", "connector_id"],
|
|
145
|
+
"additionalProperties": false
|
|
146
|
+
},
|
|
147
|
+
"apiStream": {
|
|
148
|
+
"type": "object",
|
|
149
|
+
"properties": {
|
|
150
|
+
"id": { "$ref": "#/$defs/resourceId" },
|
|
151
|
+
"access_kind": { "type": "string", "const": "api-stream" },
|
|
152
|
+
"protocol": { "type": "string", "enum": ["openapi-3.1", "mcp-streamable-http"] },
|
|
153
|
+
"contract_ref": { "$ref": "#/$defs/locatorRef" },
|
|
154
|
+
"mcp_server_uri": { "$ref": "#/$defs/httpsUri" },
|
|
155
|
+
"connector_id": { "$ref": "#/$defs/connectorId" },
|
|
156
|
+
"read_only": { "type": "boolean" }
|
|
157
|
+
},
|
|
158
|
+
"required": ["id", "access_kind", "protocol", "connector_id", "read_only"],
|
|
159
|
+
"oneOf": [
|
|
160
|
+
{
|
|
161
|
+
"properties": { "protocol": { "const": "openapi-3.1" } },
|
|
162
|
+
"required": ["contract_ref"]
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"properties": { "protocol": { "const": "mcp-streamable-http" } },
|
|
166
|
+
"required": ["mcp_server_uri"]
|
|
167
|
+
}
|
|
168
|
+
],
|
|
169
|
+
"additionalProperties": false
|
|
170
|
+
},
|
|
171
|
+
"argvLiteral": {
|
|
172
|
+
"type": "string",
|
|
173
|
+
"pattern": "^[^\\s\\x00-\\x1f\\x7f]+$",
|
|
174
|
+
"not": {
|
|
175
|
+
"pattern": "^(sh|bash|zsh|cmd|powershell)(\\.exe)?$"
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
"argvPlaceholder": {
|
|
179
|
+
"type": "object",
|
|
180
|
+
"properties": {
|
|
181
|
+
"name": { "type": "string", "pattern": "^[a-z][a-z0-9_]*$" },
|
|
182
|
+
"pattern": { "type": "string", "minLength": 1 },
|
|
183
|
+
"enum": {
|
|
184
|
+
"type": "array",
|
|
185
|
+
"minItems": 1,
|
|
186
|
+
"items": { "type": "string", "minLength": 1 }
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
"required": ["name"],
|
|
190
|
+
"additionalProperties": false
|
|
191
|
+
},
|
|
192
|
+
"cliSandbox": {
|
|
193
|
+
"type": "object",
|
|
194
|
+
"properties": {
|
|
195
|
+
"id": { "$ref": "#/$defs/resourceId" },
|
|
196
|
+
"access_kind": { "type": "string", "const": "cli-sandbox" },
|
|
197
|
+
"wrapper_provenance": {
|
|
198
|
+
"type": "string",
|
|
199
|
+
"enum": ["official-custodian", "third-party-adapter"]
|
|
200
|
+
},
|
|
201
|
+
"execution_mode": {
|
|
202
|
+
"type": "string",
|
|
203
|
+
"enum": ["oci-ro", "operator-local-binary"]
|
|
204
|
+
},
|
|
205
|
+
"binary_id": {
|
|
206
|
+
"type": "string",
|
|
207
|
+
"pattern": "^[a-z0-9][a-z0-9._-]{1,63}$",
|
|
208
|
+
"not": {
|
|
209
|
+
"pattern": "^(sh|bash|zsh|cmd|powershell)(\\.exe)?$"
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
"container_image_digest": {
|
|
213
|
+
"type": "string",
|
|
214
|
+
"pattern": "^sha256:[a-f0-9]{64}$"
|
|
215
|
+
},
|
|
216
|
+
"argv_template": {
|
|
217
|
+
"type": "array",
|
|
218
|
+
"items": {
|
|
219
|
+
"oneOf": [
|
|
220
|
+
{ "$ref": "#/$defs/argvLiteral" },
|
|
221
|
+
{ "$ref": "#/$defs/argvPlaceholder" }
|
|
222
|
+
]
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
"network_mode": {
|
|
226
|
+
"type": "string",
|
|
227
|
+
"enum": ["none", "operator-allowlist"]
|
|
228
|
+
},
|
|
229
|
+
"output_format": {
|
|
230
|
+
"type": "string",
|
|
231
|
+
"enum": ["json", "csv", "jsonl"]
|
|
232
|
+
},
|
|
233
|
+
"connector_id": { "$ref": "#/$defs/connectorId" }
|
|
234
|
+
},
|
|
235
|
+
"required": [
|
|
236
|
+
"id",
|
|
237
|
+
"access_kind",
|
|
238
|
+
"wrapper_provenance",
|
|
239
|
+
"execution_mode",
|
|
240
|
+
"binary_id",
|
|
241
|
+
"argv_template",
|
|
242
|
+
"network_mode",
|
|
243
|
+
"output_format",
|
|
244
|
+
"connector_id"
|
|
245
|
+
],
|
|
246
|
+
"allOf": [
|
|
247
|
+
{
|
|
248
|
+
"if": {
|
|
249
|
+
"properties": { "execution_mode": { "const": "oci-ro" } },
|
|
250
|
+
"required": ["execution_mode"]
|
|
251
|
+
},
|
|
252
|
+
"then": {
|
|
253
|
+
"required": ["container_image_digest"]
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
],
|
|
257
|
+
"additionalProperties": false
|
|
258
|
+
},
|
|
259
|
+
"dataService": {
|
|
260
|
+
"type": "object",
|
|
261
|
+
"properties": {
|
|
262
|
+
"id": { "$ref": "#/$defs/resourceId" },
|
|
263
|
+
"access_kind": { "type": "string", "const": "data-service" },
|
|
264
|
+
"endpoint_uri": { "$ref": "#/$defs/httpsUri" },
|
|
265
|
+
"conforms_to": {
|
|
266
|
+
"type": "string",
|
|
267
|
+
"minLength": 1,
|
|
268
|
+
"maxLength": 256,
|
|
269
|
+
"oneOf": [
|
|
270
|
+
{ "$ref": "#/$defs/httpsUri" },
|
|
271
|
+
{ "pattern": "^[a-z][a-z0-9-]*:[a-z0-9._-]+$" }
|
|
272
|
+
]
|
|
273
|
+
},
|
|
274
|
+
"resource_selector": {
|
|
275
|
+
"type": "string",
|
|
276
|
+
"pattern": "^[A-Za-z0-9][A-Za-z0-9:._/-]{0,255}$",
|
|
277
|
+
"not": {
|
|
278
|
+
"pattern": "(^|/)\\.\\.($|/)"
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
"supported_formats": {
|
|
282
|
+
"type": "array",
|
|
283
|
+
"minItems": 1,
|
|
284
|
+
"maxItems": 32,
|
|
285
|
+
"uniqueItems": true,
|
|
286
|
+
"items": {
|
|
287
|
+
"type": "string",
|
|
288
|
+
"minLength": 1,
|
|
289
|
+
"maxLength": 128,
|
|
290
|
+
"pattern": "^[A-Za-z0-9][A-Za-z0-9.+/;=_ -]*$"
|
|
291
|
+
}
|
|
292
|
+
},
|
|
293
|
+
"capabilities": {
|
|
294
|
+
"type": "array",
|
|
295
|
+
"maxItems": 32,
|
|
296
|
+
"uniqueItems": true,
|
|
297
|
+
"items": { "$ref": "#/$defs/capabilityTrait" }
|
|
298
|
+
},
|
|
299
|
+
"distribution_ref": { "$ref": "#/$defs/locatorRef" },
|
|
300
|
+
"contract_ref": { "$ref": "#/$defs/locatorRef" },
|
|
301
|
+
"max_bytes_hint": { "type": "integer", "minimum": 1 },
|
|
302
|
+
"max_features_hint": { "type": "integer", "minimum": 1 },
|
|
303
|
+
"read_only": { "type": "boolean" },
|
|
304
|
+
"connector_id": { "$ref": "#/$defs/connectorId" }
|
|
305
|
+
},
|
|
306
|
+
"required": [
|
|
307
|
+
"id",
|
|
308
|
+
"access_kind",
|
|
309
|
+
"endpoint_uri",
|
|
310
|
+
"conforms_to",
|
|
311
|
+
"resource_selector",
|
|
312
|
+
"supported_formats",
|
|
313
|
+
"read_only",
|
|
314
|
+
"connector_id"
|
|
315
|
+
],
|
|
316
|
+
"anyOf": [
|
|
317
|
+
{ "required": ["max_bytes_hint"] },
|
|
318
|
+
{ "required": ["max_features_hint"] }
|
|
319
|
+
],
|
|
320
|
+
"additionalProperties": false
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://odkn.org/schemas/odkn-attestation-v0.3.json",
|
|
4
|
+
"title": "ODKN v0.3 Attestation Envelope Schema (Concept, Access, Policy, Index, Snapshot)",
|
|
5
|
+
"description": "RE2-safe Draft 2020-12 schema for .odkn/attestations/concepts/<concept_id>.sig.json, .odkn/attestations/{access,policy}/<concept_id>.{access,policy}.sig.json, index.sig.json, and snapshot.sig.json.",
|
|
6
|
+
"oneOf": [
|
|
7
|
+
{ "$ref": "#/$defs/conceptAttestationFile" },
|
|
8
|
+
{ "$ref": "#/$defs/indexAttestationFile" },
|
|
9
|
+
{ "$ref": "#/$defs/snapshotAttestationFile" }
|
|
10
|
+
],
|
|
11
|
+
"$defs": {
|
|
12
|
+
"sha256Hex": {
|
|
13
|
+
"type": "string",
|
|
14
|
+
"pattern": "^[a-fA-F0-9]{64}$"
|
|
15
|
+
},
|
|
16
|
+
"rfc3339DateTime": {
|
|
17
|
+
"type": "string",
|
|
18
|
+
"pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}[Tt][0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]+)?([Zz]|[+-][0-9]{2}:[0-9]{2})$"
|
|
19
|
+
},
|
|
20
|
+
"providerId": {
|
|
21
|
+
"type": "string",
|
|
22
|
+
"pattern": "^[a-z0-9][a-z0-9._-]*$"
|
|
23
|
+
},
|
|
24
|
+
"attestationEntry": {
|
|
25
|
+
"type": "object",
|
|
26
|
+
"properties": {
|
|
27
|
+
"provider_id": { "$ref": "#/$defs/providerId" },
|
|
28
|
+
"mediaType": {
|
|
29
|
+
"type": "string",
|
|
30
|
+
"enum": [
|
|
31
|
+
"application/vnd.dsse.envelope.v1+json",
|
|
32
|
+
"application/vnd.dev.sigstore.bundle.v0.3+json",
|
|
33
|
+
"application/vc+jwt"
|
|
34
|
+
]
|
|
35
|
+
},
|
|
36
|
+
"envelope": { "type": "object" },
|
|
37
|
+
"bundle": { "type": "object" },
|
|
38
|
+
"jwt": { "type": "string", "minLength": 1 },
|
|
39
|
+
"tsa_token": {
|
|
40
|
+
"anyOf": [{ "type": "null" }, { "type": "string", "minLength": 1 }]
|
|
41
|
+
},
|
|
42
|
+
"rekor_entry": {
|
|
43
|
+
"anyOf": [{ "type": "null" }, { "type": "object" }]
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"required": ["provider_id", "mediaType"],
|
|
47
|
+
"additionalProperties": false
|
|
48
|
+
},
|
|
49
|
+
"conceptAttestationFile": {
|
|
50
|
+
"type": "object",
|
|
51
|
+
"properties": {
|
|
52
|
+
"schema_version": { "type": "string", "const": "0.3" },
|
|
53
|
+
"concept_id": {
|
|
54
|
+
"type": "string",
|
|
55
|
+
"minLength": 1,
|
|
56
|
+
"not": { "pattern": "^urn:odkn:" }
|
|
57
|
+
},
|
|
58
|
+
"attestations": {
|
|
59
|
+
"type": "array",
|
|
60
|
+
"minItems": 1,
|
|
61
|
+
"items": { "$ref": "#/$defs/attestationEntry" }
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"required": ["schema_version", "concept_id", "attestations"],
|
|
65
|
+
"additionalProperties": false
|
|
66
|
+
},
|
|
67
|
+
"indexAttestationFile": {
|
|
68
|
+
"type": "object",
|
|
69
|
+
"properties": {
|
|
70
|
+
"schema_version": { "type": "string", "const": "0.3" },
|
|
71
|
+
"kind": { "type": "string", "const": "index" },
|
|
72
|
+
"attestation": { "$ref": "#/$defs/attestationEntry" }
|
|
73
|
+
},
|
|
74
|
+
"required": ["schema_version", "kind", "attestation"],
|
|
75
|
+
"additionalProperties": false
|
|
76
|
+
},
|
|
77
|
+
"snapshotAttestationFile": {
|
|
78
|
+
"type": "object",
|
|
79
|
+
"properties": {
|
|
80
|
+
"schema_version": { "type": "string", "const": "0.3" },
|
|
81
|
+
"kind": { "type": "string", "const": "snapshot" },
|
|
82
|
+
"expires_at": { "$ref": "#/$defs/rfc3339DateTime" },
|
|
83
|
+
"attestation": { "$ref": "#/$defs/attestationEntry" }
|
|
84
|
+
},
|
|
85
|
+
"required": ["schema_version", "kind", "expires_at", "attestation"],
|
|
86
|
+
"additionalProperties": false
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|