diff --git a/.testcoverage.yml b/.testcoverage.yml index 15afb95..21d5651 100644 --- a/.testcoverage.yml +++ b/.testcoverage.yml @@ -1,5 +1,5 @@ # Coverage threshold gate for the audit-syslog-bridge module. -# Enforced by `make cover-go-check` via go-test-coverage/v2. +# Enforced in CI by Gameplane's shared go-component.yaml workflow (go-test-coverage/v2). # # The bridge is a small, pure-stdlib HTTP-JSON → RFC 5424 syslog relay. The # tests cover the syslog framing, config validation, the HTTP handler (TCP/UDP diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..bde950b --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,22 @@ +# audit-syslog-bridge — AI assistant guide + +This repository holds the optional HTTP-JSON to RFC 5424 syslog relay behind the API's audit webhook sink. It is a split component of [GameplanePanel/Gameplane](https://github.com/GameplanePanel/Gameplane), checked out there as the `audit-syslog-bridge/` submodule. What it does and its contracts: [`specs.md`](specs.md). + +## How it fits into Gameplane + +- **Own Go module**, not part of Gameplane's `go.work`. Build and test from this repository's root: `go build ./...` (inside a Gameplane checkout, prefix `GOWORK=off`). +- **CI** is `.github/workflows/ci.yaml`, a thin caller of Gameplane's shared [`go-component.yaml`](https://github.com/GameplanePanel/Gameplane/blob/master/.github/workflows/go-component.yaml), pinned by SHA: lint with Gameplane's root `.golangci.yml` and `.hadolint.yaml` (no copy here), race tests on amd64 and arm64 with the `.testcoverage.yml` gate, govulncheck, and an image build. Dependabot runs in this repository. +- **Images** `audit-syslog-bridge` (`Dockerfile`, built by `make image-audit-syslog`) are built and published from the Gameplane repository root: the Dockerfiles copy `audit-syslog-bridge/...` from that build context. +- **Callers live in Gameplane:** paths such as `operator/`, `api/`, `charts/`, `docs/` and `web/` in `specs.md` and code comments refer to that repository. +- **Shipping a change:** PR to `main` here → after it merges, bump the `audit-syslog-bridge` pointer in Gameplane (`git -C audit-syslog-bridge checkout `, `git add audit-syslog-bridge`) in a Gameplane PR. A user-visible change gets its `changelog/unreleased/` entry in that Gameplane PR. + +## Rules + +Gameplane's [`AGENTS.md`](https://github.com/GameplanePanel/Gameplane/blob/master/AGENTS.md) core rules apply here. The ones that matter most in this repository: + +- **CI verifies:** locally only compile checks (`go build ./...`); never run test or lint suites locally. +- **Fix, don't silence:** no `//nolint` and no per-repository `.golangci.yml`; `_test.go` files are exempt from `errcheck`/`gosec`/`unparam` through the shared config. +- **Go errors:** wrap with `%w`. +- **Tests:** never delete or weaken a test without the maintainer's explicit sign-off; fix the code. +- **Git:** signed commits (`git commit -s`), conventional prefixes (`feat:`, `fix:`, `chore:`, `docs:` …), one branch per unit of work, never amend pushed commits; delete the branch after merge. +- **Docs:** keep `specs.md` in step with behaviour changes in the same PR. diff --git a/CLAUDE.md b/CLAUDE.md new file mode 120000 index 0000000..47dc3e3 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1 @@ +AGENTS.md \ No newline at end of file diff --git a/README.md b/README.md index 9752887..4f56ad9 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,13 @@ # audit-syslog-bridge +> This repository is checked out as the `audit-syslog-bridge/` submodule of [GameplanePanel/Gameplane](https://github.com/GameplanePanel/Gameplane). Paths such as `docs/`, `operator/`, `api/`, `charts/` and `web/` below refer to that repository. + The **audit-syslog-bridge** [optional] is a tiny, generic **HTTP-JSON → syslog** relay. It accepts an HTTP `POST` whose body is a single JSON document and re-emits that document as an [RFC 5424](https://www.rfc-editor.org/rfc/rfc5424) syslog message to a configured collector (TCP, TCP over TLS, or UDP). -It exists so Gameplane's [audit webhook sink](../docs/install.md#audit-log) can +It exists so Gameplane's [audit webhook sink](https://github.com/GameplanePanel/Gameplane/blob/master/docs/install.md#audit-log) can reach a syslog/SIEM endpoint, but it is deliberately **schema-agnostic**: it forwards the received body verbatim as the syslog `MSG`, so it works for any JSON-webhook source, not just audit events. Nothing in it is Gameplane-specific. @@ -77,7 +79,7 @@ same Secret as the API's webhook token). Without it the relay accepts any POST. The chart deploys this automatically when you set `api.audit.webhook.syslogBridge.enabled=true` and a collector address — see the -[install docs](../docs/install.md#audit-log). Standalone: +[install docs](https://github.com/GameplanePanel/Gameplane/blob/master/docs/install.md#audit-log). Standalone: ```sh docker run -e SYSLOG_ADDR=syslog.example:514 \ diff --git a/specs.md b/specs.md index 4391456..486a603 100644 --- a/specs.md +++ b/specs.md @@ -1,5 +1,7 @@ # audit-syslog-bridge — Specification +> This repository is checked out as the `audit-syslog-bridge/` submodule of [GameplanePanel/Gameplane](https://github.com/GameplanePanel/Gameplane). Paths such as `docs/`, `operator/`, `api/`, `charts/` and `web/` below refer to that repository. + **Status:** pre-v1 (v0.4.1) **Module / package:** `github.com/GameplanePanel/gameplane/audit-syslog-bridge` @@ -53,7 +55,7 @@ Single flat package (`main`): `main.go` (relay + config + server logic), `bridge ## Dependencies -**Go 1.27** (workspace-linked to `go.work` alongside `operator/`, `api/`, `agent/`, etc.) +**Go 1.27**, own `go.mod` (not part of Gameplane's `go.work`) **Imports:** stdlib only (`crypto/tls`, `net`, `net/http`, `log/slog`, `sync`, `time`, `context`, etc.). No external dependencies. @@ -70,7 +72,7 @@ Single flat package (`main`): `main.go` (relay + config + server logic), `bridge ## References -- `audit-syslog-bridge/README.md` — behavior table, config env-vars, transport tradeoffs, run instructions -- `docs/security.md` — audit integrity, threat model, pre-auth privacy (login page anonymity is separate; the bridge sits behind auth) -- `docs/install.md#audit-log` — Helm values to enable syslog-bridge, auth-header Secret wiring +- [`README.md`](README.md) — behavior table, config env-vars, transport tradeoffs, run instructions +- [`docs/security.md`](https://github.com/GameplanePanel/Gameplane/blob/master/docs/security.md) — audit integrity, threat model, pre-auth privacy (login page anonymity is separate; the bridge sits behind auth) +- [`docs/install.md#audit-log`](https://github.com/GameplanePanel/Gameplane/blob/master/docs/install.md#audit-log) — Helm values to enable syslog-bridge, auth-header Secret wiring - API audit webhook sink (`api/internal/audit/audit.go`) — `WebhookSink` calls `POST http://gameplane-audit-syslog-bridge..svc:8514/` with audit events diff --git a/system-deps.toml b/system-deps.toml index 5ebd0c0..aa789c7 100644 --- a/system-deps.toml +++ b/system-deps.toml @@ -6,10 +6,10 @@ component = "audit-syslog-bridge" name = "go" kind = "toolchain" version = "go" -reason = "Compiles and tests the audit-syslog-bridge module (go.work:3-21; inventory 2.1)." +reason = "Compiles and tests the audit-syslog-bridge module." [[dep]] name = "golangci-lint" kind = "cli" version = "golangci_lint" -reason = "make lint-go runs golangci-lint in this module (Makefile:302-305; GO_MODULES at Makefile:43)." +reason = "golangci-lint runs on this module with Gameplane's root .golangci.yml (shared go-component.yaml workflow)."