I am experimenting with using forgejo instead of GitHub for my personal projects. So far I like it, however I would like to make it available to the outside world at some point.

I was wondering what kind of traps I should avoid. The following things come to mind so far:

  • Forgejo Actions seem like a massive potential security risk, however I do not intend to enable sign up for other
  • OpenID appears to be a thing for forgejo, I do not know how it works and it seems like it would allow access to my instance even with registering disabled
  • I would put the instance behind a nginx as reverse proxy, but how do you keep bot traffic to a minimum? Anubis?

I feel like there are a ton of things I have not thought of, which is why I am holding off on making anything available without a VPN so far.

  • AcornTickler@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    1
    ·
    2 hours ago

    I run it in a rootless Podman container using Quadlets. Instead of opening the server’s ssh port, I only port-forward the container’s ssh port (e.g. 22 -> 2222). I have sign-ups enabled, since I want people to be able to contribute (or just create issues). But I have configured the server so that nobody can create a repository. They can still fork my repos and send a pull request.

    I have yet to experiment with Actions. I assume the safest option would be to only enable it for my own commits, but I am not sure.

  • surewhynotlem@lemmy.world
    link
    fedilink
    English
    arrow-up
    2
    ·
    5 hours ago

    Lots of good answers already. Just want to add.

    Block IP from every country that doesn’t have your users in it. That will go a long way.

  • tofu@lemmy.nocturnal.garden
    link
    fedilink
    English
    arrow-up
    13
    ·
    11 hours ago

    Yes, Check Anubis, scraper bots follow every link they find and especially git forges basically have infinite links (every single commit and comparison between every single commit and every other).

    I haven’t thought it through but there may be some implications on opening port 22 for git via ssh.

  • hendrik@palaver.p3x.de
    link
    fedilink
    English
    arrow-up
    10
    ·
    edit-2
    11 hours ago

    If it’s just you, and you’re fine with the regular login… Just disable signup and don’t add more authentication mechanisms like oauth/openID.

    I’m using nginx as a reverse proxy as well. For now, I added a lot of “deny” directives to ban all the address ranges from Tencent, Alibaba, OpenAI. It’s not a 100% solution, but works well enough for me. I’m mostly worried about AI crawlers causing too much load on my server. And it stopped since, so I don’t think I’m gonna need Anubis and all these extra things in front if my applications. If you like you can look into solutions like a web application firewall like Crowdsec.

  • emerald@lemmy.blahaj.zone
    link
    fedilink
    English
    arrow-up
    5
    ·
    9 hours ago

    I run a forgejo server on the internet for myself so here’s my two cents.

    OpenID or any other log in method is just a way to log in to an account on the forgejo server. With registrations disabled it shouldn’t be able to create an account, so there should be no issue. All the extra auth methods also need to be configured and are disabled by default.

    Bot traffic can be pretty horrendous once they find your server, I’d say Anubis is basically a requirement at this point. I would also strongly recommend setting up fail2ban for http and ssh, and disabling ssh password auth.

    • arschflugkoerper@feddit.orgOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      9 hours ago

      Ah I see, I kinda assumed that OpenID would allow anyone with an OpenID server to just log in. That seemed like it would cause immediate spam issues. It would definitely be nice if I could allow users to create issues or stuff like that at some point. I will definitely have to take a look at fail2ban before I make it available. Thank you.

  • morethanevil@lemmy.fedifriends.social
    link
    fedilink
    English
    arrow-up
    4
    ·
    10 hours ago

    You can use Forgejo with OIDC or normal login behind a reverse proxy. If you want to make a repo public, you need to add this to your App.ini under the [service] section: REQUIRE_SIGNIN_VIEW = false

    Example:

    [service]
    REGISTER_EMAIL_CONFIRM = true
    ENABLE_INTERNAL_SIGNIN = false
    ENABLE_NOTIFY_MAIL = true
    DISABLE_REGISTRATION = false
    ALLOW_ONLY_EXTERNAL_REGISTRATION = true
    ENABLE_CAPTCHA = false
    REQUIRE_SIGNIN_VIEW = true
    DEFAULT_KEEP_EMAIL_PRIVATE = false
    DEFAULT_ALLOW_CREATE_ORGANIZATION = true
    DEFAULT_ENABLE_TIMETRACKING = true
    NO_REPLY_ADDRESS = noreply.localhost
    REQUIRE_SIGNIN_VIEW = false
    
    

    Then you can create a public repo which people can view without an account. You can change visibilty at any time

  • Decronym@lemmy.decronym.xyzB
    link
    fedilink
    English
    arrow-up
    2
    ·
    edit-2
    5 hours ago

    Acronyms, initialisms, abbreviations, contractions, and other phrases which expand to something larger, that I’ve seen in this thread:

    Fewer Letters More Letters
    Git Popular version control system, primarily for code
    HTTP Hypertext Transfer Protocol, the Web
    IP Internet Protocol
    nginx Popular HTTP server

    [Thread #195 for this comm, first seen 28th Mar 2026, 14:10] [FAQ] [Full list] [Contact] [Source code]

  • moonpiedumplings@programming.dev
    link
    fedilink
    English
    arrow-up
    2
    ·
    10 hours ago
    • oauth, and control sign ups via there. Don’t let people sign up via forgejo itself.
    • anubis, yeah. Or similar.
    • forgejo actions is an optional component… and forgejo users can bring their own actions server. Of course, it’s a risk to them since the server owner could execute code in actions. But yeah.
    • arschflugkoerper@feddit.orgOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      9 hours ago

      I definitely want to use forgejo actions, but I am mainly worried about random people being able to execute any code on them. Preferably only approved users can do that.

  • frongt@lemmy.zip
    link
    fedilink
    English
    arrow-up
    1
    ·
    9 hours ago

    Do you need to host it yourself? Codeberg is free, and they handle these concerns for you.

    But yes, you will need to secure it against hackers and scrapers. Keep user permissions to a minimum, if you allow people to create accounts at all. And run it in a dmz network, so that in case it’s compromised they can’t access the rest of your LAN.