C# Expose CertificatePath from DependabotProxy

This commit is contained in:
Michael B. Gale
2024-12-02 14:17:06 +00:00
parent 4a7413cf11
commit 8b5050e427

View File

@@ -16,6 +16,10 @@ namespace Semmle.Extraction.CSharp.DependencyFetching
/// The full address of the Dependabot proxy, if available. /// The full address of the Dependabot proxy, if available.
/// </summary> /// </summary>
internal readonly string? Address; internal readonly string? Address;
/// <summary>
/// The path to the temporary file where the certificate is stored.
/// </summary>
internal readonly string? CertificatePath;
/// <summary> /// <summary>
/// Gets a value indicating whether a Dependabot proxy is configured. /// Gets a value indicating whether a Dependabot proxy is configured.
@@ -49,13 +53,13 @@ namespace Semmle.Extraction.CSharp.DependencyFetching
var certDirPath = new DirectoryInfo(Path.Join(tempWorkingDirectory.DirInfo.FullName, ".dependabot-proxy")); var certDirPath = new DirectoryInfo(Path.Join(tempWorkingDirectory.DirInfo.FullName, ".dependabot-proxy"));
Directory.CreateDirectory(certDirPath.FullName); Directory.CreateDirectory(certDirPath.FullName);
var certFilePath = Path.Join(certDirPath.FullName, "proxy.crt"); this.CertificatePath = Path.Join(certDirPath.FullName, "proxy.crt");
this.certFile = new FileInfo(certFilePath); this.certFile = new FileInfo(this.CertificatePath);
using var writer = this.certFile.CreateText(); using var writer = this.certFile.CreateText();
writer.Write(cert); writer.Write(cert);
logger.LogInfo($"Stored Dependabot proxy certificate at {certFilePath}"); logger.LogInfo($"Stored Dependabot proxy certificate at {this.CertificatePath}");
} }
internal void ApplyProxy(ILogger logger, ProcessStartInfo startInfo) internal void ApplyProxy(ILogger logger, ProcessStartInfo startInfo)