Repository navigation
Conversation
License Check Results🚀 The license check job ran with the Bazel command: bazel run --lockfile_mode=error //:license-checkStatus: Click to expand output |
|
Documentation preview for this pull request is available at: |
6393fdc to
c6c240e
Compare
c6c240e to
b6b55e2
Compare
|
If I understand correctly, actually parsed values of |
| /// @brief Daemon-wide limits on key creation and key material per client connection. | ||
| /// | ||
| /// Owned by daemon configuration, not by individual key slots. | ||
| /// Provider operational limits belong to the respective provider implementation; |
There was a problem hiding this comment.
So the understanding here is, provider specific limits are not dictated by fbs/json config. is configured in provider. Max number of keys is limited by daemon wide limit.
There was a problem hiding this comment.
Yes, with one clarification: ResourceQuotaPolicy defines daemon-wide limits applied per client connection, such as the maximum number of ephemeral and loaded keys and the total key-material size. Provider-native capacity or operational limits are outside this general policy; if configurable, they belong to the provider-specific configuration and implementation.
|
|
||
| [[nodiscard]] static bool IsProviderAllowed(const std::string& provider_name, | ||
| const config::ProviderInitConfig& provider_config); | ||
| friend class ProviderManagerFactoryTestPeer; |
There was a problem hiding this comment.
Could we avoid adding a friend class solely for testing? Please check whether this behavior can be tested through the public Create() API instead. That would avoid exposing private implementation details to a test-only peer.
There was a problem hiding this comment.
I removed the test-only friend and moved the finalization helper into the implementation file. The factory tests now exercise the public ProviderManagerFactory::Create() API, while lower-level lifecycle and routing behavior remains covered by the ProviderManager unit tests.
| /// @param is_enabled Whether provider construction is enabled. | ||
| /// @param is_required Whether startup requires provider registration. | ||
| ProviderConstructionEntry(const common::ProviderName& name, bool is_enabled = true, bool is_required = false) | ||
| : providerName{name}, enabled{is_enabled}, required{is_required} |
There was a problem hiding this comment.
Why do we need is_enabled flag ? if some provider is not needed, it need not be specified in json config, what is the use case for having a provider configured in json but not enabling it ?
(of course this flag existed before)
There was a problem hiding this comment.
You are right. Since a non-empty construction policy already acts as an allowlist, enabled=false was redundant with omitting the provider. I removed the flag. Listed providers are allowed, while required distinguishes mandatory providers from optional ones.
| common::CryptoProviderType cryptoType{}; ///< Functional category | ||
| bool enabled{true}; ///< Whether this provider should be used | ||
| bool required{false}; ///< Whether startup must provide this provider | ||
| ResourceQuotaPolicy quota_policy{}; ///< Per-provider quota policy override |
There was a problem hiding this comment.
Don't we need this as part of provider config and only part of general config ?
There was a problem hiding this comment.
Discussed with @ChansAlive , for now, we can have only global limit for now.
There was a problem hiding this comment.
Understood. I kept ResourceQuotaPolicy as a daemon-wide global policy for now. Provider-specific operational limits can remain within each provider implementation.
There was a problem hiding this comment.
🟡 Changes recommended
The fallback comment needs clarification because disabling allowFallback does not prevent trying SOFTWARE after HARDWARE fails when both appear in preference_order.
1 open issue
What changed in this PR
Separates provider construction policy from runtime routing in the crypto daemon, giving startup requirements and provider selection distinct responsibilities.
Changes:
- Introduces independent construction and routing policies with validation.
- Applies provider enablement and registration requirements in the factory, while refining routing, diagnostics, and shutdown behavior.
- Adds policy and lifecycle tests, migrates existing callers, and updates architecture documentation.
| File | Description |
|---|---|
score/tests/demo/mac_multi_provider_demo.cpp |
Uses the routing-policy constructor. |
score/crypto/tests/cert_management/test_cert_module_startup.cpp |
Migrates startup fixtures to routing policies. |
score/crypto/src/daemon/provider/src/provider_manager.cpp |
Implements policy-based routing and shutdown safeguards. |
score/crypto/src/daemon/provider/src/provider_manager_test.cpp |
Expands routing, deferred-initialization, and lifecycle coverage. |
score/crypto/src/daemon/provider/src/provider_manager_factory.cpp |
Enforces construction policy and cleans up failed startup. |
score/crypto/src/daemon/provider/src/provider_manager_factory_test.cpp |
Tests startup requirements, errors, and cleanup. |
score/crypto/src/daemon/provider/provider_manager.hpp |
Defines the routing-focused manager interface and state. |
score/crypto/src/daemon/provider/provider_manager_factory.hpp |
Declares startup finalization and test access. |
score/crypto/src/daemon/provider/BUILD |
Adds the factory unit-test target. |
score/crypto/src/daemon/config/src/provider_policy_test.cpp |
Tests construction and routing policy validation. |
score/crypto/src/daemon/config/src/config.cpp |
Validates both provider policies. |
score/crypto/src/daemon/config/inc/config.hpp |
Defines separate policies and configuration accessors. |
score/crypto/src/daemon/config/BUILD |
Adds the policy unit-test target. |
score/crypto/src/daemon/cert_management/tests/truststore/test_trust_store_manager.cpp |
Migrates the trust-store fixture constructor. |
score/crypto/src/daemon/cert_management/tests/service/test_cert_management_service.cpp |
Migrates the service fixture constructor. |
score/crypto/src/daemon/cert_management/tests/integration/test_certificate_management_integration.cpp |
Migrates the integration fixture constructor. |
score/crypto/src/daemon/cert_management/slot/slot_handler_factory_test.cpp |
Updates the provider-manager test helper. |
score/crypto/src/daemon/cert_management/query/cert_object_response_builder_test.cpp |
Migrates the query fixture constructor. |
score/crypto/docs/architecture/provider_architecture.rst |
Documents policy ownership, routing, and startup semantics. |
score/crypto/docs/architecture/provider_architecture.puml |
Adds policy types and factory relationships. |
score/crypto/docs/architecture/key_management_sequence_diagrams.puml |
Updates the provider startup sequence. |
Review effort: Max (adaptive)
Not exactly. #290 is limited to resolving application-scoped provider resource identifiers to configured providers. This PR owns the typed construction/routing policy model and its routing behavior tests. Generic deployment parsing of these policies is not currently part of #290, while #149 covers provider-specific backend configuration. If deployment parsing is required as part of #143, I think we should explicitly agree on that scope or track it separately. |
7fa326a to
c09dd29
Compare
|
Hi @kssim , unable to review the selectively the additional commits after last review. in PR history only 2 commits are shown now, did you change the commit history before the push ? may be you need to check the policy set in autocrypto fork repo. |
Hi @GuruprasadBhatL, due to the rebase merge from master, I think the commits are updated. |
GuruprasadBhatL
left a comment
There was a problem hiding this comment.
Reviewed git diff 5cc8ac06993b3757bf7c8c98d9e9ef07cd57c149 c09dd29dfbceb805eddfb4d66c376b3ccf6fc292 after the previous requested changes.
Assumption here is 5cc8ac0 reflects the original changes although there is a force push.

Summary
ProviderManagerFactory.ProviderRoutingPolicy.Closes: #143
Design decisions
ProviderFactoryResultis retained instead of reducing the result toExpected<monostate, ErrorCode>, because partial success and provider-specific failures are needed for diagnostics.Scope
Application-scoped provider resource resolution is handled by #290.
Provider-specific runtime configuration parsing remains under #149.