Skip to content

Commit bfac76d

Browse files
feat: add owner_type and enforce protection for platform-owned versions (ACC-29)
1 parent bc52e3f commit bfac76d

6 files changed

Lines changed: 76 additions & 43 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 106
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/keycard%2Fkeycard-api-03f7de343b8ffa831ef87a5c388a5ae56dec933807487c3fdf3d0748214d347e.yml
3-
openapi_spec_hash: 125d9774561f361cbb4c83e143706895
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/keycard%2Fkeycard-api-ff839635f0b0cd1d66e886c2c67387c078bf0eb5599376c45af77fd1c7b161fa.yml
3+
openapi_spec_hash: c8b5fdab443323fe491f196a855b4f1d
44
config_hash: 8fdc6a9c1185417459f79052b1222ff0

src/keycardai_api/types/zones/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
from .public_key import PublicKey as PublicKey
2020
from .user_agent import UserAgent as UserAgent
2121
from .application import Application as Application
22-
from .attestation import Attestation as Attestation
2322
from .base_fields import BaseFields as BaseFields
2423
from .zone_member import ZoneMember as ZoneMember
2524
from .metadata_param import MetadataParam as MetadataParam
@@ -44,6 +43,7 @@
4443
from .secret_create_params import SecretCreateParams as SecretCreateParams
4544
from .secret_list_response import SecretListResponse as SecretListResponse
4645
from .secret_update_params import SecretUpdateParams as SecretUpdateParams
46+
from .attestation_statement import AttestationStatement as AttestationStatement
4747
from .metadata_update_param import MetadataUpdateParam as MetadataUpdateParam
4848
from .session_list_response import SessionListResponse as SessionListResponse
4949
from .session_update_params import SessionUpdateParams as SessionUpdateParams

src/keycardai_api/types/zones/attestation.py

Lines changed: 0 additions & 32 deletions
This file was deleted.
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from datetime import datetime
4+
from typing_extensions import Literal
5+
6+
from ..._models import BaseModel
7+
8+
__all__ = ["AttestationStatement"]
9+
10+
11+
class AttestationStatement(BaseModel):
12+
"""Decoded content of an Attestation JWS payload.
13+
14+
Describes the exact policy set version composition at attestation time. This schema defines what consumers see after base64url-decoding the Attestation.payload field.
15+
"""
16+
17+
attested_at: datetime
18+
19+
attested_by: str
20+
21+
key_id: str
22+
"""Key ID of the signing key used to produce the attestation signature.
23+
24+
Matches the "kid" in the JWS protected header.
25+
"""
26+
27+
manifest_sha: str
28+
"""SHA-256 of the policy set version manifest.
29+
30+
Verifiers MUST check this matches the policy_set_version.manifest_sha to detect
31+
attestation/version mismatches.
32+
"""
33+
34+
policy_set_id: str
35+
36+
policy_set_version: int
37+
38+
status: Literal["created", "re_signed"]
39+
"""Event that produced this attestation.
40+
41+
"created" is the initial attestation at version creation; "re_signed" is a
42+
re-attestation after key rotation (same content, new signature).
43+
"""
44+
45+
type: Literal["policy_set_attestation"]
46+
"""Statement type discriminator"""
47+
48+
v: Literal[1]
49+
"""Statement schema version"""
50+
51+
zone_id: str

src/keycardai_api/types/zones/policies/policy_version.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from typing import Optional
44
from datetime import datetime
5+
from typing_extensions import Literal
56

67
from ...._models import BaseModel
78

@@ -15,6 +16,13 @@ class PolicyVersion(BaseModel):
1516

1617
created_by: str
1718

19+
owner_type: Literal["platform", "customer"]
20+
"""Who manages this policy version:
21+
22+
- `"platform"` — managed by the Keycard platform (system policy versions).
23+
- `"customer"` — managed by the tenant (custom policy versions).
24+
"""
25+
1826
policy_id: str
1927

2028
schema_version: str

src/keycardai_api/types/zones/policy_sets/policy_set_version.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22

33
from typing import Optional
44
from datetime import datetime
5+
from typing_extensions import Literal
56

67
from ...._models import BaseModel
7-
from ..attestation import Attestation
88
from ..policy_set_manifest import PolicySetManifest
9+
from ..attestation_statement import AttestationStatement
910

1011
__all__ = ["PolicySetVersion"]
1112

@@ -22,6 +23,13 @@ class PolicySetVersion(BaseModel):
2223
manifest_sha: str
2324
"""Hex-encoded SHA-256 of the canonicalized manifest"""
2425

26+
owner_type: Literal["platform", "customer"]
27+
"""Who manages this policy set version:
28+
29+
- `"platform"` — managed by the Keycard platform (system policy set versions).
30+
- `"customer"` — managed by the tenant (custom policy set versions).
31+
"""
32+
2533
policy_set_id: str
2634

2735
schema_version: str
@@ -39,12 +47,10 @@ class PolicySetVersion(BaseModel):
3947

4048
archived_by: Optional[str] = None
4149

42-
attestation: Optional[Attestation] = None
43-
"""JWS Flattened JSON Serialization (RFC 7515 §7.2.2) of a policy set attestation.
50+
attestation: Optional[AttestationStatement] = None
51+
"""Decoded content of an Attestation JWS payload.
4452
45-
The protected header carries the signing algorithm and key identifier; the
46-
payload is a base64url-encoded AttestationStatement canonicalized per RFC 8785
47-
(JCS). Verify using the zone JWKS endpoint (RFC 7517). Currently signed with
48-
RS256; future zone key types (e.g. EdDSA) will be indicated by the "alg" header
49-
— no envelope changes required.
53+
Describes the exact policy set version composition at attestation time. This
54+
schema defines what consumers see after base64url-decoding the
55+
Attestation.payload field.
5056
"""

0 commit comments

Comments
 (0)