Implement /hg_allowed internal Rails API call
To support Git SSH clients, GitLab Shell calls the internal Rails API /allowed
end point, passing over information about the authentified client, typically with the key_id
or user_id
field and the given command (e.g., git-receive-pack
for a push). The response payload then tells it whether it's allowed or not.
For Mercurial SSH support, the logic is similar with a key difference: we only ever have one command (hg
) to which we pass a permission level (read
, write
, publish
), so we created a new endpoint /hg_allowed
taking the same actor information and returning that level. In the Ruby version, this is done in GitlabNet/hg_allowed, leveraging the HgAccessStatus class, a sibling of GitLab's AccessStatus
We'll need a Golang version of these two.