Skip to content

gh cs create auth message doesn't include devcontainer information in auth URL #7982

@joshmgross

Description

@joshmgross

Describe the bug

When creating a Codespace with a devcontainer that requires additional permissions, an error will occur and the user is redirected to a link to allow the new permissions.

gh cs create --repo monalisa/octocat --branch main --devcontainer-path=.devcontainer/actions/devcontainer.json | tail -n 1
You must authorize or deny additional permissions requested by this codespace before continuing.
Open this URL in your browser to review and authorize additional permissions: github.com/monalisa/octocat/codespaces/allow_permissions
Alternatively, you can run "create" with the "--default-permissions" option to continue without authorizing additional permissions.

This URL doesn't include any information about the devcontainer requested, so it will only allow you authorize permission for the default devcointainer.

This is only an issue when running gh cs create in a non-interactive way. When run directly, the user is prompted for options and the auth URL used is correct:

gh cs create --repo monalisa/octocat --branch main --devcontainer-path=.devcontainer/actions/devcontainer.json
You must authorize or deny additional permissions requested by this codespace before continuing.
? What would you like to do?  [Use arrows to move, type to filter]
> Continue in browser to review and authorize additional permissions (Recommended)
  Continue without authorizing additional permissions

Correct auth URL: https://github.com/monalisa/octocat/codespaces/allow_permissions?ref=main&devcontainer_path=.devcontainer/actions/devcontainer.json

Steps to reproduce the behavior

  1. Set up a custom devcontainer in a separate directory with permissions to repositories that you haven't already authorized
  2. Run gh cs create and specifiy the --devcontainer-path, piping the output to another command so that it isn't interactive
  3. Observe that auth URL output does not have any query parameters and won't allow you to authorize with the separate devcontainer

Expected vs actual behavior

The message "Open this URL in your browser to review and authorize additional permissions" should have a full URL for the devcontainer specified by the user.

Logs

See above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions