Skip to content

gstack-artifacts-url accepts host-only and owner-only remotes as repositories #1597

@jbetala7

Description

@jbetala7

Observed problem

gstack-artifacts-url accepts malformed remotes that contain only a host, or
only a host plus owner, and treats those partial paths as valid repositories.

Current behavior on upstream main:

$ bin/gstack-artifacts-url --to ssh https://github.com
git@github.com:github.com.git

$ bin/gstack-artifacts-url --owner-repo https://github.com/owner
owner

$ bin/gstack-artifacts-url --to https ssh://git@github.com
https://github.com/github.com

Those outputs are not valid owner/repo remotes. A caller that passes a truncated
or misconfigured artifacts remote can silently derive the wrong SSH/HTTPS URL
instead of failing fast.

Expected behavior

The helper should reject remote forms whose path is empty, missing the owner, or
missing the repo. It should keep accepting valid inputs like:

  • https://github.com/owner/repo
  • https://github.com/owner/repo.git
  • git@github.com:owner/repo.git
  • ssh://git@github.com/owner/repo.git

Duplicate search

I checked open issues and PRs for:

  • gstack-artifacts-url
  • artifacts url malformed
  • artifacts remote URL
  • gstack-artifacts

Closest existing items:

Candidate fix shape

Tighten parse_url() so the parsed path must contain at least two non-empty
segments (owner/repo) after stripping .git, and add regression coverage in
test/gstack-artifacts-url.test.ts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions