block unauthenticated commit viewing on forgejo

This commit is contained in:
Henry Hiles 2026-08-18 15:59:31 -04:00
commit 7bad14dca2
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs
4 changed files with 57 additions and 74 deletions

View file

@ -51,15 +51,16 @@
caddy.virtualHosts."${domain}".extraConfig = '' caddy.virtualHosts."${domain}".extraConfig = ''
respond /robots.txt <<EOF respond /robots.txt <<EOF
User-agent: * User-agent: *
Disallow: /*/*/archive/ Disallow: /*/*/*/commit
Disallow: /*/*/src/commit
EOF 200 EOF 200
defender redirect { @commitAnonymous {
ranges aliyun aws deepseek githubcopilot gcloud oci azurepubliccloud openai mistral vultr cloudflare digitalocean linode path /*/*/src/commit*
url https://ipv4.games/claim?name=federated.nexus not header_regexp Cookie "(^|;\s*)session=[^;]*"
} }
redir @commitAnonymous /user/login?redirect_to={uri} 302
reverse_proxy unix/${socket} reverse_proxy unix/${socket}
''; '';
}; };

113
flake.lock generated
View file

@ -379,11 +379,11 @@
"treefmt-nix": "treefmt-nix" "treefmt-nix": "treefmt-nix"
}, },
"locked": { "locked": {
"lastModified": 1786989359, "lastModified": 1787071818,
"narHash": "sha256-2fHTse1HXeMeR2oW+MLxDRc0rV/6+ELkhSExkkV8Fek=", "narHash": "sha256-TWKulZ5lFhYAl9wv1pSyXm96ax8zTcq6Ur3Ivv3uJDo=",
"ref": "refs/heads/main", "ref": "refs/heads/main",
"rev": "b502f74c34ad648a752f41606a118bafbb360baf", "rev": "7b3e3a26bb1a77d33697c4b80d41bb1d26fdafd6",
"revCount": 7569, "revCount": 7574,
"type": "git", "type": "git",
"url": "https://forgejo.ellis.link/continuwuation/continuwuity" "url": "https://forgejo.ellis.link/continuwuation/continuwuity"
}, },
@ -708,34 +708,12 @@
} }
}, },
"fenix_2": { "fenix_2": {
"inputs": {
"nixpkgs": [
"sable",
"nixpkgs"
],
"rust-analyzer-src": "rust-analyzer-src_2"
},
"locked": {
"lastModified": 1786606848,
"narHash": "sha256-RS78j/7iFHjIMzTr9bS3PypjvPozHBfdR5xBJ+ABXXA=",
"owner": "nix-community",
"repo": "fenix",
"rev": "3df888be63045c349a6d322f0214f1346bb18be9",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "fenix",
"type": "github"
}
},
"fenix_3": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
"sdm845", "sdm845",
"nixpkgs" "nixpkgs"
], ],
"rust-analyzer-src": "rust-analyzer-src_3" "rust-analyzer-src": "rust-analyzer-src_2"
}, },
"locked": { "locked": {
"lastModified": 1752302273, "lastModified": 1752302273,
@ -1083,11 +1061,11 @@
"nixpkgs-lib": "nixpkgs-lib_8" "nixpkgs-lib": "nixpkgs-lib_8"
}, },
"locked": { "locked": {
"lastModified": 1785627969, "lastModified": 1777988971,
"narHash": "sha256-4dtXQk/NMePegK/nWp5NSeuZKLATItOq61lpEvmXqGw=", "narHash": "sha256-qIoWPDs+0/8JecyYgE3gpKQxW/4bLW/gp45vow9ioCQ=",
"owner": "hercules-ci", "owner": "hercules-ci",
"repo": "flake-parts", "repo": "flake-parts",
"rev": "427bf4bd9435fdf21321c8cc628c24efc14c0f7a", "rev": "0678d8986be1661af6bb555f3489f2fdfc31f6ff",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -1271,17 +1249,18 @@
"git-hooks": { "git-hooks": {
"inputs": { "inputs": {
"flake-compat": "flake-compat_4", "flake-compat": "flake-compat_4",
"gitignore": "gitignore",
"nixpkgs": [ "nixpkgs": [
"sable", "sable",
"nixpkgs" "nixpkgs"
] ]
}, },
"locked": { "locked": {
"lastModified": 1784288435, "lastModified": 1776796298,
"narHash": "sha256-ReRHaLgr/uVqdD8afFSn+myXIfpHeOhP0yYe0TJqAA8=", "narHash": "sha256-PcRvlWayisPSjd0UcRQbhG8Oqw78AcPE6x872cPRHN8=",
"owner": "cachix", "owner": "cachix",
"repo": "git-hooks.nix", "repo": "git-hooks.nix",
"rev": "43b3c1ab9d40fb1dbb008f451988a91e375825e9", "rev": "3cfd774b0a530725a077e17354fbdb87ea1c4aad",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -1319,6 +1298,28 @@
"type": "github" "type": "github"
} }
}, },
"gitignore": {
"inputs": {
"nixpkgs": [
"sable",
"git-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1709087332,
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"gitignore-nix": { "gitignore-nix": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -2544,11 +2545,11 @@
}, },
"nixpkgs-lib_8": { "nixpkgs-lib_8": {
"locked": { "locked": {
"lastModified": 1785031560, "lastModified": 1777168982,
"narHash": "sha256-OmshNvn2vupOFpYinLUu+1Dnpu4n7Q5N3ggGVNHpkUI=", "narHash": "sha256-GOkGPcboWE9BmGCRMLX3worL4EMnsnG8MyKmXNeYuhQ=",
"owner": "nix-community", "owner": "nix-community",
"repo": "nixpkgs.lib", "repo": "nixpkgs.lib",
"rev": "0e79af5e3d4dcfcd676ab5ba3f95d2e3352e078c", "rev": "f5901329dade4a6ea039af1433fb087bd9c1fe14",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -2607,11 +2608,11 @@
}, },
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1786862985, "lastModified": 1787001381,
"narHash": "sha256-FBJRXmbGXiSUDvYEbfLYRkckayyZ6SK1UEqhCrIZ2Cs=", "narHash": "sha256-Ue1Yo8gfHdD4TMtNewhA4tkSYeFqXThju0nCyJc3ALo=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "e5bdc4a41d4c072fe1e3787eaa0320a384741d44", "rev": "ec2d622de0773551768cf98f3fc50cbcc003b9c5",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -2924,23 +2925,6 @@
} }
}, },
"rust-analyzer-src_2": { "rust-analyzer-src_2": {
"flake": false,
"locked": {
"lastModified": 1786530578,
"narHash": "sha256-fCOcC64H7e0EIlIHTCsl5FQ9CW4S6VK3OLn1ugWR9zI=",
"owner": "rust-lang",
"repo": "rust-analyzer",
"rev": "068bb508581477a5e3f753e1e206d34288dfa9c9",
"type": "github"
},
"original": {
"owner": "rust-lang",
"ref": "nightly",
"repo": "rust-analyzer",
"type": "github"
}
},
"rust-analyzer-src_3": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1752262373, "lastModified": 1752262373,
@ -2980,7 +2964,6 @@
}, },
"sable": { "sable": {
"inputs": { "inputs": {
"fenix": "fenix_2",
"flake-parts": "flake-parts_9", "flake-parts": "flake-parts_9",
"git-hooks": "git-hooks", "git-hooks": "git-hooks",
"nixpkgs": [ "nixpkgs": [
@ -2989,16 +2972,16 @@
"treefmt-nix": "treefmt-nix_4" "treefmt-nix": "treefmt-nix_4"
}, },
"locked": { "locked": {
"lastModified": 1787000742, "lastModified": 1784320199,
"narHash": "sha256-vYoKNflV4vdJpgYVxYCxAQhvqDh1Qf+7qgIFHxriTTU=", "narHash": "sha256-ams6Uwblo5mUzah9hlCPCUMXtrLtiUtRWwwKH4uabmk=",
"owner": "sableclient", "owner": "sableclient",
"repo": "sable", "repo": "sable",
"rev": "7675aa1520c141f2c7926dfe79473f513f150416", "rev": "12e55475dc659f86842e7910d0e1c18ca3e905e2",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "sableclient", "owner": "sableclient",
"ref": "v1.21.0", "ref": "v1.20.0",
"repo": "sable", "repo": "sable",
"type": "github" "type": "github"
} }
@ -3017,7 +3000,7 @@
"devshell": "devshell_2", "devshell": "devshell_2",
"disko": "disko_2", "disko": "disko_2",
"emacs-overlay": "emacs-overlay", "emacs-overlay": "emacs-overlay",
"fenix": "fenix_3", "fenix": "fenix_2",
"flake-compat": "flake-compat_5", "flake-compat": "flake-compat_5",
"flake-parts": "flake-parts_10", "flake-parts": "flake-parts_10",
"flake-schemas": "flake-schemas", "flake-schemas": "flake-schemas",
@ -3382,11 +3365,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1785945821, "lastModified": 1775636079,
"narHash": "sha256-NLSyTCW4K4ofhNBllt3omPasm6QpralXH1DBZOc91Dw=", "narHash": "sha256-pc20NRoMdiar8oPQceQT47UUZMBTiMdUuWrYu2obUP0=",
"owner": "numtide", "owner": "numtide",
"repo": "treefmt-nix", "repo": "treefmt-nix",
"rev": "ae7910970dddc408fe6ab1c8e4b277bb21d72dc0", "rev": "790751ff7fd3801feeaf96d7dc416a8d581265ba",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -18,7 +18,7 @@
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
sable = { sable = {
url = "github:sableclient/sable/v1.21.0"; url = "github:sableclient/sable/v1.20.0";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
stylix = { stylix = {

View file

@ -52,9 +52,8 @@
package = pkgs.caddy.withPlugins { package = pkgs.caddy.withPlugins {
plugins = [ plugins = [
"github.com/ggicci/caddy-jwt@v1.3.0" "github.com/ggicci/caddy-jwt@v1.3.0"
"pkg.jsn.cam/caddy-defender@v0.10.1"
]; ];
hash = "sha256-wV0hiQ/plS+b2CvbxHK+C4BRNgIVlDEyPBEaxsYd+FI="; hash = "";
}; };
globalConfig = '' globalConfig = ''