Summary
apm audit --ci --policy org fails to discover the org policy when the git remote
uses a non-standard SSH username (anything other than git).
Steps to reproduce
- Have a git remote of the form
<user>@<host>:<org>/<repo>.git where <user> is not git
- Run
apm audit --ci --policy org
Expected behaviour
The org and host are extracted correctly and the org policy is discovered from <org>/.github/apm-policy.yml.
Actual behaviour
_parse_remote_url returns None because it guards with
if url.startswith("git@"), so _auto_discover returns:
"Could not determine org from git remote"
Root cause
In discovery.py, _parse_remote_url assumes the SSH username is always git:
if url.startswith("git@"):
host_part, path_part = url.split(":", 1)
host = host_part.replace("git@", "")
Environment (please complete the following information):
- OS: Windows
- Python Version: 3.13.3
- APM Version: 0.12.2
Summary
apm audit --ci --policy orgfails to discover the org policy when the git remoteuses a non-standard SSH username (anything other than
git).Steps to reproduce
<user>@<host>:<org>/<repo>.gitwhere<user>is notgitapm audit --ci --policy orgExpected behaviour
The org and host are extracted correctly and the org policy is discovered from
<org>/.github/apm-policy.yml.Actual behaviour
_parse_remote_urlreturnsNonebecause it guards withif url.startswith("git@"), so_auto_discoverreturns:Root cause
In
discovery.py,_parse_remote_urlassumes the SSH username is alwaysgit:Environment (please complete the following information):