Skip to content

Auditing ng - First Part - #3864

Draft
micbar wants to merge 13 commits into
mainfrom
auditing-ng
Draft

micbar wants to merge 13 commits into
mainfrom
auditing-ng

Conversation

@micbar

@micbar micbar commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Description

First part of the audit log from ADR 0006. The services emit audit events into the JetStream stream audit, the audit service writes every event as one line of JSON to stdout and, if configured, to an OpenTelemetry Collector.

  • audit service: reads the stream, acks only after the write, stdout and OTLP output; the old audit log stays available with AUDIT_LEGACY_ENABLED
  • proxy: logins, failed logins, public link access and backchannel logouts
  • proxy: passes client address, user agent, auth method, session and OIDC client to the services in X-Audit-Context
  • graph: user, group, group member and app role changes
  • frontend, sharing, storage-users: audit settings for reva, the file and share events come from there
  • off by default, enable it with OC_AUDIT_ENABLED=true and OC_ADD_RUN_SERVICES=audit

Needs #3464, the first four commits are from there.
Needs opencloud-eu/reva#956, the reva bump and the vendoring are still missing.

Related Issue

Motivation and Context

The old audit log is built from the domain events. It only sees successful actions, has no client address and its records have no stable format for a SIEM.

How Has This Been Tested?

  • test environment: opencloud server with OC_AUDIT_ENABLED=true, the audit service in its own process
  • test case 1: unit tests in the audit service, proxy, graph and reva pkg/audit
  • test case 2: share changes from the web client, records with the right client address and user agent

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests only (no source changes)

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation added

@codacy-production

codacy-production Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 281 complexity

Metric Results
Complexity 281

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

Comment thread services/audit/README.md
| `outcome`, `outcome.reason` | `success`, `failure` or `denied`, with a machine readable reason on failures |
| `severity` | `info`, `notice`, `warning` or `alert`; failures and denials are at least `warning` |
| `tenant.id` | empty on single-tenant installations |
| `actor.type`, `actor.id`, `actor.name`, `actor.impersonated_by` | type is `user`, `service`, `public_link`, `guest`, `anonymous`, `system` or `cli` |

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Müsste actor.impersonated_by nicht auch actor.impersonated_by_id und actor.impersonated_by_name sein? außerdem ist die id ja eher nur bei uns zu finden. vllt ist die email da etwas schöner? kann ja optional sein?

micbar added a commit to maki5/opencloud that referenced this pull request Oct 30, 2026
  chi's ClientIPFrom* header middlewares trust the header from anyone who can
  reach us. Pick the middleware per request instead: headers are only read
  when the peer is a trusted proxy, everyone else gets their network address.

  - PROXY_TRUSTED_PROXIES, defaults to loopback and private ranges
  - PROXY_CLIENT_IP_HEADER, defaults to X-Forwarded-For, e.g. CF-Connecting-IP
  - drop the strategy setting and xff_trusted_hops
  - pass the client address to the services in X-Forwarded-For instead of
    X-Client-Ip, reva reads it e.g. for OCM
  - same check in collaboration, traefik routes to it directly
  - OC_TRUSTED_PROXIES and OC_CLIENT_IP_HEADER set both services
  - the other services only drop RealIP, none of them reads the address

  Taken from opencloud-eu#3864 and opencloud-eu#3464 (comment)
maki5 and others added 4 commits October 30, 2026 15:13
  chi's ClientIPFrom* header middlewares trust the header from anyone who can
  reach us. Pick the middleware per request instead: headers are only read
  when the peer is a trusted proxy, everyone else gets their network address.

  - PROXY_TRUSTED_PROXIES, defaults to loopback and private ranges
  - PROXY_CLIENT_IP_HEADER, defaults to X-Forwarded-For, e.g. CF-Connecting-IP
  - drop the strategy setting and xff_trusted_hops
  - pass the client address to the services in X-Forwarded-For instead of
    X-Client-Ip, reva reads it e.g. for OCM
  - same check in collaboration, traefik routes to it directly
  - OC_TRUSTED_PROXIES and OC_CLIENT_IP_HEADER set both services
  - the other services only drop RealIP, none of them reads the address

  Taken from #3864 and #3464 (comment)

# Conflicts:
#	services/proxy/README.md
@micbar

micbar commented Oct 30, 2026

Copy link
Copy Markdown
Member Author

@butonic The RealIP changes are now in the PR from @maki5 so this has become much smaller.

micbar added a commit that referenced this pull request Oct 30, 2026
  chi's ClientIPFrom* header middlewares trust the header from anyone who can
  reach us. Pick the middleware per request instead: headers are only read
  when the peer is a trusted proxy, everyone else gets their network address.

  - PROXY_TRUSTED_PROXIES, defaults to loopback and private ranges
  - PROXY_CLIENT_IP_HEADER, defaults to X-Forwarded-For, e.g. CF-Connecting-IP
  - drop the strategy setting and xff_trusted_hops
  - pass the client address to the services in X-Forwarded-For instead of
    X-Client-Ip, reva reads it e.g. for OCM
  - same check in collaboration, traefik routes to it directly
  - OC_TRUSTED_PROXIES and OC_CLIENT_IP_HEADER set both services
  - the other services only drop RealIP, none of them reads the address

  Taken from #3864 and #3464 (comment)

# Conflicts:
#	services/proxy/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants