Skip to content

fix(oauth): detect Podman containers for callback binding - #4020

Open
Kurumioi wants to merge 1 commit into
github:mainfrom
Kurumioi:fix/oauth-podman-detection
Open

Kurumioi wants to merge 1 commit into
github:mainfrom
Kurumioi:fix/oauth-podman-detection

Conversation

@Kurumioi

@Kurumioi Kurumioi commented Dec 3, 2026

Copy link
Copy Markdown

Problem

Under Podman, OAuth login with a fixed callback port never completes. isRunningInDocker() only checks /.dockerenv and /proc/1/cgroup; Podman creates /run/.containerenv and, with cgroup v2 + crun, /proc/1/cgroup is 0::/. The server therefore believes it is running natively, binds the callback to the container-internal 127.0.0.1, and a published port (-p 127.0.0.1:8085:8085) can never reach it.

Fixes #4007.

Change

  • Detect Podman via the container=podman environment variable and /run/.containerenv.
  • Keep the existing Docker/containerd checks unchanged.
  • Move the container marker paths into package variables so tests can substitute fixtures.

Once detected as containerized, the existing flow binds the callback to all interfaces, so the published port works as documented.

Tests

go test ./internal/oauth/ passes. New tests cover:

  • container=podman environment marker
  • /run/.containerenv marker
  • absence of Podman markers
  • the Linux isRunningInDocker() path under container=podman (skipped on non-Linux)

I could not exercise a real Podman container on this machine; the unit tests validate detection, and the interface-binding behavior is covered by the existing flow tests.

Podman does not create /.dockerenv, and cgroup v2 under crun contains neither docker nor containerd, so isRunningInDocker returned false and the OAuth callback bound to the container-internal loopback. Published ports are delivered to eth0, so the browser login could never complete.

Detect Podman via container=podman and /run/.containerenv. Move the container marker paths to variables so tests can point them at fixtures.

Fixes github#4007
@Kurumioi
Kurumioi requested a review from a team as a code owner December 3, 2026 08:31
Copilot AI adaptive review requested due to automatic review settings December 3, 2026 08:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

With Podman host networking, fixed-port callbacks expose login to network-triggered aborts, while reachable random ports unnecessarily force device flow.

1 open issue
What changed in this PR

Extends OAuth container detection to Podman so published fixed-port callbacks use the existing container binding behavior, addressing #4007.

Changes:

  • Detects Podman environment and filesystem markers while preserving Docker/containerd checks.
  • Adds configurable marker paths and unit tests.
File Description
internal/​oauth/​env.go Adds Podman detection and fixture-configurable marker paths.
internal/​oauth/​env_test.go Tests Podman markers, their absence, and Linux integration.

Review effort: Max (adaptive)

Comment thread internal/oauth/env.go
Comment on lines +67 to +68
if isPodmanContainer() {
return true
@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

AI Assessment: Missing Details

Thanks for the contribution. Please edit the description to fill in these
sections of the pull request template:

  • Summary
  • Why
  • What changed
  • MCP impact
  • Security / limits
  • Tool renaming
  • Lint & tests
  • Docs

Generated by Pull Request Triage · copilot · auto (Claude Sonnet 5.5) · ~11 AIC · ⌖ ~1 AIC · ⊞ 6.5K · history

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

Projects

None yet

2 participants