Skip to content

Enable remote redis and pgsql#115

Merged
jun92 merged 4 commits into
mainfrom
enable-remote-redis-and-pgsql
May 20, 2026
Merged

Enable remote redis and pgsql#115
jun92 merged 4 commits into
mainfrom
enable-remote-redis-and-pgsql

Conversation

@jun92
Copy link
Copy Markdown
Owner

@jun92 jun92 commented May 20, 2026

No description provided.

@jun92 jun92 added this to the Prototype milestone May 20, 2026
@jun92 jun92 self-assigned this May 20, 2026
@jun92 jun92 added this to ABMGS May 20, 2026
@jun92 jun92 added the enhancement New feature or request label May 20, 2026
@github-project-automation github-project-automation Bot moved this to Backlog in ABMGS May 20, 2026
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces conditional logic to switch between local container resources and cloud connection strings based on a 'UseCloud' configuration setting. While this adds flexibility for different environments, the review identified significant security risks where SSL certificate validation for Redis is unconditionally bypassed, potentially exposing the system to man-in-the-middle attacks. Feedback also includes a recommendation to use the more robust GetValue method for reading configuration flags instead of manual string comparison.

{
options.ConfigurationOptions = ConfigurationOptions.Parse(
builder.Configuration.GetConnectionString("redis") ?? throw new InvalidOperationException());
options.ConfigurationOptions.CertificateValidation += (sender, certificate, chain, sslPolicyErrors) => true;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

security-high high

Unconditionally returning true for certificate validation is a significant security risk. This configuration allows any certificate (including self-signed or malicious ones) to be accepted, making the connection susceptible to man-in-the-middle attacks. This should be avoided in production environments. Consider using proper certificate validation or restricting this bypass to development environments using conditional logic (e.g., if (builder.Environment.IsDevelopment())).

{
options.ConfigurationOptions = ConfigurationOptions.Parse(
siloBuilder.Configuration.GetConnectionString("redis") ?? throw new InvalidOperationException());
options.ConfigurationOptions.CertificateValidation += (sender, certificate, chain, sslPolicyErrors) => true;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

security-high high

Bypassing SSL certificate validation for Redis is insecure. This practice exposes the application to man-in-the-middle attacks, especially when connecting to remote cloud resources as implied by the PR title. It is recommended to properly validate certificates or ensure this bypass is only active in a local development context.

Comment thread Source/AppHost/AppHost.cs Outdated
.WaitFor(rdbms)
.WithReference(redis)
.WithReference(rdbms)
if (String.Compare(builder.Configuration.GetSection("UseCloud").Value, "true") == 0)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Using String.Compare on GetSection("UseCloud").Value is fragile. It depends on exact string matching and does not handle null values or different boolean representations (like True or actual JSON boolean types) gracefully. Using the GetValue<bool> extension method is more robust and idiomatic for retrieving boolean configuration flags.

if (builder.Configuration.GetValue<bool>("UseCloud"))

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Nice!

@jun92 jun92 merged commit ad045fc into main May 20, 2026
3 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in ABMGS May 20, 2026
@jun92 jun92 deleted the enable-remote-redis-and-pgsql branch May 20, 2026 06:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant