Skip to content

Conversation

Alirexaa
Copy link
Contributor

@Alirexaa Alirexaa commented Feb 13, 2025

Description

Add Password To Redis (dotnet/aspire#464) has been reverted because of [WebToolsE2E][Aspire] Using ‘azd up’ to deploy aspire starter with redis project fails with error: generating bicep from manifest: argument 1 cannot contain connection strings, secured parameters, or secret outputs. Use environment variables instead. (dotnet/aspire#7429).

This PR addresses the mentioned issue by changing the container entrypoint and providing the password from an environment variable.

For more information see #3838 (comment)

Fixes #3838

@eerhardt @davidfowl

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
  • Does the change require an update in our Aspire docs?

@Alirexaa Alirexaa requested a review from mitchdenny as a code owner February 13, 2025 18:55
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Feb 13, 2025
@danmoseley danmoseley added area-integrations Issues pertaining to Aspire Integrations packages security 🔐 labels Feb 18, 2025
Copy link
Member

@eerhardt eerhardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again for this contribution @Alirexaa! Nice work here.

I merged main and refactored the code a little bit to simplify it a bit.
But when deploying the app to ACA I found an issue that while Aspire doesn't use commas , in its generated passwords, azd will. So I updated the code to not allow special characters in the password.

This change LGTM - we should be able to finally fix this long standing security issue. Thanks again!


if (builder.Resource.PasswordParameter is { } password)
{
args.Add("--requirepass");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I run I see the command line args in the Dashboard:

image

I wonder if we want this experience by default. Do we really want/need to show these? Is there a way to disable them for certain resources?

Part of my reasoning is that we don't display all the environment variables here, why are command line args of the container important enough to show front and center here?

cc @adamint @JamesNK @drewnoakes

@@ -608,6 +608,7 @@ BicepValue<string> GetHostValue(string? prefix = null, string? suffix = null)
EndpointProperty.Url => GetHostValue($"{scheme}://", suffix: isHttpIngress ? null : $":{port}"),
EndpointProperty.Host or EndpointProperty.IPV4Host => GetHostValue(),
EndpointProperty.Port => port.ToString(CultureInfo.InvariantCulture),
EndpointProperty.HostAndPort=> GetHostValue(suffix: isHttpIngress ? null : $":{port}"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI - @davidfowl - I found a bug that we missed here and fixed it so all the generate-manifests work again.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't know if I should switch off isHttpIngress or not. If you explicitly ask for HostAndPort and this is the httpIngress, should we still tack on :80?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rethinking this, I think it should always put the port. The reasoning the URL can drop the port is because it contains the scheme at the begining. http:// indicates what the port is. If you say HostAndPort we should always give you the host and the port.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, it should include host an port

@eerhardt eerhardt merged commit 1189b16 into dotnet:main Feb 26, 2025
71 checks passed
@Alirexaa Alirexaa deleted the revert-7518-RevertRedisPassword branch February 26, 2025 18:21
@Alirexaa Alirexaa mentioned this pull request Mar 4, 2025
18 tasks
@github-actions github-actions bot locked and limited conversation to collaborators Mar 29, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-integrations Issues pertaining to Aspire Integrations packages community-contribution Indicates that the PR has been added by a community member security 🔐
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Revisit Redis password options
4 participants