Commit Graph
600 Commits
Author SHA1 Message Date
Catherine e4e3a43825 [breaking-change] Refactor handling of project name.
Define a proper abstraction for project names and use it elsewhere in
the codebase.

The character `@` is formally reserved for PR previews from this point,
and any project names using it must be well-formed: contain no more
than a single `@` followed by a positive number.
2026-10-21 18:29:59 +02:00
Catherine caa2895f52 Check validity of URL rewrite rules for non-index projects.
In commit 600c8a7848, we have introduced
an unintentionally breaking change to how redirects are handled, thus
breaking every single-page application deployed to a non-index project.

This cannot be easily fixed due to Codeberg Pages already having a mix
of broken and fixed redirects in manifests without any way to tell them
apart, but we can at least emit a diagnostic for redirects that are
statically known to be broken at deploy time.

See also #273.
2026-10-20 22:28:23 +00:00
Catherine 541877ae48 Docker: fix incorrect golang image architecture (i386 used instead of amd64). 2026-10-20 17:54:34 +00:00
Catherine 8d1827b77e Docker: update golang. 2026-10-20 17:31:57 +00:00
Catherine a61cdecc10 Require Go 1.26.10. 2026-10-20 15:48:26 +00:00
Catherine 375e7e15c8 Stabilize feature preview. 2026-10-17 21:27:00 +00:00
Catherine 90c98fbe71 Stabilize feature expiration. 2026-10-17 21:17:10 +00:00
Catherine 1f1c767f33 Stabilize feature absolute-headers. 2026-10-17 21:16:22 +00:00
Catherine 83476d0ad1 [breaking-change] Rename caddy listener to proxy and expose domains.
The listener is no longer only used for Caddy integration; it is now
a general purpose reverse proxy endpoint that can be used with e.g.
Traefik terminating TLS.

Fixes #260.
2026-10-17 22:41:19 +02:00
Catherine 600c8a7848 Fix handling of 2xx/4xx redirects within a project site.
Since the path of the target URL is absolute, we have to cut the project
name off before searching again for the manifest entry.

Fixes #272.
2026-10-17 20:32:18 +00:00
Catherine cdfca73ecf Use our fork of go-redirects.
This also fixes an issue with unparsing bare parameters (not that
this syntax is currently used anywhere).
2026-10-11 01:38:46 +00:00
Catherine da9caee84f CI: Don't run twice for pull requests. 2026-10-11 01:09:59 +00:00
woodpecker-botandCatherine c3036c5f04 [Renovate] Update module golang.org/x/net to v0.60.0 [SECURITY] 2026-10-10 00:33:32 +00:00
Catherine c26b31d0c4 CI: add upper limit on Go toolchain version for staticcheck. 2026-10-10 00:36:48 +02:00
Catherine a2bee712a2 Rename -repair-storage to -scrub-storage. 2026-10-10 00:36:48 +02:00
Catherine 64a6f249d1 Extend -repair-storage to check consistency of blobs.
This includes:
 * Verifying that the blobs' contents corresponds to their name/hash.
 * Verifying that blob references in manifests and audit records refer
   to blobs that exist and have matching hash.

The action differs by object type:
 * Blobs with mismatching content hash are removed.
 * Manifests referring to nonexistent or invalid blobs are replaced
   with placeholders.
 * Audit records with manifests referring to the same are detached.
   This preserves the audit log in more scenarios.

The check is conservative in that all "recent enough" manifests are
skipped. The repair process is functionally equivalent to a concurrent
GC run; we don't yet have GC, and it's not feasible to implement it as
a prerequisite for this urgently needed feature, so we take an approach
that may require several re-runs in case of very recent data corruption.
2026-10-10 00:36:48 +02:00
Xavier Vello 0d886689ae Gracefully exit audit-server on SIGINT 2026-10-08 19:54:24 +02:00
Xavier VelloandCatherine d833deabf3 Support notifying an audit-server over unix socket (#266)
The audit-server is able to listen on a unix socket, but the client does not support http on unix socket. It's pretty simple to implement in golang, by overriding the socket dialer in a http client.

We could also depend on https://github.com/peterbourgon/unixtransport for a better-tested implementation, but I don't think it's worth the maintenance cost.

Reviewed-on: https://codeberg.org/git-pages/git-pages/pulls/266
Reviewed-by: Catherine <whitequark@whitequark.org>
2026-10-07 22:42:15 +02:00
Catherine 762ff0ae65 FS: Skip temporary files in Enumerate{Blobs,Manifests}. 2026-10-07 20:10:24 +00:00
Catherine 01904858a1 Use less confusing temporary file names.
While dealing with an unrelated incident I got extremely confused by
what appeared to be sha256 names with 74 characters in them. This was
never intentional, a refactoring of how temporary files are created has
created a call site with this format.
2026-10-07 20:04:38 +00:00
Catherine a8c7bbb316 Add -repair-storage command.
This command replaces corrupted manifests and audit records with
placeholders indicating the corrupt status of the object in question.
As a result, other operations (many of which require that all objects
can be parsed) continue to work as expected.

The contents of a corrupted site manifest is replaced with a human
readable index page explaining the situation, and every URL is
rewritten to point to that index page.
2026-10-05 00:27:29 +00:00
Catherine e52dc6ed86 Include manifest name in protobuf decode errors. 2026-10-04 22:27:27 +00:00
miyuko 6c2f34c54d Allow specifying a reason for a mutation done via the CLI.
The reason is appended to the audit record and is surfaced in the log.
2026-09-20 10:12:15 +01:00
miyuko 6743cd73e9 Add protocol buffer development tools to the Nix devshell.
To lock the generated output.
2026-09-20 09:51:27 +01:00
phanirithvij 507e57edbc feat: use os.MkdirAll for creating root directory
Signed-off-by: phanirithvij <phanirithvij2000@gmail.com>
2026-09-04 02:16:16 +05:30
miyuko 0176494816 Treat wildcard domains and preview domains as public suffixes. 2026-08-27 02:11:48 +01:00
Catherine cb72f200c2 Revert "CI: pin Go toolchain version to 1.25.x."
This reverts commit 55d7851285.
2026-08-26 16:58:23 +00:00
Catherine d525cb61fc Add -purge-domain command (like wildcard -delete-site). 2026-08-26 16:56:27 +00:00
Catherine 255f91dd32 Harmonize log messages for admin commands. 2026-08-26 16:56:07 +00:00
8463eed5ba Retain query params for automatic redirects to .../.
Co-authored-by: phanirithvij <phanirithvij2000@gmail.com>
Reviewed-on: https://codeberg.org/git-pages/git-pages/pulls/253
Reviewed-by: Catherine <whitequark@whitequark.org>
2026-08-20 14:20:21 +02:00
whitequark 55d7851285 CI: pin Go toolchain version to 1.25.x.
Newer Go toolchain is incompatible with `staticcheck`.
2026-08-20 14:16:14 +02:00
woodpecker-bot 6b3706ff17 [Renovate] Update module github.com/go-git/go-git/v6 to v6.0.0-alpha.5 [SECURITY] 2026-08-09 00:07:11 +00:00
Psy-QandCatherine 472ae7ecaf README: accommodate installation from Docker/binary/etc
Reviewed-on: https://codeberg.org/git-pages/git-pages/pulls/250
Reviewed-by: Catherine <whitequark@whitequark.org>
2026-07-30 17:46:53 +02:00
miyukoandCatherine e02c8dd138 Group domains belonging to the same owner when analyzing storage.
Resolves: https://codeberg.org/git-pages/git-pages/issues/239
2026-07-28 01:53:12 +02:00
miyukoandCatherine 3332df668b Improve command-line help for -analyze-storage. 2026-07-28 01:53:12 +02:00
miyukoandCatherine 899e62a75d Add repository as a principal when updating via webhook.
Resolves: https://codeberg.org/git-pages/git-pages/issues/234
2026-07-28 01:47:08 +02:00
miyukoandCatherine f31d55c9ef Fold case of pull request author's username for preview uploads.
Hostnames are lowercase ASCII, so preview upload authorization would
always fail for repositories whose owners have uppercase letters in
their usernames.

Resolves: https://codeberg.org/git-pages/git-pages/issues/228
2026-07-28 01:44:20 +02:00
miyuko 2f810ec65b Fix type of [[wildcard]].max-preview-lifetime in the example config. 2026-07-27 17:24:48 +01:00
miyuko 6c1882911a Expose X-Server when responding to mutating requests.
Resolves: https://codeberg.org/git-pages/git-pages/issues/209
2026-07-20 15:23:46 +01:00
Catherine 5c1c8299a5 Color expiring manifests in -list-manifest output.
The color scheme is the same as in `-audit-log`.
2026-07-16 12:43:30 +00:00
Catherine 25462fbd42 Rename -site-expire to -expire-sites for consistency.
The flag is feature-gated.
2026-07-16 12:39:01 +00:00
woodpecker-bot 3de40a6b49 [Renovate] Update all dependencies 2026-07-16 00:06:51 +00:00
miyuko b02271cc27 Update go-slog-syslog. 2026-07-14 08:42:42 +01:00
miyuko 578e3b55d7 Update gomod2nix.toml. 2026-07-14 08:42:22 +01:00
whitequark 3d2488e051 Include source archive among release assets.
Forgejo does not guarantee that release archive checksums don't change.
2026-07-12 14:52:09 +02:00
woodpecker-bot fa8fbcd892 [Renovate] Update module golang.org/x/net to v0.55.0 [SECURITY] 2026-07-08 15:11:58 +00:00
imi415 03999af740 backend: s3: add option to choose bucket lookup type.
Certain S3 compatible storage providers does not support path style
bucket lookup anymore, add config option to manually specify DNS style
for minio.

Signed-off-by: imi415 <imi415@imi.moe>
2026-07-08 16:46:19 +08:00
woodpecker-bot f492dc707d [Renovate] Update module github.com/go-git/go-git/v6 to v6.0.0-alpha.4 [SECURITY] 2026-07-07 15:52:55 +00:00
Catherine 7d3368e196 Display audit records for expiring sites in a different color. 2026-07-01 01:03:47 +02:00
miyuko d870d0f9c5 Add an administrative CLI command to delete a site. 2026-06-28 21:27:59 +01:00