SSO: replace browser URL with actionable fix guidance by nodeselector · Pull Request #68 · github/gh-actions-lock · GitHub
Skip to content

SSO: replace browser URL with actionable fix guidance - #68

Merged
nodeselector merged 1 commit into
mainfrom
nodeselector-codespace-sso-guidance
Jun 26, 2026
Merged

nodeselector merged 1 commit into
mainfrom
nodeselector-codespace-sso-guidance

Conversation

@nodeselector

@nodeselector nodeselector commented Jun 26, 2026 •

Copy link
Copy Markdown
Collaborator

When gh actions-lock hits a SAML/SSO error, we were showing an "Authorize in your web browser" URL -- reinventing the SSO flow that cli/cli already handles. In Codespaces this URL is a dead end because the ghs_* token can't be SSO-authorized via browser anyway.

Replace the URL display with targeted guidance:

  • Codespace: point to devcontainer permissions docs so users fix the root cause
  • Non-codespace: suggest gh auth refresh -h github.com which delegates to cli/cli's SSO flow

Copilot AI review requested due to automatic review settings June 26, 2026 17:37
GitHub Advanced Security started work on behalf of nodeselector June 26, 2026 17:37
GitHub Advanced Security finished work on behalf of nodeselector June 26, 2026 17:38

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Not ready to approve

Scenario fixtures (e.g. test/scenarios/catalog.yml) still assert the removed “Authorize in your web browser” output and will fail / no longer validate the new guidance unless updated.

Pull request overview

Updates gh actions-lock SAML/SSO error output to show actionable remediation guidance rather than printing an SSO authorization URL (which is especially unhelpful in Codespaces), aligning the UX with gh auth’s existing SSO flow.

Changes:

  • Replace terminal output of the captured SSO URL with environment-specific fix guidance (Codespaces devcontainer permissions vs gh auth refresh).
  • Rework SSO fix-hint extraction in pin summary logic to emit the new guidance and remove URL parsing helper code.
  • Add Codespaces detection + unit tests for the hint selection behavior.
File summaries
File Description
cmd/gh-actions-lock/run.go Replaces “Authorize in your web browser” URL output with ssoFixHints() guidance in both --no-fix and normal terminal-summary paths.
cmd/gh-actions-lock/pin_summary.go Switches SSO fix hint generation to the new guidance and removes URL-extraction helper.
cmd/gh-actions-lock/pin_summary_test.go Updates expected SSO hint in cleanUnresolvedReason test.
cmd/gh-actions-lock/codespace.go Adds isCodespace() and ssoFixHints() helpers to select guidance based on environment.
cmd/gh-actions-lock/codespace_test.go Adds tests verifying Codespaces vs non-Codespaces guidance selection.

Review details

  • Files reviewed: 5/5 changed files
  • Comments generated: 1
  • Review effort level: Low

Note

Your feedback helps us improve the quality of this feature.
Please use 👍 or 👎 to tell us whether this assessment is correct.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cmd/gh-actions-lock/run.go
In Codespaces the ambient GITHUB_TOKEN cannot be SSO-authorized, so the
'Authorize in your web browser' URL was a dead end. Outside Codespaces
we were reinventing cli/cli's SSO flow.

Replace both paths:
- Codespace: point to devcontainer permissions docs
- Non-codespace: suggest 'gh auth refresh -h github.com'

Removes the ssoURLRE-extracted URL display entirely — cli/cli owns that
UX and we'll get it for free once this ships as a core command.
@nodeselector
nodeselector force-pushed the nodeselector-codespace-sso-guidance branch from 4f98f06 to 1712baf Compare June 26, 2026 19:15
GitHub Advanced Security started work on behalf of nodeselector June 26, 2026 19:15
GitHub Advanced Security finished work on behalf of nodeselector June 26, 2026 19:16
@nodeselector
nodeselector merged commit e38bb40 into main Jun 26, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants