From 01db28dec5ccdd1254924fb7624d1e4b527177c7 Mon Sep 17 00:00:00 2001 From: Lance Walters Date: Mon, 23 Nov 2026 22:50:52 -0500 Subject: [PATCH] apps(forgejo): serve a declarative robots.txt that keeps non-portfolio paths out of the index Self-registration was open until 2026-11-20 and Google indexed spam profiles under forgejo.siriusdevops.com (/leonabrewton8, /charlinebrando, .../-/packages). The accounts are deleted and 404 now, but Forgejo's built-in robots.txt only blocks /explore/*?* and /user/, so /explore/repos and /search stay crawlable. Forgejo serves GITEA_CUSTOM=/data/gitea/public/robots.txt at /robots.txt, so mount a ConfigMap there (the supported custom-public override) and disallow /explore/*, /user/*, /search*, /api/*, /*/-/packages while allowing /sirius/* for the portfolio repos. --- apps/base/forgejo/custom-public.yaml | 32 ++++++++++++++++++++++++++++ apps/base/forgejo/deployment.yaml | 8 +++++++ apps/base/forgejo/kustomization.yaml | 2 ++ 3 files changed, 42 insertions(+) create mode 100644 apps/base/forgejo/custom-public.yaml diff --git a/apps/base/forgejo/custom-public.yaml b/apps/base/forgejo/custom-public.yaml new file mode 100644 index 0000000..ee4232a --- /dev/null +++ b/apps/base/forgejo/custom-public.yaml @@ -0,0 +1,32 @@ +# Custom "public" assets served at the site root by Forgejo. +# +# GITEA_CUSTOM in the image is /data/gitea, so Forgejo serves +# /data/gitea/public/* at the root path. Mounting this ConfigMap there makes +# /robots.txt declarative instead of a hand-written file on the PVC +# (docs: forgejo.org/docs/latest/admin/advanced/search-engines-indexation). +# +# Why: self-registration was open until 2026-11-20 and spam profiles +# (/leonabrewton8, /charlinebrando, .../-/packages) were indexed by Google. +# The accounts are gone, but Forgejo's built-in robots.txt only disallows +# /explore/*?* (query strings) and /user/, leaving /explore/repos and +# /search crawlable. This keeps the owner's portfolio repos (/sirius/*) +# indexable and everything else out. +apiVersion: v1 +kind: ConfigMap +metadata: + name: forgejo-custom-public + namespace: forgejo +data: + robots.txt: | + # forgejo.siriusdevops.com + User-agent: * + Disallow: /explore/* + Disallow: /user/* + Disallow: /search* + Disallow: /api/* + Disallow: /*/-/packages + Disallow: /repo/create + Disallow: /repo/migrate + Disallow: /org/create + + Allow: /sirius/* diff --git a/apps/base/forgejo/deployment.yaml b/apps/base/forgejo/deployment.yaml index 4a430ea..1a6c467 100644 --- a/apps/base/forgejo/deployment.yaml +++ b/apps/base/forgejo/deployment.yaml @@ -61,6 +61,11 @@ spec: volumeMounts: - name: data mountPath: /data + # Custom site-root assets (robots.txt). GITEA_CUSTOM=/data/gitea, + # so Forgejo serves /data/gitea/public/robots.txt at /robots.txt. + - name: custom-public + mountPath: /data/gitea/public + readOnly: true readinessProbe: httpGet: path: / @@ -77,3 +82,6 @@ spec: - name: data persistentVolumeClaim: claimName: forgejo-data + - name: custom-public + configMap: + name: forgejo-custom-public diff --git a/apps/base/forgejo/kustomization.yaml b/apps/base/forgejo/kustomization.yaml index 709c518..4c69535 100644 --- a/apps/base/forgejo/kustomization.yaml +++ b/apps/base/forgejo/kustomization.yaml @@ -7,6 +7,8 @@ resources: - cluster.yaml - podmonitor.yaml - pg-actions-queries.yaml + # Site-root custom assets (robots.txt) mounted into the forgejo pod. + - custom-public.yaml - deployment.yaml - service.yaml - runner-configmap.yaml