Ensure SSL_CERT_DIR messages are always shown and check for existing value#3
Conversation
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
| if (!string.IsNullOrEmpty(existingSslCertDir)) | ||
| { | ||
| var existingDirs = existingSslCertDir.Split(Path.PathSeparator); | ||
| var certDirFullPath = Path.GetFullPath(prettyCertDir); |
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Benchmark PR from agentic-review-benchmarks#3