Skip to content

Fix Habitat authentication through sudo - #63

Merged
tpowell-progress merged 2 commits into
mainfrom
tp/fix-habitat-sudo-env
Nov 16, 2026
Merged

tpowell-progress merged 2 commits into
mainfrom
tp/fix-habitat-sudo-env

Conversation

@tpowell-progress

Copy link
Copy Markdown
Contributor

Summary

Pass HAB_AUTH_TOKEN and HAB_LICENSE explicitly through sudo env instead of relying on sudo -E. This fixes the shared workflow used by chef/fauxhai#113, where the Linux Grype job reports that -E is ignored, then Habitat returns 401 Unauthorized.

  • Cover Linux/macOS CLI installation, downloaded-package installation, and Linux built-artifact installation.
  • Use Bash arrays for package commands so tokens stay out of command logging and commands no longer require eval.
  • Keep existing token-input precedence, secret fallback, license acceptance, package/channel selection, and Windows behavior.

Validation

python3 workflow-supporting-files/test_habitat_sudo_env.py passes for five privileged installation paths with input, secret-fallback, and absent-token cases. The check simulates sudo stripping the environment, verifies token/license delivery and token-free logging, and checks Habitat failures propagate. It fails against unmodified main. Workflow YAML parses with Ruby Psych and git diff --check passes.

Live Builder token validity/package authorization is not yet verified; that requires a consuming CI run after merge. Preflight required no new credentials, scopes, keys, or policy changes. Organization-secret listing and repository Actions-policy access were forbidden; those settings remain unchanged.

Files changed

  • .github/workflows/grype-hab-package-scan.yml
  • workflow-supporting-files/test_habitat_sudo_env.py

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Thomas Powell <104777878+tpowell-progress@users.noreply.github.com>
@tpowell-progress tpowell-progress added bug Something isn't working Expeditor: Skip All Skip all expeditor CI merge actions ai-assisted Changes made with AI assistance labels Nov 13, 2026
@tpowell-progress
tpowell-progress requested a review from a team as a code owner November 13, 2026 22:11
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Thomas Powell <104777878+tpowell-progress@users.noreply.github.com>
@tpowell-progress
tpowell-progress merged commit fe36104 into main Nov 16, 2026
6 checks passed
@tpowell-progress
tpowell-progress deleted the tp/fix-habitat-sudo-env branch November 16, 2026 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-assisted Changes made with AI assistance bug Something isn't working Expeditor: Skip All Skip all expeditor CI merge actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants