Repository navigation
Add Radius recipe parameters and secret management - #18834
Mitch Denny (mitchdenny) merged 18 commits into
Conversation
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 18834Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 18834" |
There was a problem hiding this comment.
Pull request overview
Adds publish/deploy-only secret-provider and recipe-configuration capabilities to the Radius deployment-target integration.
Changes:
- Adds scoped recipe parameters with late-bound values.
- Adds inline, existing, and sealed secret stores.
- Adds validation, Bicep generation, deployment orchestration, documentation, and tests.
Reviewed changes
Copilot reviewed 40 out of 40 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
tests/.../SecretStoreValidationTests.cs |
Tests store validation diagnostics. |
tests/.../SecretStoreDefaultPathTests.cs |
Tests default and Run-mode behavior. |
tests/.../SecretStoreConsumerTests.cs |
Tests consumer annotations. |
tests/.../SealedSecretManifestTests.cs |
Tests manifest security validation. |
tests/.../SealedSecretArtifactTests.cs |
Tests artifact paths. |
tests/.../SealedSecretApplyStepTests.cs |
Tests apply and synchronization logic. |
tests/.../AddRadiusSecretStoreTests.cs |
Tests store APIs. |
tests/.../WithRecipeParametersTests.cs |
Tests parameter registration. |
tests/.../RecipeParameterIsolationAndFidelityTests.cs |
Tests environment isolation. |
tests/.../RecipeParameterAdvancedTests.cs |
Tests nested and late-bound parameters. |
tests/.../RecipePackParametersBicepTests.cs |
Tests recipe Bicep output. |
tests/.../SecretStoreConsumerBicepTests.cs |
Tests consumer Bicep output. |
tests/.../SealedSecretPublishTests.cs |
Tests sealed-secret publishing. |
tests/.../RadiusDeployParametersTests.cs |
Tests deploy parameter bindings. |
tests/.../InlineSecretStoreBicepTests.cs |
Tests inline-store output. |
tests/.../ExistingSecretStoreBicepTests.cs |
Tests existing-secret output. |
Secrets/SealedSecretManifest.cs |
Validates encrypted manifests. |
Secrets/SealedSecretArtifact.cs |
Resolves artifact paths. |
Secrets/RadiusSecretStoreValidation.cs |
Implements fail-fast validation. |
Secrets/RadiusSecretStoreType.cs |
Defines store types and encodings. |
Secrets/RadiusSecretStoreResource.cs |
Models secret stores. |
Secrets/RadiusSecretStorePopulation.cs |
Models population modes. |
Secrets/RadiusSecretStoreNaming.cs |
Validates store names. |
Secrets/RadiusSecretStoreExtensions.cs |
Adds store builder APIs. |
Secrets/RadiusSecretStoreConsumerExtensions.cs |
Adds consumer APIs. |
Secrets/RadiusSecretStoreConsumer.cs |
Models consumer wiring. |
Recipes/RadiusRecipeParameterExtensions.cs |
Adds recipe parameter APIs. |
Recipes/RadiusProviderReference.cs |
Defines provider references. |
README.md |
Documents new features. |
RadiusEnvironmentResource.cs |
Adds validation/apply pipeline stages. |
Publishing/RadiusInfrastructureOptions.cs |
Carries generated secret and parameter state. |
Publishing/RadiusBicepPublishingContext.cs |
Copies sealed manifests. |
Publishing/Constructs/RadiusSecretStoreConstruct.cs |
Models secret-store Bicep resources. |
Publishing/BicepPostProcessor.cs |
Emits and validates new symbols. |
CloudProviders/RadiusCloudProviderExtensions.cs |
Documents export suppression. |
Aspire.Hosting.Radius.csproj |
Adds YamlDotNet. |
Annotations/RadiusSecretStoresAnnotation.cs |
Stores consumer wiring. |
Annotations/RadiusRecipeParametersAnnotation.cs |
Stores scoped recipe parameters. |
Harden and tighten the Radius secret-store surface in response to Copilot review comments: - SealedSecretManifest: fail closed in EmbedsPlaintextSecret when the embedded last-applied-configuration has duplicate/missing/non-string kind or duplicate data/stringData, so a crafted payload cannot smuggle plaintext past a single TryGetProperty lookup. - WithSealedSecret: resolve a relative manifest path against the AppHost directory (matching other hosting file APIs) so it works regardless of the process working directory. - RadiusSecretStoreNaming: align the store-name grammar with Aspire's resource-name grammar (letters/digits/hyphens, start-with-letter, no consecutive/trailing hyphen, <=64) so publish mode (AddResource) never rejects a name run mode accepted. Update the ASPIRERADIUS049 message. - WithData: add a single-key convenience overload binding a data key to a secret parameter, delegating transactionally to the callback form. - SealedSecretApplyStep.GetSealedSecretStatusAsync: only treat SealedSecret NotFound or transient connectivity failures as retryable; surface permanent kubectl failures (auth/RBAC/context/missing plugin) immediately instead of waiting out the whole materialization budget. Adds 22 targeted tests (357 total, all passing). Co-authored-by: Copilot <[email protected]> Copilot-Session: b76dc20d-c553-47b7-8f5e-6fcdc0f10aa3
Harden and tighten the Radius secret-store surface in response to Copilot review comments: - SealedSecretManifest: fail closed in EmbedsPlaintextSecret when the embedded last-applied-configuration has duplicate/missing/non-string kind or duplicate data/stringData, so a crafted payload cannot smuggle plaintext past a single TryGetProperty lookup. - WithSealedSecret: resolve a relative manifest path against the AppHost directory (matching other hosting file APIs) so it works regardless of the process working directory. - RadiusSecretStoreNaming: align the store-name grammar with Aspire's resource-name grammar (letters/digits/hyphens, start-with-letter, no consecutive/trailing hyphen, <=64) so publish mode (AddResource) never rejects a name run mode accepted. Update the ASPIRERADIUS049 message. - WithData: add a single-key convenience overload binding a data key to a secret parameter, delegating transactionally to the callback form. - SealedSecretApplyStep.GetSealedSecretStatusAsync: only treat SealedSecret NotFound or transient connectivity failures as retryable; surface permanent kubectl failures (auth/RBAC/context/missing plugin) immediately instead of waiting out the whole materialization budget. Adds 22 targeted tests (357 total, all passing). Co-authored-by: Copilot <[email protected]> Copilot-Session: b76dc20d-c553-47b7-8f5e-6fcdc0f10aa3
6f5c0f3 to
0013878
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 40 out of 40 changed files in this pull request and generated 3 comments.
Comments suppressed due to low confidence (1)
src/Aspire.Hosting.Radius/Secrets/RadiusSecretStoreNaming.cs:69
- Uppercase letters pass this check, but an inline store with no
resourcereference is materialized by Radius as a Kubernetes Secret whosemetadata.nameis the store name. Kubernetes object names reject uppercase, so names such asDbCredspass AppHost validation and then fail only during deployment. Enforce the target-compatible lowercase DNS grammar, or separate the Aspire resource name from the physical secret-store/Secret name.
else if (char.IsAsciiLetterOrDigit(c))
…e inline key rejection, existing-secret reference validation Re-review of PR microsoft#18834 raised three additional findings on the Radius secret-store surface: - Terraform Git PAT auth now requires the referenced store to declare a 'pat' key (optionally 'username'), matching what Radius reads for recipeConfig.terraform.authentication.git.pat, instead of accepting a basicAuthentication username/password store it cannot use (ASPIRERADIUS051). - RadiusSecretStoreDataBuilder.Add rejects a duplicate inline key via TryAdd instead of silently overwriting through the dictionary indexer, so a double-declared key surfaces at the call site (ASPIRERADIUS043). - WithExistingSecret validates the '[namespace/]name' reference at the API boundary (single separator, DNS-1123 name/namespace) rather than deferring a malformed reference to deploy time (ASPIRERADIUS046). Adds targeted tests and updates the README diagnostics table and xmldoc. Co-authored-by: Copilot <[email protected]> Copilot-Session: b76dc20d-c553-47b7-8f5e-6fcdc0f10aa3
…ialization timeout, validate sealed manifest names A second re-review round on PR microsoft#18834 raised three findings: - ConfigureRadiusInfrastructure exposes secret stores (opts.SecretStores), but the identifier snapshot/rewire logic ignored them. Renaming a store construct left recipeConfig referencing the old <identifier>.id, and renaming the legacy application/environment left the store's ApplicationId/EnvironmentId pointing at stale symbols. Extended IdentifierSnapshot and added RewireSecretStoreReferences to rewrite both consumer references and parent scope IDs. - WithMaterializationTimeout accepted values above int.MaxValue milliseconds (e.g. TimeSpan.MaxValue) that CancellationTokenSource.CancelAfter / the deploy deadline cannot represent, so they passed publish validation but threw at deploy. Reject them at configuration time. - SealedSecret manifest parsing accepted any nonblank metadata.name (e.g. Bad_Name, a/b, an overlong namespace), deferring the failure to kubectl apply. Validate the name as a DNS-1123 subdomain and any explicit namespace as a DNS-1123 label at publish time, mirroring the WithExistingSecret fast-fail. Extracted the DNS-1123 helpers into a shared KubernetesName class and added tests for all three findings. Co-authored-by: Copilot <[email protected]> Copilot-Session: b76dc20d-c553-47b7-8f5e-6fcdc0f10aa3
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 42 out of 42 changed files in this pull request and generated 6 comments.
Comments suppressed due to low confidence (2)
src/Aspire.Hosting.Radius/Secrets/RadiusSecretStoreExtensions.cs:204
- Resolve the manifest path before changing the population mode.
Path.GetFullPathcan throw for malformed paths; after that exception the resource remains marked as sealed and a corrected retry is rejected by ASPIRERADIUS065.
population.HasSealedSecret = true;
// Resolve a relative manifest path against the AppHost directory (not the process working
// directory), matching other hosting file APIs (e.g. KeycloakResourceBuilderExtensions), so
// the documented `./secrets/...` usage works regardless of where the AppHost is launched.
population.SealedManifestPath = Path.GetFullPath(manifestPath, store.ApplicationBuilder.AppHostDirectory);
population.Keys.AddRange(validatedKeys);
src/Aspire.Hosting.Radius/Secrets/RadiusSecretStoreNaming.cs:57
- These rules allow uppercase letters and a 64-character name, but this value is also used as the name of a Radius-created Kubernetes Secret. Kubernetes object names must be lowercase DNS-1123 names, with each label limited to 63 characters, so accepted inputs such as
DB-Credsor 64as will fail only at deployment. Validate the physical store name against the Kubernetes naming contract (or map it to a separate valid physical name).
if (!char.IsAsciiLetter(name[0]) || name[^1] == '-')
{
return false;
}
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
Harden and tighten the Radius secret-store surface in response to Copilot review comments: - SealedSecretManifest: fail closed in EmbedsPlaintextSecret when the embedded last-applied-configuration has duplicate/missing/non-string kind or duplicate data/stringData, so a crafted payload cannot smuggle plaintext past a single TryGetProperty lookup. - WithSealedSecret: resolve a relative manifest path against the AppHost directory (matching other hosting file APIs) so it works regardless of the process working directory. - RadiusSecretStoreNaming: align the store-name grammar with Aspire's resource-name grammar (letters/digits/hyphens, start-with-letter, no consecutive/trailing hyphen, <=64) so publish mode (AddResource) never rejects a name run mode accepted. Update the ASPIRERADIUS049 message. - WithData: add a single-key convenience overload binding a data key to a secret parameter, delegating transactionally to the callback form. - SealedSecretApplyStep.GetSealedSecretStatusAsync: only treat SealedSecret NotFound or transient connectivity failures as retryable; surface permanent kubectl failures (auth/RBAC/context/missing plugin) immediately instead of waiting out the whole materialization budget. Adds 22 targeted tests (357 total, all passing). Co-authored-by: Copilot <[email protected]> Copilot-Session: b76dc20d-c553-47b7-8f5e-6fcdc0f10aa3
…e inline key rejection, existing-secret reference validation Re-review of PR microsoft#18834 raised three additional findings on the Radius secret-store surface: - Terraform Git PAT auth now requires the referenced store to declare a 'pat' key (optionally 'username'), matching what Radius reads for recipeConfig.terraform.authentication.git.pat, instead of accepting a basicAuthentication username/password store it cannot use (ASPIRERADIUS051). - RadiusSecretStoreDataBuilder.Add rejects a duplicate inline key via TryAdd instead of silently overwriting through the dictionary indexer, so a double-declared key surfaces at the call site (ASPIRERADIUS043). - WithExistingSecret validates the '[namespace/]name' reference at the API boundary (single separator, DNS-1123 name/namespace) rather than deferring a malformed reference to deploy time (ASPIRERADIUS046). Adds targeted tests and updates the README diagnostics table and xmldoc. Co-authored-by: Copilot <[email protected]> Copilot-Session: b76dc20d-c553-47b7-8f5e-6fcdc0f10aa3
…ialization timeout, validate sealed manifest names A second re-review round on PR microsoft#18834 raised three findings: - ConfigureRadiusInfrastructure exposes secret stores (opts.SecretStores), but the identifier snapshot/rewire logic ignored them. Renaming a store construct left recipeConfig referencing the old <identifier>.id, and renaming the legacy application/environment left the store's ApplicationId/EnvironmentId pointing at stale symbols. Extended IdentifierSnapshot and added RewireSecretStoreReferences to rewrite both consumer references and parent scope IDs. - WithMaterializationTimeout accepted values above int.MaxValue milliseconds (e.g. TimeSpan.MaxValue) that CancellationTokenSource.CancelAfter / the deploy deadline cannot represent, so they passed publish validation but threw at deploy. Reject them at configuration time. - SealedSecret manifest parsing accepted any nonblank metadata.name (e.g. Bad_Name, a/b, an overlong namespace), deferring the failure to kubectl apply. Validate the name as a DNS-1123 subdomain and any explicit namespace as a DNS-1123 label at publish time, mirroring the WithExistingSecret fast-fail. Extracted the DNS-1123 helpers into a shared KubernetesName class and added tests for all three findings. Co-authored-by: Copilot <[email protected]> Copilot-Session: b76dc20d-c553-47b7-8f5e-6fcdc0f10aa3
d9b1415 to
d6a46d7
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 42 out of 42 changed files in this pull request and generated 4 comments.
Comments suppressed due to low confidence (1)
src/Aspire.Hosting.Radius/Secrets/RadiusSecretStoreNaming.cs:28
- Radius secret-store resource names are capped at 63 characters upstream, but this validator accepts 64. A 64-character name therefore passes AppHost validation and only fails when Radius processes the generated
Applications.Core/secretStoresresource, defeating the fail-fast guarantee. Align this limit, its diagnostic text, and the 64-character acceptance test with Radius's 63-characterResourceNameStringcontract.
internal const int MaxNameLength = 64;
Fixes findings from code-review, rubber-duck, security, architecture, and hosting-integration-authoring passes on the recipe-parameter and secret-store work in Aspire.Hosting.Radius. Secret handling: - Reject plaintext `kind: Secret` embedded in a SealedSecret's last-applied-configuration annotation; fail closed on malformed/non-scalar annotation values and non-object data/stringData (ASPIRERADIUS063). - Require an explicit metadata.namespace for application-scoped sealed stores so the namespace can't silently diverge per environment (ASPIRERADIUS055). - Bound the kubectl apply/sync/verify sequence with a shared timeout budget (ASPIRERADIUS066); tolerate transient/NotFound `kubectl get sealedsecret` failures during polling instead of aborting the deploy. - Reject key-specific envSecret consumers against keyless stores (ASPIRERADIUS064) and repeated population of a store (ASPIRERADIUS065); validate keys before mutating so a bad first key can't poison a retry. - Fire the targeted duplicate-identifier diagnostic (ASPIRERADIUS048) for app-vs-env Bicep identifier collisions, matching the actual emission scope. Recipe parameters: - Convert ParameterResource/RadiusProviderReference nested inside recipe parameter objects/arrays recursively so they stay late-bound, with cycle and depth guards. Cleanup: - Remove the dead WithTlsCertificate/GatewayTls consumer API and stale gateway-TLS doc comments. Adds unit tests for each finding and updates the README diagnostics table. Co-authored-by: Copilot <[email protected]> Copilot-Session: b76dc20d-c553-47b7-8f5e-6fcdc0f10aa3
Harden and tighten the Radius secret-store surface in response to Copilot review comments: - SealedSecretManifest: fail closed in EmbedsPlaintextSecret when the embedded last-applied-configuration has duplicate/missing/non-string kind or duplicate data/stringData, so a crafted payload cannot smuggle plaintext past a single TryGetProperty lookup. - WithSealedSecret: resolve a relative manifest path against the AppHost directory (matching other hosting file APIs) so it works regardless of the process working directory. - RadiusSecretStoreNaming: align the store-name grammar with Aspire's resource-name grammar (letters/digits/hyphens, start-with-letter, no consecutive/trailing hyphen, <=64) so publish mode (AddResource) never rejects a name run mode accepted. Update the ASPIRERADIUS049 message. - WithData: add a single-key convenience overload binding a data key to a secret parameter, delegating transactionally to the callback form. - SealedSecretApplyStep.GetSealedSecretStatusAsync: only treat SealedSecret NotFound or transient connectivity failures as retryable; surface permanent kubectl failures (auth/RBAC/context/missing plugin) immediately instead of waiting out the whole materialization budget. Adds 22 targeted tests (357 total, all passing). Co-authored-by: Copilot <[email protected]> Copilot-Session: b76dc20d-c553-47b7-8f5e-6fcdc0f10aa3
…e inline key rejection, existing-secret reference validation Re-review of PR microsoft#18834 raised three additional findings on the Radius secret-store surface: - Terraform Git PAT auth now requires the referenced store to declare a 'pat' key (optionally 'username'), matching what Radius reads for recipeConfig.terraform.authentication.git.pat, instead of accepting a basicAuthentication username/password store it cannot use (ASPIRERADIUS051). - RadiusSecretStoreDataBuilder.Add rejects a duplicate inline key via TryAdd instead of silently overwriting through the dictionary indexer, so a double-declared key surfaces at the call site (ASPIRERADIUS043). - WithExistingSecret validates the '[namespace/]name' reference at the API boundary (single separator, DNS-1123 name/namespace) rather than deferring a malformed reference to deploy time (ASPIRERADIUS046). Adds targeted tests and updates the README diagnostics table and xmldoc. Co-authored-by: Copilot <[email protected]> Copilot-Session: b76dc20d-c553-47b7-8f5e-6fcdc0f10aa3
…ialization timeout, validate sealed manifest names A second re-review round on PR microsoft#18834 raised three findings: - ConfigureRadiusInfrastructure exposes secret stores (opts.SecretStores), but the identifier snapshot/rewire logic ignored them. Renaming a store construct left recipeConfig referencing the old <identifier>.id, and renaming the legacy application/environment left the store's ApplicationId/EnvironmentId pointing at stale symbols. Extended IdentifierSnapshot and added RewireSecretStoreReferences to rewrite both consumer references and parent scope IDs. - WithMaterializationTimeout accepted values above int.MaxValue milliseconds (e.g. TimeSpan.MaxValue) that CancellationTokenSource.CancelAfter / the deploy deadline cannot represent, so they passed publish validation but threw at deploy. Reject them at configuration time. - SealedSecret manifest parsing accepted any nonblank metadata.name (e.g. Bad_Name, a/b, an overlong namespace), deferring the failure to kubectl apply. Validate the name as a DNS-1123 subdomain and any explicit namespace as a DNS-1123 label at publish time, mirroring the WithExistingSecret fast-fail. Extracted the DNS-1123 helpers into a shared KubernetesName class and added tests for all three findings. Co-authored-by: Copilot <[email protected]> Copilot-Session: b76dc20d-c553-47b7-8f5e-6fcdc0f10aa3
- WithExistingSecret validates reference and keys before marking the store populated so a corrected retry is not blocked by ASPIRERADIUS065 (R1). - Reject secret data keys that are not valid Kubernetes Secret keys at the API boundary for inline/existing/sealed populations (ASPIRERADIUS067) (R2). - rad workspace kube-context fallback now returns the single distinct context only; multiple contexts fail closed instead of guessing (R3). - Application-scoped store declared without any Radius environment now fails fast via a store-registered pipeline gate (ASPIRERADIUS068) (R4). - Add remarks/example xmldoc to AddRadiusSecretStore and WithRecipeParameters (R5/R6). Co-authored-by: Copilot <[email protected]> Copilot-Session: b76dc20d-c553-47b7-8f5e-6fcdc0f10aa3
- IsValidSecretDataKey now matches apimachinery IsConfigMapKey semantics: reject keys >253 chars, '.'/'..', and keys starting with '..' (N1). - IsTransientKubectlFailure no longer treats permanent x509 TLS trust failures as retryable; they fail fast instead of polling to the sync timeout (N2). - Secret-store validation test uses Directory.CreateTempSubdirectory (N3). - SealedSecret manifest requires the exact bitnami.com/v1alpha1 group/version instead of a bitnami.com/ prefix (N4). - Embedded SealedSecret in last-applied-configuration is now validated recursively for plaintext spec.template.data/stringData (ASPIRERADIUS063) (N5). - Recipe-parameter Merge validates all keys before applying (transactional) (N6). - Deploy-parameters test now exercises the production WriteDeployParametersFile helper and asserts the owner-only ARM JSON file contract (N7). - README secret-store diagnostics range lists only secret-store codes and notes 056/057 are separate and 053/054/060 retired (N8). Co-authored-by: Copilot <[email protected]> Copilot-Session: b76dc20d-c553-47b7-8f5e-6fcdc0f10aa3
The hand-rolled line/regex parser in ParseActiveWorkspaceContext did not honor real YAML syntax, so valid rad configs (trailing inline comments on values such as `default: prod # active`, quoted mapping keys, or flow-style mappings) failed to resolve the active workspace context and aborted every SealedSecret deployment with ASPIRERADIUS059 unless the override was set. Parse ~/.rad/config.yaml with YamlDotNet (already a dependency), reading workspaces.default then workspaces.items.<default>.connection.context, and keep the fail-closed behavior for missing/ambiguous values (default present but context missing -> null; no default -> single distinct context only). Co-authored-by: Copilot <[email protected]> Copilot-Session: b76dc20d-c553-47b7-8f5e-6fcdc0f10aa3
- SealedSecret apply: close TOCTOU by streaming the exact validated manifest bytes to `kubectl apply -f -` over stdin instead of re-reading the (mutable) manifest path. - Reject uppercase inline secret-store names: the name is used verbatim as the backing Kubernetes Secret name (DNS-1123), so require lowercase to fail fast at the API/publish boundary instead of at deploy. - ASPIRERADIUS067: include the 253-char limit and `.`/`..` prefix restrictions in the invalid-secret-data-key message. Co-authored-by: Copilot <[email protected]> Copilot-Session: a79a2e75-6c34-40f1-8b75-dcd5ca8b2b16
- SecretExistsAsync: treat transient connectivity/apiserver failures as "keep polling" (like the status probe) so a brief blip after Synced=True no longer aborts an otherwise healthy deploy. Refactored to an injectable overload and added unit coverage. - RunKubectlAsync: stream stdin inside the same cancellation handler as WaitForExitAsync so a cancel while writing/flushing stdin terminates the kubectl process tree instead of leaking it. - CopySealedSecretManifests: clear the integration-owned sealed-secrets subtree before writing so republishing after a store is removed or renamed no longer retains obsolete encrypted manifests. Co-authored-by: Copilot <[email protected]> Copilot-Session: a79a2e75-6c34-40f1-8b75-dcd5ca8b2b16
08107df to
be488b9
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 43 out of 43 changed files in this pull request and generated 3 comments.
Comments suppressed due to low confidence (1)
src/Aspire.Hosting.Radius/Secrets/RadiusSecretStoreExtensions.cs:359
- Radius does not accept the full Kubernetes Secret-name grammar here. Its
fromResourceIDpath validates both segments withkubernetes.IsValidObjectName, which usesIsDNS1123Label; consequently accepted references such asapp/db.creds(and names longer than 63 characters) are rejected byrad deploy. Validate the name as a DNS-1123 label as well so this API fails locally instead of emitting an unusable store.
// The Secret name is a DNS-1123 subdomain; the namespace (when present) is a DNS-1123 label.
// https://kubernetes.io/docs/concepts/overview/working-with-objects/names/
if (!KubernetesName.IsDns1123Subdomain(name) || (ns is not null && !KubernetesName.IsDns1123Label(ns)))
{
throw new ArgumentException(
$"Existing-secret reference '{namespaceAndName}' is invalid. The name must be a DNS-1123 subdomain and " +
"the optional namespace a DNS-1123 label (lowercase alphanumeric, '-', with '.' allowed in the name). " +
"Diagnostic: ASPIRERADIUS046.",
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 43 out of 43 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
src/Aspire.Hosting.Radius/Publishing/SealedSecretApplyStep.cs:152
- The final key-verification read is only timeout-bounded, not retried. After
WaitForSealedSecretSyncedAsyncobserves the Secret, a transient/NotFound response from this immediately followingkubectl get secret -o jsonaborts deployment, even though the preceding readiness probes retry the same failures within the materialization budget. Retry this verification query onIsTransientKubectlFailure/target NotFound until the shared deadline, while still failing permanent errors immediately.
var dataKeys = await InvokeProbeWithRemainingBudgetAsync(
ct => GetSecretDataKeysAsync(metadata.Namespace, metadata.Name, kubeContext, ct),
RemainingBudget(deadline),
cancellationToken,
() => CreateOperationTimeoutException(store.Name, metadata.Namespace, metadata.Name, "verify", store.MaterializationTimeout))
.ConfigureAwait(false);
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
A SealedSecret with a missing, scalar, empty, or plaintext-looking spec.encryptedData previously passed publish validation and was copied verbatim into the artifact, even though that path promises a structurally valid encrypted manifest. Require spec to be a mapping containing a non-empty spec.encryptedData mapping whose values are non-empty standard-base64 scalars, failing with ASPIRERADIUS044. The gate runs after the existing plaintext and last-applied-configuration leak checks so a leaking manifest still reports the more specific ASPIRERADIUS063. Co-authored-by: Copilot <[email protected]> Copilot-Session: 8674d1f9-7353-40df-b64d-31803c6dbdd3
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 43 out of 43 changed files in this pull request and generated no new comments.
Suppressed comments (2)
src/Aspire.Hosting.Radius/README.md:206
- This single example declares two Aspire resources named
db-creds. Resource names are globally unique, so the second call throws instead of demonstrating the sealed-secret flow. Give the environment-scoped store a distinct Aspire name.
radius.WithSecretStore("db-creds", RadiusSecretStoreType.BasicAuthentication, s =>
tests/Aspire.Hosting.Radius.Tests/Publishing/SecretStoreConsumerBicepTests.cs:24
- This model cannot pass the new validation gate: Terraform Git authentication requires the referenced store to declare a
patkey, but this store only declaresusernameandpassword.GenerateBicepis called directly here and bypasses pipeline validation, so the test currently verifies output that a real publish/deploy rejects with ASPIRERADIUS051. Add a secret PAT binding (or use a separate PAT store) so the test exercises a valid model.
|
Mitch Denny (@mitchdenny) anything I can do to help with review on this one? |
Description
This adds recipe parameter customization and secret management to the
Aspire.Hosting.Radiusintegration, so an AppHost can tune how Radius recipes provision backing resources and can supply the secrets those resources need — declaratively, in the app model — instead of configuring them out-of-band against the cluster.What you can now do:
ParameterResource/RadiusProviderReferencevalues, including when nested inside objects/arrays.builder.AddRadiusSecretStore(...)or environment-scoped viaradius.WithSecretStore(...)— and populate them three ways: inlineWithData, a reference to an existing KubernetesSecret(WithExistingSecret), or an encrypted Bitnami SealedSecret manifest (WithSealedSecret) that is applied and its materialization awaited at deploy time.Validation is fail-fast with a dedicated
ASPIRERADIUS0xxdiagnostic range covering population, publish, and deploy errors, so misconfiguration surfaces at publish time with an actionable message rather than as an opaque cluster failure.User-facing usage
Recipe parameters (C# AppHost):
Secret stores (C# AppHost):
Security considerations
This change handles secret material and executes external tooling, so it is security-relevant:
@secure()parameters, never as literals. SealedSecret manifests are validated to be a single encrypted BitnamiSealedSecret, and the parser fails closed if a manifest embeds a plaintextkind: Secret(including inside alast-applied-configurationannotation), has malformed/ambiguous structure, or uses YAML anchors/aliases/merge keys/duplicate keys (ASPIRERADIUS044,063).kubectlinvocations use discreteArgumentListargv entries withUseShellExecute=false; secret-returning calls suppress stdout logging so no secret material reaches logs, temp files, or error messages. The apply/sync/verify sequence is bounded by a materialization-timeout budget (ASPIRERADIUS066) and tolerates transient/NotFound poll failures rather than aborting the deploy..., no leading/trailing., no Windows reserved device names) before being used as Bicep symbols and filesystem path segments, preventing path traversal.radworkspace's Kubernetes context cannot be resolved, rather than applying tokubectl's ambient context (ASPIRERADIUS059).A security review of these changes was performed and found no high-confidence issues.
Checklist
<remarks />and<code />elements on your triple slash comments?