cc-platform-sdk 2.2.0__tar.gz → 2.3.0__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.
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/CHANGELOG.md +16 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/PKG-INFO +25 -1
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/README.md +24 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/pyproject.toml +1 -1
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/__init__.py +3 -1
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/auth/__init__.py +3 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/auth/_resource_json.py +3 -19
- cc_platform_sdk-2.3.0/src/cc_platform_sdk/auth/federated_auth.py +181 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/auth/project_authority.py +28 -14
- cc_platform_sdk-2.3.0/src/cc_platform_sdk/core/_json_depth.py +23 -0
- cc_platform_sdk-2.3.0/src/cc_platform_sdk/eventenvelope/__init__.py +272 -0
- cc_platform_sdk-2.3.0/src/cc_platform_sdk/eventenvelope/_catalog_generated.py +21 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/events/__init__.py +5 -0
- cc_platform_sdk-2.3.0/src/cc_platform_sdk/events/wire.py +94 -0
- cc_platform_sdk-2.3.0/src/cc_platform_sdk/technology_management.py +267 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/transport/http/client.py +19 -6
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/transport/kafka/producer.py +19 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/conformance/test_all_specs.py +4 -1
- cc_platform_sdk-2.3.0/tests/conformance/test_envelope_v2.py +92 -0
- cc_platform_sdk-2.3.0/tests/conformance/test_federated_issuer.py +237 -0
- cc_platform_sdk-2.3.0/tests/conformance/test_technology_management.py +195 -0
- cc_platform_sdk-2.3.0/tests/conformance/test_wire_envelope.py +79 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/unit/test_distribution.py +1 -1
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/.gitignore +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/LICENSE +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/auth/acting_user.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/auth/config.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/auth/credential_provider.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/auth/exceptions.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/auth/jwks_client.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/auth/legacy_claims.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/auth/middleware.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/auth/models.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/auth/resource_v2.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/auth/security_identity.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/auth/service_principal.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/core/__init__.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/core/config/__init__.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/core/config/settings.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/core/config/standard_config.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/core/context/__init__.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/core/context/context.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/core/context/middleware.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/core/errors/__init__.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/core/errors/catalog.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/core/errors/codes.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/core/errors/exceptions.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/core/errors/protocol_mappings.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/core/feature_flags/__init__.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/core/feature_flags/provider.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/core/feature_flags/types.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/core/protocol/__init__.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/core/protocol/envelope.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/core/protocol/headers.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/core/protocol/service_tier.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/events/envelope.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/events/payloads.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/events/validation.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/infra/__init__.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/infra/cache/__init__.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/infra/cache/client.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/infra/ratelimit/__init__.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/infra/ratelimit/config.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/infra/ratelimit/limiter.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/knowledge/__init__.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/knowledge/reference.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/lifecycle/__init__.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/lifecycle/health.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/lifecycle/lifecycle.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/lifecycle/types.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/observability/__init__.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/observability/correlation.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/observability/diagnostics.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/observability/envelope.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/observability/instrumentation.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/observability/interfaces.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/observability/logging/__init__.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/observability/logging/logger.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/observability/metrics/__init__.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/observability/metrics/helpers.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/observability/metrics/registry.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/observability/noop.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/observability/tracing/__init__.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/observability/tracing/config.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/observability/tracing/tracer.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/transport/__init__.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/transport/grpc/__init__.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/transport/grpc/interceptors.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/transport/http/__init__.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/transport/http/retry.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/transport/kafka/__init__.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/transport/kafka/consumer.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/transport/kafka/errors.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/transport/serviceclient/__init__.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/transport/serviceclient/client.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/transport/serviceclient/discovery.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/transport/serviceclient/grpc_adapter.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/transport/serviceclient/http_adapter.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/transport/serviceclient/kafka_adapter.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/transport/serviceclient/types.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/utils/__init__.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/utils/ids.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/utils/serialization.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/utils/time.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/__init__.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/conformance/__init__.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/conformance/legacy_auth_corpus.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/conformance/loader.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/conformance/test_auth.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/conformance/test_contract_validation.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/conformance/test_errors.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/conformance/test_events.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/conformance/test_legacy_auth_cache.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/conformance/test_legacy_auth_context.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/conformance/test_legacy_auth_fresh.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/conformance/test_legacy_auth_v2.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/conformance/test_observability.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/conformance/test_project_authority.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/conformance/test_protocol.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/conformance/test_resource_v2.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/conformance/test_transport.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/fixtures/graph_reference/401-invalid-credential.json +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/fixtures/graph_reference/401-write-credential-on-read.json +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/fixtures/graph_reference/PROVENANCE +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/fixtures/graph_reference/get-400-id.json +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/fixtures/graph_reference/get-404.json +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/fixtures/graph_reference/get.json +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/fixtures/graph_reference/list-400-limit.json +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/fixtures/graph_reference/list-403-namespace.json +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/fixtures/graph_reference/list-503.json +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/fixtures/graph_reference/list-empty.json +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/fixtures/graph_reference/list-limit-last.json +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/fixtures/graph_reference/list-limit-more.json +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/fixtures/graph_reference/list.json +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/fixtures/graph_reference/responses.json +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/unit/__init__.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/unit/auth/__init__.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/unit/auth/test_credential_provider.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/unit/auth/test_middleware.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/unit/auth/test_project_authority.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/unit/auth/test_resource_v2.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/unit/auth/test_security_identity.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/unit/auth/test_service_principal.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/unit/config/__init__.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/unit/config/test_standard_config.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/unit/context/__init__.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/unit/context/test_propagation.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/unit/context/test_security_identity_context.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/unit/feature_flags/__init__.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/unit/feature_flags/test_provider.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/unit/knowledge/__init__.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/unit/knowledge/test_reference.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/unit/lifecycle/__init__.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/unit/lifecycle/test_lifecycle.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/unit/observability/__init__.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/unit/observability/test_correlation.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/unit/observability/test_hooks.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/unit/observability/test_instrumentation.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/unit/observability/test_interfaces.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/unit/observability/test_parity.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/unit/transport/__init__.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/unit/transport/test_abstraction.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/unit/transport/test_retry_integration.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/tests/unit/transport/test_service_client.py +0 -0
- {cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/uv.lock +0 -0
|
@@ -5,6 +5,22 @@ All notable changes to `cc-platform-sdk` will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [2.3.0]
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- `cc_platform_sdk.auth.FederatedAuth` routes enrolled issuers in the receiving cell to the existing JWKS verifier.
|
|
13
|
+
An empty or invalid key set reports `verifier_unavailable`. The single-issuer API remains available.
|
|
14
|
+
- `cc_platform_sdk.eventenvelope` adds canonical v2 encoding, closed-shape decoding and trusted subscription
|
|
15
|
+
admission before dispatch. The existing raw v1 consumer retains its API.
|
|
16
|
+
- `cc_platform_sdk.events.serialize_envelope` and `deserialize_envelope` convert SDK envelopes to and from
|
|
17
|
+
the legacy events v1 wire format used by existing product integrations. The decoder requires a nonblank
|
|
18
|
+
top-level `tenant_id` and reports `missing_tenant` if it is absent or invalid.
|
|
19
|
+
- `KafkaProducer.publish_envelope` sends the wire envelope with the `x-event-type` and `x-correlation-id` headers.
|
|
20
|
+
- Technology installation management v1 wire types and gateway client with shared lifecycle conformance.
|
|
21
|
+
- `HttpClient.get` / `post`: a keyword-only `refuse_redirects` that forces redirect refusal for one call. It can only
|
|
22
|
+
narrow `HttpClientConfig.follow_redirects`, never re-enable following; the technology-management client always sets it.
|
|
23
|
+
|
|
8
24
|
## [2.2.0]
|
|
9
25
|
|
|
10
26
|
### Added
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: cc-platform-sdk
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.3.0
|
|
4
4
|
Summary: Conscious Clouds Platform SDK for Python
|
|
5
5
|
License: Apache-2.0
|
|
6
6
|
License-File: LICENSE
|
|
@@ -211,3 +211,27 @@ see the companion package
|
|
|
211
211
|
## License
|
|
212
212
|
|
|
213
213
|
Apache 2.0 -- see [LICENSE](./LICENSE).
|
|
214
|
+
|
|
215
|
+
## Universal event envelope v2
|
|
216
|
+
|
|
217
|
+
`cc_platform_sdk.eventenvelope` provides `create_envelope`, `encode_envelope`, `decode_envelope` and
|
|
218
|
+
`decode_and_admit`. Use the supplied origin time to make a first emission. Encoding checks the governed event
|
|
219
|
+
catalog. Decode checks the closed JSON shape and 64-level depth rule. Before dispatch, pass the bytes and an
|
|
220
|
+
authorized subscription with an exact project, classification, tenant, owner and family to `decode_and_admit`.
|
|
221
|
+
An absent tenant or owner matches absence only. A v2 event's nonempty `correlation` is the ledger handle.
|
|
222
|
+
|
|
223
|
+
The shared canonical fixtures pin bytes, nanosecond timestamps and safe-integer payload values. Replays preserve the
|
|
224
|
+
event ID and occurrence time. Retain the original bytes when available. The codec makes no byte-equality claim for
|
|
225
|
+
arbitrary noncanonical input or for full Go float and escaping parity.
|
|
226
|
+
|
|
227
|
+
The existing raw Kafka consumer routes v1 product records as dictionaries and bypasses the v2 event codec and
|
|
228
|
+
verify trusted tenant scope. The v2 helpers do not add broker authorization, deduplication or offset policy.
|
|
229
|
+
|
|
230
|
+
## Technology installation management v1
|
|
231
|
+
|
|
232
|
+
Import `TechnologyManagementClient` and the contract types from `cc_platform_sdk.technology_management`. Pass the existing
|
|
233
|
+
SDK HTTP client configured for the Operator Gateway or an enrolled product gateway. The binding exposes
|
|
234
|
+
`get_installation` and `get_operation` for reading installation state and receipts, and `stage`, `activate`, and `rollback`
|
|
235
|
+
for changes. Changes require matching route and body scopes and a caller-supplied `idempotency_key`.
|
|
236
|
+
An executor refusal is represented on its receipt. A closed contract error is exposed as
|
|
237
|
+
`TechnologyManagementError`, with the original HTTP status when supplied by the gateway.
|
|
@@ -166,3 +166,27 @@ see the companion package
|
|
|
166
166
|
## License
|
|
167
167
|
|
|
168
168
|
Apache 2.0 -- see [LICENSE](./LICENSE).
|
|
169
|
+
|
|
170
|
+
## Universal event envelope v2
|
|
171
|
+
|
|
172
|
+
`cc_platform_sdk.eventenvelope` provides `create_envelope`, `encode_envelope`, `decode_envelope` and
|
|
173
|
+
`decode_and_admit`. Use the supplied origin time to make a first emission. Encoding checks the governed event
|
|
174
|
+
catalog. Decode checks the closed JSON shape and 64-level depth rule. Before dispatch, pass the bytes and an
|
|
175
|
+
authorized subscription with an exact project, classification, tenant, owner and family to `decode_and_admit`.
|
|
176
|
+
An absent tenant or owner matches absence only. A v2 event's nonempty `correlation` is the ledger handle.
|
|
177
|
+
|
|
178
|
+
The shared canonical fixtures pin bytes, nanosecond timestamps and safe-integer payload values. Replays preserve the
|
|
179
|
+
event ID and occurrence time. Retain the original bytes when available. The codec makes no byte-equality claim for
|
|
180
|
+
arbitrary noncanonical input or for full Go float and escaping parity.
|
|
181
|
+
|
|
182
|
+
The existing raw Kafka consumer routes v1 product records as dictionaries and bypasses the v2 event codec and
|
|
183
|
+
verify trusted tenant scope. The v2 helpers do not add broker authorization, deduplication or offset policy.
|
|
184
|
+
|
|
185
|
+
## Technology installation management v1
|
|
186
|
+
|
|
187
|
+
Import `TechnologyManagementClient` and the contract types from `cc_platform_sdk.technology_management`. Pass the existing
|
|
188
|
+
SDK HTTP client configured for the Operator Gateway or an enrolled product gateway. The binding exposes
|
|
189
|
+
`get_installation` and `get_operation` for reading installation state and receipts, and `stage`, `activate`, and `rollback`
|
|
190
|
+
for changes. Changes require matching route and body scopes and a caller-supplied `idempotency_key`.
|
|
191
|
+
An executor refusal is represented on its receipt. A closed contract error is exposed as
|
|
192
|
+
`TechnologyManagementError`, with the original HTTP status when supplied by the gateway.
|
|
@@ -97,7 +97,10 @@ from cc_platform_sdk.auth.project_authority import (
|
|
|
97
97
|
parse_authority_view,
|
|
98
98
|
)
|
|
99
99
|
|
|
100
|
+
from cc_platform_sdk.auth.federated_auth import FederatedAuth, FederationError, FederationRecord
|
|
101
|
+
|
|
100
102
|
__all__ = [
|
|
103
|
+
"FederatedAuth", "FederationError", "FederationRecord",
|
|
101
104
|
"InvalidSignatureError",
|
|
102
105
|
"ClaimsValidationProfile", "decode_legacy_claims", "validate_legacy_claims", "validate_claims_profile",
|
|
103
106
|
"create_security_identity_with_profile", "canonical_identity_projection",
|
|
@@ -10,6 +10,8 @@ import json
|
|
|
10
10
|
import math
|
|
11
11
|
from dataclasses import dataclass
|
|
12
12
|
|
|
13
|
+
from cc_platform_sdk.core._json_depth import check_container_depth
|
|
14
|
+
|
|
13
15
|
|
|
14
16
|
def _valid_string(value: str) -> None:
|
|
15
17
|
if any(ord(c) == 0xFFFD or 0xD800 <= ord(c) <= 0xDFFF for c in value):
|
|
@@ -103,25 +105,7 @@ def _serialize(value: object) -> str:
|
|
|
103
105
|
|
|
104
106
|
def canonical_resource_json(raw: str | bytes | bytearray) -> str:
|
|
105
107
|
text = decode_resource_json(raw)
|
|
106
|
-
|
|
107
|
-
# check below rejects invalid syntax; this walk only enforces the depth cap.
|
|
108
|
-
depth, in_string, escaped = 0, False, False
|
|
109
|
-
for character in text:
|
|
110
|
-
if in_string:
|
|
111
|
-
if escaped:
|
|
112
|
-
escaped = False
|
|
113
|
-
elif character == "\\":
|
|
114
|
-
escaped = True
|
|
115
|
-
elif character == '"':
|
|
116
|
-
in_string = False
|
|
117
|
-
elif character == '"':
|
|
118
|
-
in_string = True
|
|
119
|
-
elif character in "[{":
|
|
120
|
-
depth += 1
|
|
121
|
-
if depth > 64:
|
|
122
|
-
raise ValueError("JSON nesting limit")
|
|
123
|
-
elif character in "]}":
|
|
124
|
-
depth -= 1
|
|
108
|
+
check_container_depth(text, 64)
|
|
125
109
|
parsed = json.loads(text, object_pairs_hook=_object, parse_int=_number,
|
|
126
110
|
parse_float=_number, parse_constant=_constant)
|
|
127
111
|
return _serialize(parsed)
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
"""Cell-scoped routing to the existing per-issuer JWT verifier."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import base64
|
|
6
|
+
import json
|
|
7
|
+
import re
|
|
8
|
+
from collections.abc import Iterable, Mapping
|
|
9
|
+
from dataclasses import dataclass
|
|
10
|
+
from typing import Literal
|
|
11
|
+
from urllib.parse import urlsplit
|
|
12
|
+
|
|
13
|
+
from jwt.exceptions import PyJWKSetError
|
|
14
|
+
|
|
15
|
+
from cc_platform_sdk.auth.config import AuthConfig
|
|
16
|
+
from cc_platform_sdk.auth.exceptions import InvalidTokenError
|
|
17
|
+
from cc_platform_sdk.auth.jwks_client import JWKSClient
|
|
18
|
+
from cc_platform_sdk.auth.project_authority import (
|
|
19
|
+
AuthorityReason,
|
|
20
|
+
ProjectAuthorityDenied,
|
|
21
|
+
_actor_refusal,
|
|
22
|
+
_receiver_profile,
|
|
23
|
+
_user_without_email,
|
|
24
|
+
)
|
|
25
|
+
from cc_platform_sdk.auth.security_identity import SecurityIdentity
|
|
26
|
+
|
|
27
|
+
_VERIFYING_CELLS = frozenset(("operator-gateway", "ai-gateway", "conductor", "graph", "learning", "memory"))
|
|
28
|
+
_MESSAGES = {
|
|
29
|
+
"no_bearer": "federatedauth: missing or malformed Bearer token",
|
|
30
|
+
"unreadable_token": "federatedauth: token claims are unreadable",
|
|
31
|
+
"issuer_not_enrolled": "federatedauth: token issuer is not enrolled",
|
|
32
|
+
"cell_not_verifying": "federatedauth: the cell does not verify actor tokens",
|
|
33
|
+
"enrollment_jwks_override_forbidden": "enrollment_jwks_override_forbidden",
|
|
34
|
+
}
|
|
35
|
+
_BASE64URL = re.compile(r"[A-Za-z0-9_-]+")
|
|
36
|
+
# Unicode White_Space, as used by Go's unicode.IsSpace.
|
|
37
|
+
_WHITESPACE = re.compile(r"[\x09-\x0d\x20\x85\xa0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000]")
|
|
38
|
+
_LEEWAY = 5
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class FederationError(Exception):
|
|
42
|
+
"""Fixed denial from the federation boundary."""
|
|
43
|
+
|
|
44
|
+
def __init__(self, reason: str) -> None:
|
|
45
|
+
self.reason = reason
|
|
46
|
+
super().__init__(_MESSAGES[reason])
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
@dataclass(frozen=True)
|
|
50
|
+
class FederationRecord:
|
|
51
|
+
"""Trusted enrollment data supplied by the receiver's composition root."""
|
|
52
|
+
|
|
53
|
+
product_id: str
|
|
54
|
+
status: str
|
|
55
|
+
issuer: str
|
|
56
|
+
jwks_uri: str
|
|
57
|
+
audiences: tuple[str, ...]
|
|
58
|
+
jwks_uri_by_cell: Mapping[str, str] | None = None
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
@dataclass(frozen=True)
|
|
62
|
+
class _IssuerTrust:
|
|
63
|
+
product_id: str
|
|
64
|
+
jwks_url: str
|
|
65
|
+
audiences: tuple[str, ...]
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def _segment_object(segment: str) -> dict | None:
|
|
69
|
+
if not _BASE64URL.fullmatch(segment):
|
|
70
|
+
return None
|
|
71
|
+
try:
|
|
72
|
+
value = json.loads(base64.urlsafe_b64decode(segment + "=" * (-len(segment) % 4)).decode("utf-8"))
|
|
73
|
+
except (ValueError, RecursionError):
|
|
74
|
+
return None
|
|
75
|
+
return value if isinstance(value, dict) else None
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def _routing_input(authorization: str | None) -> tuple[str, str]:
|
|
79
|
+
scheme, separator, token = (authorization or "").partition(" ")
|
|
80
|
+
if not separator or scheme.lower() != "bearer" or not token:
|
|
81
|
+
raise FederationError("no_bearer")
|
|
82
|
+
if _WHITESPACE.search(token):
|
|
83
|
+
raise FederationError("unreadable_token")
|
|
84
|
+
parts = token.split(".", 2)
|
|
85
|
+
claims = _segment_object(parts[1]) if len(parts) >= 2 else None
|
|
86
|
+
issuer = claims.get("iss") if claims is not None else None
|
|
87
|
+
if not isinstance(issuer, str) or not issuer:
|
|
88
|
+
raise FederationError("unreadable_token")
|
|
89
|
+
return token, issuer
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
class FederatedAuth:
|
|
93
|
+
"""Verify an Authorization bearer against the selected enrollment record for one cell."""
|
|
94
|
+
|
|
95
|
+
def __init__(
|
|
96
|
+
self,
|
|
97
|
+
records: Iterable[FederationRecord],
|
|
98
|
+
cell: str,
|
|
99
|
+
*,
|
|
100
|
+
excluded_issuers: Iterable[str] = (),
|
|
101
|
+
source: Literal["file", "authority"] = "authority",
|
|
102
|
+
jwks_uri_overrides: Mapping[str, str] | None = None,
|
|
103
|
+
) -> None:
|
|
104
|
+
if cell not in _VERIFYING_CELLS:
|
|
105
|
+
raise FederationError("cell_not_verifying")
|
|
106
|
+
overrides = dict(jwks_uri_overrides or {})
|
|
107
|
+
records = tuple(records)
|
|
108
|
+
if (overrides and source != "file") or any(
|
|
109
|
+
r.jwks_uri_by_cell is not None and r.issuer in overrides for r in records
|
|
110
|
+
):
|
|
111
|
+
raise FederationError("enrollment_jwks_override_forbidden")
|
|
112
|
+
excluded = frozenset(excluded_issuers)
|
|
113
|
+
by_issuer: dict[str, FederationRecord] = {}
|
|
114
|
+
for record in sorted(records, key=lambda r: r.product_id):
|
|
115
|
+
if record.status == "active" and record.issuer and record.jwks_uri and record.issuer not in excluded:
|
|
116
|
+
by_issuer.setdefault(record.issuer, record)
|
|
117
|
+
self._trust: dict[str, _IssuerTrust] = {}
|
|
118
|
+
for issuer, record in by_issuer.items():
|
|
119
|
+
mapped = record.jwks_uri_by_cell
|
|
120
|
+
if mapped is not None and cell not in mapped:
|
|
121
|
+
continue
|
|
122
|
+
jwks_url = record.jwks_uri if mapped is None else mapped[cell]
|
|
123
|
+
self._trust[issuer] = _IssuerTrust(
|
|
124
|
+
record.product_id, overrides.get(issuer, jwks_url), tuple(record.audiences),
|
|
125
|
+
)
|
|
126
|
+
self._clients: dict[str, JWKSClient] = {}
|
|
127
|
+
|
|
128
|
+
def product_of(self, issuer: str) -> str:
|
|
129
|
+
"""Return the selected product for the issuer of a verified identity."""
|
|
130
|
+
selected = self._trust.get(issuer)
|
|
131
|
+
return selected.product_id if selected else ""
|
|
132
|
+
|
|
133
|
+
async def authenticate(self, authorization: str | None) -> SecurityIdentity:
|
|
134
|
+
token, issuer = _routing_input(authorization)
|
|
135
|
+
selected = self._trust.get(issuer)
|
|
136
|
+
if selected is None:
|
|
137
|
+
raise FederationError("issuer_not_enrolled")
|
|
138
|
+
|
|
139
|
+
client = self._clients.get(issuer)
|
|
140
|
+
if client is None:
|
|
141
|
+
client = self._build_verifier(issuer, selected)
|
|
142
|
+
self._clients[issuer] = client
|
|
143
|
+
|
|
144
|
+
# These header checks only refuse. The signing key and claims are still verified by JWKSClient.
|
|
145
|
+
header = _segment_object(token.partition(".")[0])
|
|
146
|
+
if header is None:
|
|
147
|
+
raise ProjectAuthorityDenied(AuthorityReason.CREDENTIAL_INVALID)
|
|
148
|
+
kid = header.get("kid")
|
|
149
|
+
if header.get("alg") != "RS256" or not isinstance(kid, str) or not kid:
|
|
150
|
+
raise ProjectAuthorityDenied(AuthorityReason.SIGNATURE_INVALID)
|
|
151
|
+
|
|
152
|
+
try:
|
|
153
|
+
identity = await client.validate_identity(token)
|
|
154
|
+
except Exception as exc: # noqa: BLE001 - collapse to a fixed refusal outside the handler
|
|
155
|
+
# PyJWT reports an empty or invalid key set through a separate
|
|
156
|
+
# exception type. JWKSClient wraps it in InvalidTokenError.
|
|
157
|
+
if isinstance(exc, InvalidTokenError) and isinstance(exc.__cause__, PyJWKSetError):
|
|
158
|
+
reason = AuthorityReason.VERIFIER_UNAVAILABLE
|
|
159
|
+
else:
|
|
160
|
+
reason = _actor_refusal(exc, token, issuer, selected.audiences, _LEEWAY)
|
|
161
|
+
else:
|
|
162
|
+
if not _user_without_email(identity):
|
|
163
|
+
return identity
|
|
164
|
+
reason = AuthorityReason.CREDENTIAL_INVALID
|
|
165
|
+
raise ProjectAuthorityDenied(reason)
|
|
166
|
+
|
|
167
|
+
@staticmethod
|
|
168
|
+
def _build_verifier(issuer: str, selected: _IssuerTrust) -> JWKSClient:
|
|
169
|
+
try:
|
|
170
|
+
url = urlsplit(selected.jwks_url)
|
|
171
|
+
if (url.scheme not in ("http", "https") or not url.hostname
|
|
172
|
+
or url.username is not None or url.fragment):
|
|
173
|
+
raise ValueError("Invalid JWKS location")
|
|
174
|
+
config = AuthConfig(
|
|
175
|
+
jwks_url=selected.jwks_url, jwt_issuer=issuer, jwt_audience=list(selected.audiences),
|
|
176
|
+
jwt_algorithm="RS256", jwt_leeway_seconds=_LEEWAY,
|
|
177
|
+
)
|
|
178
|
+
return JWKSClient(config, claims_profile=_receiver_profile(issuer, selected.audiences))
|
|
179
|
+
except (ValueError, TypeError, InvalidTokenError):
|
|
180
|
+
pass
|
|
181
|
+
raise FederationError("issuer_not_enrolled")
|
{cc_platform_sdk-2.2.0 → cc_platform_sdk-2.3.0}/src/cc_platform_sdk/auth/project_authority.py
RENAMED
|
@@ -599,6 +599,31 @@ def _rank(claims: Mapping[str, Any], *, path: Literal["actor", "service"], audie
|
|
|
599
599
|
return None
|
|
600
600
|
|
|
601
601
|
|
|
602
|
+
def _receiver_profile(issuer: str, audiences: tuple[str, ...]) -> ClaimsValidationProfile:
|
|
603
|
+
return ClaimsValidationProfile(
|
|
604
|
+
issuer=issuer, audiences=audiences, principal_kinds=("user", "service"),
|
|
605
|
+
token_purposes=("access",), required_nonempty_claims=(),
|
|
606
|
+
nullable_optional_claims=("email", "tenant_id", "jti"),
|
|
607
|
+
)
|
|
608
|
+
|
|
609
|
+
|
|
610
|
+
def _user_without_email(identity: SecurityIdentity) -> bool:
|
|
611
|
+
return is_user_identity(identity) and not identity.email
|
|
612
|
+
|
|
613
|
+
|
|
614
|
+
def _actor_refusal(
|
|
615
|
+
exc: BaseException, token: str, issuer: str, audiences: tuple[str, ...], leeway: float,
|
|
616
|
+
) -> AuthorityReason:
|
|
617
|
+
reason = classify_verification_error(exc) or AuthorityReason.CREDENTIAL_INVALID
|
|
618
|
+
if _actor_post_signature(exc):
|
|
619
|
+
claims = _verified_payload(token)
|
|
620
|
+
if claims is not None:
|
|
621
|
+
return _rank(
|
|
622
|
+
claims, path="actor", audiences=audiences, issuer=issuer, leeway=leeway,
|
|
623
|
+
) or reason
|
|
624
|
+
return reason
|
|
625
|
+
|
|
626
|
+
|
|
602
627
|
def _usable_uri(uri: str) -> bool:
|
|
603
628
|
return bool(uri) and uri != LOOPBACK_JWKS_PLACEHOLDER
|
|
604
629
|
|
|
@@ -650,11 +675,7 @@ class ProjectAuthorityVerifier:
|
|
|
650
675
|
jwks_cache_ttl_seconds=jwks_cache_ttl_seconds,
|
|
651
676
|
)
|
|
652
677
|
# Both kinds verify here: the KIND is the decision's to refuse (not_an_actor), after the signature.
|
|
653
|
-
profile =
|
|
654
|
-
issuer=p.issuer, audiences=tuple(p.audiences), principal_kinds=("user", "service"),
|
|
655
|
-
token_purposes=("access",), required_nonempty_claims=(),
|
|
656
|
-
nullable_optional_claims=("email", "tenant_id", "jti"),
|
|
657
|
-
)
|
|
678
|
+
profile = _receiver_profile(p.issuer, tuple(p.audiences))
|
|
658
679
|
self._actor[p.issuer] = JWKSClient(config, claims_profile=profile)
|
|
659
680
|
self._audiences[p.issuer] = tuple(p.audiences)
|
|
660
681
|
sp_uri = view.service_principal_issuer.jwks_uri
|
|
@@ -683,7 +704,6 @@ class ProjectAuthorityVerifier:
|
|
|
683
704
|
"""
|
|
684
705
|
reason: AuthorityReason | None = None
|
|
685
706
|
identity: SecurityIdentity | None = None
|
|
686
|
-
post_signature = False
|
|
687
707
|
issuer = _unverified_issuer(token) if isinstance(token, str) else None
|
|
688
708
|
if issuer is None:
|
|
689
709
|
reason = AuthorityReason.CREDENTIAL_INVALID
|
|
@@ -697,15 +717,9 @@ class ProjectAuthorityVerifier:
|
|
|
697
717
|
try:
|
|
698
718
|
identity = await client.validate_identity(token)
|
|
699
719
|
except Exception as exc: # noqa: BLE001 - classified; never re-raised or formatted
|
|
700
|
-
reason =
|
|
701
|
-
post_signature = _actor_post_signature(exc)
|
|
702
|
-
if post_signature and issuer is not None:
|
|
703
|
-
claims = _verified_payload(token)
|
|
704
|
-
if claims is not None:
|
|
705
|
-
reason = _rank(claims, path="actor", audiences=self._audiences.get(issuer, ()), issuer=issuer,
|
|
706
|
-
leeway=self._leeway) or reason
|
|
720
|
+
reason = _actor_refusal(exc, token, issuer, self._audiences[issuer], self._leeway)
|
|
707
721
|
# Go's TokenPayload.Validate: a user identity must carry a nonempty email (a service identity need not).
|
|
708
|
-
if reason is None and identity is not None and
|
|
722
|
+
if reason is None and identity is not None and _user_without_email(identity):
|
|
709
723
|
reason = AuthorityReason.CREDENTIAL_INVALID
|
|
710
724
|
# Raised OUTSIDE the handler, so the denial carries no chain to any underlying error text.
|
|
711
725
|
if reason is not None or identity is None:
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"""Bound JSON container nesting before invoking a recursive decoder."""
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def check_container_depth(text: str, limit: int) -> None:
|
|
5
|
+
# Bound container nesting before invoking the JSON decoder. Its grammar
|
|
6
|
+
# check below rejects invalid syntax; this walk only enforces the depth cap.
|
|
7
|
+
depth, in_string, escaped = 0, False, False
|
|
8
|
+
for character in text:
|
|
9
|
+
if in_string:
|
|
10
|
+
if escaped:
|
|
11
|
+
escaped = False
|
|
12
|
+
elif character == "\\":
|
|
13
|
+
escaped = True
|
|
14
|
+
elif character == '"':
|
|
15
|
+
in_string = False
|
|
16
|
+
elif character == '"':
|
|
17
|
+
in_string = True
|
|
18
|
+
elif character in "[{":
|
|
19
|
+
depth += 1
|
|
20
|
+
if depth > limit:
|
|
21
|
+
raise ValueError("JSON nesting limit")
|
|
22
|
+
elif character in "]}":
|
|
23
|
+
depth -= 1
|