question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CredentialHelper change broke unix domain socket support

See original GitHub issue

We use a unix domain socket for our remote_executor and remote_cache endpoints, because we use a side-car proxy to handle SPIFFE mTLS negotiation. This stopped working with the release of bazel 5.3.0. With 5.3.0, bazel fails before issuing its first GetCapabilitiesRequest. The error message was “ERROR: Failed to query remote execution capabilities: UNAUTHENTICATED: Failed computing credential metadata.” When enabling verbose failures, the stack trace pointed to a failed precondition because the host portion of the URI was null. I played around with the code and got it working again, but the fix isn’t production-quality – it doesn’t handle the case where the remote cache endpoint differs from the remote executor endpoint, and might need different credentials. Because we’re using unix domain sockets, this shouldn’t affect us at all. Anyway, consider the following patch a place to start the conversation about what the correct fix might look like.

index a7d793ad56..d7db02bd6f 100644
--- a/src/main/java/com/google/devtools/build/lib/remote/RemoteModule.java
+++ b/src/main/java/com/google/devtools/build/lib/remote/RemoteModule.java
@@ -1055,6 +1055,22 @@ public final class RemoteModule extends BlazeModule {
       AuthAndTLSOptions authAndTlsOptions,
       RemoteOptions remoteOptions)
       throws IOException {
+
+    // TODO: this is a temporary hack.  Because remoteCache and remoteExecutor could be different, they might need
+    // different credentials.  If the endpoints used to access remote services are unix domain sockets, credential
+    // helpers aren't needed -- the service is running on the same machine.
+    //
+    // Also note that URI("unix://...") will replace "unix" with "https" for some reason that escapes me, but that
+    // makes it tricky to use.  Somewhere (not here because of the checks in the try clause below), that was
+    // happening, because by the time findCredentialHelper() is called, these URIs have been changed from "unix://"
+    // to "https://".  According to the bazel documentation, the "unix:" scheme is supposed to disable TLS.
+    if (remoteOptions.remoteCache != null && Ascii.toLowerCase(remoteOptions.remoteCache).startsWith("unix:/")) {
+           return null;
+    }
+    if (remoteOptions.remoteExecutor != null && Ascii.toLowerCase(remoteOptions.remoteExecutor).startsWith("unix:/")) {
+           return null;
+    }
+
     Credentials credentials =
         GoogleAuthUtils.newCredentials(
             credentialHelperEnvironment, commandLinePathFactory, fileSystem, authAndTlsOptions);

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
Wyveraldcommented, Aug 29, 2022

@bazel-io fork 5.3.1

1reaction
fmeumcommented, Aug 26, 2022

@bazel-io flag

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error fatal: credential-cache unavailable; no Unix socket support
Somewhere in your configuration, you have a credential helper set to cache and on your system you don't have Unix socket support, ...
Read more >
Kerberos printing is not working over unix domain socket #4758
FYI: Kerberos auth over the unix domain socket works with CUPS 1.6.3 ... Else it can't switch to the user to access the...
Read more >
git-credential-cache - man pages section 1: User Commands
git-credential-cache - helper to temporarily store passwords in memory ... The cache is accessible over a Unix domain socket, restricted to the current...
Read more >
[PATCH/RFC] add lame win32 credential-helper - public-inbox listing
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used...
Read more >
Storing username and password in Git - Unix Stack Exchange
In Terminal, enter the following to enable credential memory: $ git config --global credential.helper cache.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found