Skip to content

Agent Mesh

fix(auth): address PR review feedback on headless mode and device callback

Antonio Ojeac2dd0ee245ed
diff --git a/.github/k8s/dex-config.yaml b/.github/k8s/dex-config.yaml
index aef87e90..582fc37e 100644
--- a/.github/k8s/dex-config.yaml
+++ b/.github/k8s/dex-config.yaml
@@ -53,5 +53,4 @@ data:
- 'http://127.0.0.1/callback'
- 'http://localhost/callback'
- 'https://auth.sam-mesh.dev/device/callback'
- - '/device/callback'
- 'urn:ietf:wg:oauth:2.0:oob'
diff --git a/cmd/sam-node/oidc.go b/cmd/sam-node/oidc.go
index bdeea95d..8f06a4b3 100644
--- a/cmd/sam-node/oidc.go
+++ b/cmd/sam-node/oidc.go
@@ -83,7 +83,7 @@ func (n *SamNode) InteractiveLogin(ctx context.Context, authURL, tokenURL, clien
return "", fmt.Errorf("failed to generate PKCE: %w", err)
}
- isHeadless := headlessFlag || os.Getenv("SSH_CLIENT") != "" || os.Getenv("SSH_TTY") != "" || isRunningInContainer()
+ isHeadless := headlessFlag || os.Getenv("SSH_CLIENT") != "" || os.Getenv("SSH_TTY") != ""
var redirectURI string
var listener net.Listener
@@ -333,22 +333,6 @@ func (n *SamNode) DiscoverEndpoints(ctx context.Context, issuerURL string) (toke
return claims.TokenURL, claims.AuthURL, nil
}
-func isRunningInContainer() bool {
- if _, err := os.Stat("/.dockerenv"); err == nil {
- return true
- }
- if _, err := os.Stat("/run/.containerenv"); err == nil {
- return true
- }
- if b, err := os.ReadFile("/proc/1/cgroup"); err == nil {
- s := string(b)
- if strings.Contains(s, "docker") || strings.Contains(s, "containerd") {
- return true
- }
- }
- return false
-}
-
var openBrowserFunc = openBrowser
func openBrowser(targetURL string) {