Skip to content

Ensure SSL_CERT_DIR messages are always shown and check for existing value#3

Open
tomerqodo wants to merge 6 commits intosentry_full_base_ensure_ssl_cert_dir_messages_are_always_shown_and_check_for_existing_value_pr3from
sentry_full_head_ensure_ssl_cert_dir_messages_are_always_shown_and_check_for_existing_value_pr3
Open

Ensure SSL_CERT_DIR messages are always shown and check for existing value#3
tomerqodo wants to merge 6 commits intosentry_full_base_ensure_ssl_cert_dir_messages_are_always_shown_and_check_for_existing_value_pr3from
sentry_full_head_ensure_ssl_cert_dir_messages_are_always_shown_and_check_for_existing_value_pr3

Conversation

@tomerqodo
Copy link
Copy Markdown

Benchmark PR from agentic-review-benchmarks#3

if (!string.IsNullOrEmpty(existingSslCertDir))
{
var existingDirs = existingSslCertDir.Split(Path.PathSeparator);
var certDirFullPath = Path.GetFullPath(prettyCertDir);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: The code uses a display path prettyCertDir containing a literal "$HOME" for path comparison. Path.GetFullPath() resolves this incorrectly, causing the check against SSL_CERT_DIR to always fail.
Severity: CRITICAL

Suggested Fix

Use the original full path variable certDir instead of the display-only prettyCertDir when calling Path.GetFullPath() and performing the comparison against the paths in the SSL_CERT_DIR environment variable. The prettyCertDir variable should only be used for logging/display purposes.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: src/Shared/CertificateGeneration/UnixCertificateManager.cs#L365

Potential issue: The code generates a display-friendly path `prettyCertDir` by
substituting the home directory with the literal string `"$HOME"`. This path is then
passed to `Path.GetFullPath(prettyCertDir)`. Since `Path.GetFullPath()` does not expand
environment variables, it treats `"$HOME"` as a literal relative path, resolving to an
incorrect absolute path like `/current/working/dir/$HOME/...`. This incorrect path is
then compared against the actual paths in the `SSL_CERT_DIR` environment variable. This
comparison always fails when the certificate directory is under the user's home
directory, causing the function to incorrectly report that the certificate is not fully
trusted and prompt users to configure `SSL_CERT_DIR` even when it is already set up
correctly.

Did we get this right? 👍 / 👎 to inform future reviews.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants