Commit Graph
21 Commits
Author SHA1 Message Date
Catherine c181e86f48 Fix minor resource leak in notifyAudit.
This would leak a response body on each valid, non-200 status response.

V12-Ref: F-77171
2026-05-30 18:10:43 +00:00
Catherine 16505f6054 [security] Actually check result of appendNewAuditRecord.
Before this commit, if `backend.AppendAuditLog` failed, the request
would proceed anyway. This is contrary to the explicit contract and
design intent.

If Go had `#[must_use]`, this would not have happened :/

V12-Ref: F-77170
2026-05-30 18:10:43 +00:00
Catherine a7063e00ef Implement site expiration.
Requires `feature = ["expiration"]`.
2026-05-29 00:13:44 +02:00
Catherine 3efb332351 Implement pull request preview authorization.
Requires `feature = ["preview"]`.
2026-05-25 23:59:39 +00:00
miyuko a9fc5780b1 Record git repo URL in the principal when forge auth is used.
Resolves: https://codeberg.org/git-pages/git-pages/issues/167
2026-05-11 03:40:46 +01:00
Catherine edae862551 Surface detached status of audit records in diagnostic output. 2026-05-03 12:01:33 +00:00
Catherine b0a674abf4 Fix incorrect start time in AuditID.CompareTime. 2026-04-26 22:59:36 +00:00
Catherine 52fa8d1462 Separate principals with a comma in audit log. 2026-03-08 00:15:36 +00:00
miyuko 9e9664013b Record the authorized forge user's name in the audit log. 2026-03-03 03:21:40 +00:00
Catherine 8d574e5e7d Stabilize the audit feature. 2025-12-07 14:31:48 +00:00
Catherine 43b6d92492 Split UnfreezeDomain off FreezeDomain. NFC
The code would branch on the value of `freeze` in basically all
implementations and call sites.
2025-12-06 01:40:19 +00:00
Catherine 32c449e380 Use path.Join where applicable. NFC 2025-12-05 05:52:07 +00:00
Catherine 8eeaf222ca Log beginning of audit event processing.
This helps debugging slow scripts (e.g. using ClamAV).
2025-12-05 03:41:23 +00:00
Catherine 8c29ba3fe7 Implement -audit-server.
To use this function, configure git-pages with e.g.:

    [audit]
    collect = true
    notify-url = "http://localhost:3004/"

and run an audit server with e.g.:

    git-pages -audit-server tcp/:3004 python $(pwd)/process.py

The provided command line is executed after appending two arguments
(audit record ID and event type), and runs in a temporary directory
with the audit record extracted into it. The following files will
be present in this directory:
  * `$1-event.json` (always)
  * `$1-manifest.json` (if type is `CommitManifest`)
  * `$1-archive.tar` (if type is `CommitManifest`)

The script must complete successfully for the event processing to
finish. The notification will keep being re-sent (by the worker) with
exponential backoff until it does.
2025-12-05 03:19:32 +00:00
Catherine 886635ce5e Implement -audit-log option.
Also, record the principal of `git-pages -{freeze,unfreeze}-domain`
and `git-pages -update-site` as the CLI administrator.
2025-12-04 15:58:14 +00:00
Catherine 4161013fc0 Implement -audit-read option. 2025-12-04 15:25:28 +00:00
Catherine 1ad5d5590c Optionally include principal's IP address in audit record metadata.
Currently this doesn't handle `X-Forwarded-For` and as such isn't very
useful. It is surprisingly difficult to find a high-quality library for
parsing `X-Forwarded-For` and a solution will have to be found.
2025-12-04 06:17:11 +00:00
Catherine 460ff41cc9 Allow PATCH method to apply partial updates.
Gated behind the `patch` feature.
2025-12-04 03:00:47 +00:00
Catherine 21b82f8e2c [breaking-change] Implement audit record retrieval.
This is only a breaking change if you've enabled the `audit` feature.
All past audit reports should be removed once this commit is deployed,
as both the Protobuf schema and the Snowflake epoch have changed.
2025-12-03 16:43:33 +00:00
Catherine 6e7b42b942 Implement audit notifications. 2025-12-03 06:32:07 +00:00
Catherine e226f51dd4 Implement auditing of important site lifecycle actions.
The list of audit events is:
  - `CommitManifest`
  - `DeleteManifest`
  - `FreezeDomain`
  - `UnfreezeDomain`

Currently these are the main abuse/moderation-relevant actions.
If collection is enabled, these events will be logged to `audit/...`
storage hierarchy; a way to examine audit logs will be added in
the future.

The auditing interposer backend is enabled with feature `audit`.
2025-12-03 04:19:41 +00:00