Option to not expose SSH to anonymous visitors #893

Closed
opened 2025-11-02 03:40:37 -06:00 by GiteaMirror · 3 comments
Owner

Originally created by @stklcode on GitHub (Jul 15, 2017).

Feature suggestion

I would like to have the ability to not expose the SSH clone URL to anonymous visitors (not signed in).

Why?
People capable of cloning via SSH must provide their public key and hence they are most likely registered members (or some member is sharing his/her account.
On the other hand, an anonymous visitor can't do anything useful with this URL.

Why not?
You might argue that you are not necessarily signed, maybe don't have your two-factor device on hand, but just want to fetch the URL to push via SSH. So it depends on custom needs and workflows.

My suggestion
Add a boolean configuration flag like SSH_EXPOSE_ANON (default true, so it's opt-out), which is checked on markup generation.

I have hardcoded this in a fork project (simply added .IsSigned to the 3 relevant templates), works like a charm. If this change is welcome, I'm willing to provide a complete PR on that.

Originally created by @stklcode on GitHub (Jul 15, 2017). #### Feature suggestion I would like to have the ability to not expose the SSH clone URL to anonymous visitors (not signed in). **Why?** People capable of cloning via SSH must provide their public key and hence they are most likely registered members (or some member is sharing his/her account. On the other hand, an anonymous visitor can't do anything useful with this URL. **Why not?** You might argue that you are not necessarily signed, maybe don't have your two-factor device on hand, but just want to fetch the URL to push via SSH. So it depends on custom needs and workflows. **My suggestion** Add a boolean configuration flag like `SSH_EXPOSE_ANON` (default `true`, so it's opt-out), which is checked on markup generation. I have hardcoded this in a fork project (simply added `.IsSigned` to the 3 relevant templates), works like a charm. If this change is welcome, I'm willing to provide a complete PR on that.
GiteaMirror added the topic/ui label 2025-11-02 03:40:37 -06:00
Author
Owner

@lafriks commented on GitHub (Jul 15, 2017):

SSH url for anonymous users are not shown also in GitHub so I think new configuration flag is not needed. Please submit PR

@lafriks commented on GitHub (Jul 15, 2017): SSH url for anonymous users are not shown also in GitHub so I think new configuration flag is not needed. Please submit PR
Author
Owner

@stklcode commented on GitHub (Jul 15, 2017):

That's the simple solution, OK.

As I pointed out, we don't necessarily have to follow GitHub here as there might be reasons to show anyway, but I personally don't care if I need a confg flag as long as it's gone on my public site... I got both solutions ready in my repo.

@stklcode commented on GitHub (Jul 15, 2017): That's the simple solution, OK. As I pointed out, we don't necessarily have to follow GitHub here as there might be reasons to show anyway, but I personally don't care if I need a confg flag as long as it's gone on my public site... I got both solutions ready in my repo.
Author
Owner

@lafriks commented on GitHub (Jul 15, 2017):

Fixed by #2170

@lafriks commented on GitHub (Jul 15, 2017): Fixed by #2170
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#893