Registry Mirror
Skip to content

Conversation

@manodyaSenevirathne

@manodyaSenevirathne manodyaSenevirathne commented Oct 30, 2026 •

Copy link
Copy Markdown

Purpose

Platform API already records user changes in its audit table, but those records can only be read from the database, and several sensitive operations are not recorded at all: deploying, undeploying and restoring APIs on gateways, and issuing or revoking credentials (gateway tokens, secrets, WebSub HMAC secrets).

Goals

  • Optionally send each audit record as a JSON line to stdout, a rotating file, an HTTP log receiver, or any combination, for log collectors and SIEMs. The outputs follow the gateway's traffic logging.
  • Make audit recording opt-in (enabled, off by default).
  • Record the operations that change live gateway traffic or issue/revoke a credential.
  • Keep the existing audit table, its existing record call sites, and every API response unchanged.

Approach

AuditService. A new AuditService (internal/service/audit_service.go) wraps the existing AuditRepo and implements repository.AuditRepository, so the 63 existing Record(...) call sites, and the service-account one added on main since, are unchanged and also reach the outputs. For each record it generates the id and UTC time (to the microsecond, the finest every supported database stores) once, writes the row with AuditRepo.Record, then writes the record as one JSON line (tagged "logType":"audit") to every configured output. The audit table schema is unchanged.

Layout follows the policy engine's traffic logging (policy-engine/internal/analytics/publishers):

platform-api Gateway counterpart Holds
config/audit.go traffic-logging types and checks in internal/config The [platform_api.audit] types and their validation, run when the config loads
internal/service/audit_service.go log.go, sink_factory.go AuditService: builds one sink per name in outputs (one that can't be built closes the others and fails startup), writes the table row, builds the JSON line once, writes it to every sink, closes them
internal/service/audit_sink.go sink.go What every sink shares: the sink contract (Write, Close, Name) and a 30s error-log throttle
internal/service/audit_sink_stdout.go sink.go (writerSink) stdout
internal/service/audit_sink_file.go sink_file.go Append and size rotation
internal/service/audit_sink_http.go sink_http.go Bounded queue, batching, delivery and retries

Config validation checks everything that needs no filesystem access, including the output names. Opening the file (and checking its permissions) and reading the TLS files happen once, when the outputs are built during startup, before any listener starts. The traffic-logging validation does that I/O and then its sinks do it again; here it's done once, and a bad output still fails startup. NewAuditService returns an error for that reason. On shutdown the outputs are closed last, with their own 5s limit, so records from requests that just finished are flushed.

Configuration (all of it is in config/config-template.toml):

[platform_api.audit]
enabled = false                # true records audited changes; while false, nothing is recorded (no rows, no lines)
mask_sensitive_fields = false  # true writes "****" in place of the user in the output lines
outputs = []                   # any of "stdout", "file", "http"; empty keeps records in the table only

[platform_api.audit.file]
path = ""          # absolute; required for "file"
max_size_mb = 100  # rename to <path>.1 at this size; 0 disables rotation

[platform_api.audit.http]
endpoint = ""                     # required for "http"; https unless allow_insecure_transport
allow_insecure_transport = false
content_type = "application/x-ndjson"  # Fluent Bit's http input needs application/json
batch_max_events = 100
batch_max_bytes = 1048576
flush_interval = "5s"
queue_capacity = 10000            # when full, a new record is dropped
request_timeout = "10s"
max_retries = 3
retry_backoff = "1s"
[platform_api.audit.http.auth]
type = "none"                     # none | bearer | basic | header, each with its own sub-table
[platform_api.audit.http.tls]      # ca_file, cert_file, key_file, insecure_skip_verify
  • The user in the line: the table keeps the internal user id, unchanged. The line's performedBy shows the user's identity instead, resolved with IdentityService.DisplayIdentity as API responses do: the token's sub, or the username for file-based users. The internal id must not leave the process (identity.go). If the identity can't be resolved, performedBy is left empty and a warning is logged; the request is unaffected. With mask_sensitive_fields = true a non-empty performedBy is ****, the same mask traffic logging uses for headers.
  • Any output: an unknown or repeated name fails startup. At runtime a failed write drops the line and logs an error, at most once every 30s per output. It never fails the request, and the table row is still written.
  • file: created 0600 in a 0700 directory. An existing file that group or others can read fails startup. Rotation renames the live file to <path>.1 (logrotate's "create" mode), so at most 2 x max_size_mb is on disk. If a rotation can't open the new file (for example, the directory was removed), later writes retry the open, recreating the directory, so writing resumes without a restart. One writer per file: give each replica its own volume.
  • http: Write never blocks. Records go from a bounded in-memory queue to one sender, which POSTs newline-delimited JSON with content_type as the Content-Type (default application/x-ndjson; an empty or invalid value fails startup). batch_max_bytes caps the body; only a single record larger than it is sent over it, alone.
    • Transport errors, 429 and 5xx are retried with jittered exponential backoff. A 429's Retry-After replaces the backoff, capped at 30s; retry_backoff is at most 1h, so the doubling delay can't overflow. Other 4xx are not retried, and redirects are never followed. request_timeout bounds the whole attempt, including waiting for the response headers.
    • auth.type selects one header and reads only its own sub-table. Credentials go in {{ env }} / {{ file }}. A header name that isn't valid, a value with characters HTTP doesn't allow (such as a newline), or a basic.username containing a colon (RFC 7617) fails startup.
    • The client is built with httpkit/httpclient, the library behind platform-api's shared client. tls takes a CA bundle and an mTLS pair, uses TLS 1.2–1.3 with X25519MLKEM768 preferred, and logs the negotiated key exchange once.
    • The queue lives only in memory, so an outage longer than the queue and retries can absorb loses records from this output. The table keeps them.
  • Differences from traffic logging: there is no on_queue_full (always drop new), retry_abort_queue_ratio or shutdown_timeout, and no Prometheus metrics (platform-api has none). An empty outputs keeps records in the table only; traffic logging falls back to stdout. Like traffic logging, the http output doesn't use the SSRF dial guard, because the endpoint comes from operator config.

Helm. config.audit renders [platform_api.audit] and its sub-tables only when it is set, so a release without it renders as before. Keys are camelCase like the rest of config.* (maskPii, file.maxSizeMb, http.contentType, tls.caFile). An http auth credential must be an {{ env }} or {{ file }} token (add the key to the Secret and inject it through deployment.extraEnv); a literal fails the render. The file output gets its own emptyDir, auditLogVolume (512Mi), mounted when audit is enabled and outputs contains "file". The render fails when file.path is outside it, so the log never lands on the data volume. The ai-workspace umbrella passes platform-api.config.audit through.

New coverage (17 operations, non-AI resources only). Recorded only on success, with the acting user:

  • Deploy / undeploy / restore for GraphQL, WebSub and WebBroker APIs, and deploy for REST APIs (undeploy and restore were already recorded) — resource type deployment.
  • Gateway token rotate / revoke (gateway_token), secret create / update (secret), WebSub HMAC secret generate / regenerate / delete (hmac_secret).

Services that did not hold an audit dependency take an *AuditService; plugins get it through a new plugin.Deps.AuditService field (additive). GraphQL, WebSub and WebBroker undeploy / restore and HMAC secret delete now take the acting user: handlers resolve it with InternalUserID and ignore any error, so actor lookup never fails a request; the per-kind deployment adapter forwards the user it already had for GraphQL. A failed audit write never fails the request.

Deliberately not recorded: new records for AI resources (LLM provider and proxy deployments and API keys, MCP proxy and agent proxy deployments; their original audit records are unchanged), deleting a deployment record (non-REST kinds), adding gateways to an API, application keys and associations, LLM template copy / enable / delete, portal publish, meters, and secret delete (the soft delete has only the handle).

User stories

  • As an administrator, I can see who deployed, undeployed or restored an API on which gateway, and who issued or revoked gateway tokens, secrets and WebSub HMAC secrets.
  • As a platform team, I can ship audit records to a SIEM from stdout or from a file, separate from the application logs.

Documentation

  • config/config-template.toml and README.md document [platform_api.audit] enabled and outputs, and the file and http sub-tables.
  • Release note: audit recording is now off by default. Platform API used to write audit rows unconditionally, so a deployment that wants to keep its audit trail must set [platform_api.audit] enabled = true when upgrading. outputs (default empty) is new. With auditing enabled, audit rows are now also written for the operations listed above. Under Helm, set them through config.audit (see Helm above).

Automation tests

  • Unit tests

    AuditService: the row and the output line share one id and UTC time; a failed insert still writes the line and returns the insert error; an empty outputs builds no output. Existing tests updated for the new constructor arguments, its error return, enabled, and the actor parameters. No new unit tests for the file and http outputs; they were checked with temporary tests, listed below. Full config/..., internal/... and plugins/... suites pass in both the default and experimental builds (25/25 packages each), and the audit tests pass under -race.

  • Integration tests

    Automated (tests/framework):

    • platform-api-audit (SQLite) runs with every output on (stdout, a file and the testbench webhook). features/management-portal/resources/audit.feature creates and revokes a gateway token, then checks that each change appears exactly once, with its action, resource type, organization and user, in the audit table, the Platform API log, the file and at the receiver. It also checks that a read and a rejected request (404) record nothing.
    • platform-api-audit-masked (SQLite) runs audit_masked.feature: with mask_sensitive_fields = true, the table keeps the user while the log, the file and the receiver show ****.
    • Both blocks also pass on PostgreSQL (run locally with db: postgres; the committed blocks stay on SQLite).
    • Reading Platform API's SQLite database needed a fix in tests/framework/core/runtime/dbaccess.go. The framework copies the database with its -wal and -shm files and skips one that doesn't exist, but its isNotFound check never recognised the Docker daemon's 404, so a missing -wal failed the read. Platform API doesn't use WAL mode, so its -wal never exists. isNotFound now also matches the daemon's Could not find the file message; any other error is still a real failure.

    Also verified live against a locally built Platform API:

    • Every new operation over REST (REST, GraphQL, WebSub and WebBroker deployments, gateway tokens, secrets, HMAC secrets): one row per change, every row with the acting user and the real organization UUID, stdout lines matching the table. LLM, MCP and agent proxy deployments, LLM API keys, and the MCP server undeploy_api tool write no new rows.
    • Audit insert forced to fail (SQLite trigger): every request still returned its normal status code.
    • All three outputs together (outputs = ["stdout", "file", "http"], against a local HTTP receiver):
      • Three project creates wrote the same three lines to stdout, to the file (0600) and to the receiver, matching the audit rows' id and time.
      • The bearer token was read from {{ env }}.
      • With flush_interval = "30s", SIGTERM flushed the queued batch.
    • Startup fails for an http:// endpoint without allow_insecure_transport, and for an existing audit file that group or others can read.
    • Temporary tests (not committed):
      • Config: unknown and repeated outputs, a missing, relative or .. path, and bad auth or TLS settings are all rejected; enabled = false builds no outputs.
      • File: rotation at max_size_mb = 1 kept the live file and .1 each under 1 MiB.
      • HTTP retries: a 500 is retried with backoff, max_retries = 2 gives 3 attempts, 400 and 302 are not retried, and a 429 waits for its Retry-After.
      • HTTP failures: a full queue drops the new record and logs it once, and a receiver that is down does not hold up shutdown.
      • HTTP TLS: an https endpoint with ca_file negotiated X25519MLKEM768.
    • A separate full QA pass against the built binary (SQLite):
      • Config: 75/75 checks passed at startup, and the 9 output combinations (including table-only and enabled = false) produced byte-identical lines matching the table rows.
      • Records: all 17 new records are written, and AI resources get none.
      • File: rotation and restart passed, and a read-only directory keeps requests at 200.
      • HTTP: batching by events, bytes and interval passed. So did every auth type (including Authorization: Splunk <token> from {{ env }} and a token from {{ file }}), CA, mTLS and skip-verify, and the 5xx, 4xx, 3xx, 429 (seconds, HTTP-date, 30s cap), hung-receiver and receiver-down cases.
      • Load: a full queue under 6,000 requests kept memory and latency flat. A forced audit-insert failure left every status code unchanged, and the outputs still got every line. 3,001 records over 100–200 threads gave equal row and line counts in every output, with no interleaving.
      • Shutdown: SIGTERM delivered every queued record, and exited in 5.1s with a hung receiver.
      • Bugs it found, now fixed: the file output stopped silently after its directory was removed; request_timeout was cut off at 10s; a malformed auth header was only caught at delivery; batch_max_bytes could be exceeded by one record. Each fix was re-checked.
    • Re-run on the final code (real binary):
      • Outputs: create, update, create and delete of projects gave 4 rows and the same 4 lines on stdout, in the file and at the receiver.
      • TLS, 12 cases: CA trusted (TLS 1.3, X25519MLKEM768), skip-verify (with its startup warning), mTLS, and mTLS plus bearer are all delivered, and the token is never logged. An untrusted cert, a wrong CA, and a missing client cert are each dropped and logged, while requests still succeed. A missing or garbage CA, a cert without its key, and a mismatched key each fail startup. TLS settings on an http:// endpoint are ignored.
      • New checks: a colon in basic.username and a 2h retry_backoff each fail startup; 1h starts.
      • Masking (run before mask_pii was renamed to mask_sensitive_fields): with false, the row keeps the internal user id while stdout, the file and the receiver show admin. With true, all three show ****.
    • No gateway-facing change: an unmodified-main Platform API works with the new gateway-controller (gateway-controller: add audit logs #3999), and this branch changes no event payloads or gateway APIs.
    • Helm chart (temporary scripts, not committed), with Helm v4.3.1 and v3.22.1:
      • Unchanged without audit: 7 value sets (defaults, PostgreSQL, persistence off, IDP auth, webhook on, configToml, extra volumes) render byte-for-byte as before.
      • Rendering, 45 cases: every key with its TOML type, --set values and false booleans; the section sits after [platform_api.webhook] and before configToml. The volume: mounted only for an enabled file output, overridable, and the render fails for a path on the data volume, ../ traversal, a sibling prefix or a relative path. The credential check: literal bearer, basic and header values fail; {{ env }}, {{ file }}, a Splunk {{ env }} header and allowPlaintextCredentials: true render. Every manifest decodes strictly into the Kubernetes API types.
      • Loaded by Platform API: 9 rendered configs through LoadConfig, with {{ env }} and {{ file }} credentials resolved.
      • The pod as rendered: the image built from this branch, run with the chart's config, mounts and env, and a 0777 tmpfs as the emptyDir. An organization create and a project create, update and delete gave the same 4 lines on stdout, in the file (0700 directory, 0600 file) and at the receiver (Authorization: Bearer from the env variable, which is never logged).
      • Umbrella: ai-workspace with this chart vendored renders the audit section and volume from platform-api.config.audit.

Security checks

Samples

N/A

Related PRs

Test environment

macOS (arm64), Go 1.27.3, SQLite. No schema changes; the audit INSERT statement is unchanged for PostgreSQL and SQL Server.

🤖 Generated with Claude Code

manodyaSenevirathne and others added 5 commits October 30, 2026 11:42
Add AuditService, which records every audit entry in the audit table as
before and, when [platform_api.audit] stdout is on, also writes it to
stdout as a JSON line tagged "logType":"audit" for log collectors. It
satisfies repository.AuditRepository, so the existing Record call sites
are unchanged. Off by default.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AuditService now generates the record's uuid and UTC time (to the
microsecond, the finest every supported database stores) and passes them
to AuditRepo.Record, so the audit row and the stdout line carry identical
values. The stdout line gains an "id" field to join it to its row. The
call sites and the audit table are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Record an audit entry for the user-facing operations that change live
gateway traffic or issue/revoke a credential and had none:

- deploy, undeploy and restore for GraphQL APIs, LLM providers, LLM
  proxies, MCP proxies, agent proxies, WebSub and WebBroker APIs, and
  deploy for REST APIs (resource type "deployment")
- gateway token rotate and revoke ("gateway_token")
- secret create and update ("secret")
- LLM provider and proxy API key create and delete ("api_key")
- WebSub HMAC secret generate, regenerate and delete ("hmac_secret")

Services that did not hold an audit dependency take an *AuditService
(plugins get it through plugin.Deps.AuditService). Undeploy, restore and
HMAC secret delete now take the acting user; handlers resolve it without
failing the request, and the per-kind deployment adapter and MCP server
tools forward the user they already had. Existing audit call sites are
unchanged, and a failed audit write never fails the request.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replace [platform_api.audit] stdout with output: "none" (default),
"stdout", or "file". With "file", each record is appended as a JSON line
to ./data/logs/audit.log (created 0600); if the file cannot be opened,
a warning is logged and records go to the audit table only. An unknown
output value fails startup.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • Resume reviews
  • Trigger review
Walkthrough

The PR adds configurable audit logging with database persistence and stdout, file, and HTTP outputs. It wires the audit service into Platform API services, records credential and deployment lifecycle events, and passes actor IDs through GraphQL, WebBroker, and WebSub deployment operations.

Changes: Audit logging

Layer / File(s) Summary
Audit configuration and validation
platform-api/config/audit.go, platform-api/config/config.go, platform-api/config/default_config.go, platform-api/config/config-template.toml, platform-api/README.md
Adds configuration for stdout, file, and HTTP audit outputs, including authentication and TLS options. Configuration loading validates enabled outputs. Defaults and documentation describe the settings and output behavior.
Audit output sinks
platform-api/internal/service/audit_sink.go, platform-api/internal/service/audit_sink_file.go, platform-api/internal/service/audit_sink_http.go, platform-api/internal/service/audit_sink_stdout.go
Adds stdout output, permission-checked file output with rotation, and queued HTTP output with batching and retries. Sink errors are throttled in logs.
Audit service and server wiring
platform-api/internal/service/audit_service.go, platform-api/internal/service/audit_service_test.go, platform-api/internal/repository/audit.go, platform-api/internal/server/server.go, platform-api/internal/plugin/plugin.go, platform-api/internal/mcpserver/direct_test.go, platform-api/internal/handler/agent_proxy_card_fetch_integration_test.go, platform-api/internal/service/api_secret_integration_test.go, platform-api/internal/service/artifact_import_agent_proxy_test.go, platform-api/internal/service/mcp_secret_integration_test.go
Adds AuditService to create IDs and timestamps, persist audit rows, and write records to configured sinks. Server startup creates and distributes the service; shutdown closes it. Integration-test setups use the service.
Credential and token audit events
platform-api/internal/service/secret_service.go, platform-api/internal/service/gateway.go, platform-api/plugins/eventgateway/service/websub_api_hmac_secret.go, platform-api/plugins/eventgateway/handler/websub_api_hmac_secret.go, platform-api/internal/handler/*, platform-api/internal/service/*
Records secret create/update, gateway-token create/revoke, and HMAC-secret create/update/delete events when an audit service is configured. Related constructor call sites and tests pass the added dependencies.
Deployment audit events and actor attribution
platform-api/internal/service/deployment.go, platform-api/internal/service/graphql_deployment.go, platform-api/internal/service/deployments_by_kind.go, platform-api/internal/handler/graphql_deployment.go, platform-api/plugins/eventgateway/plugin.go, platform-api/plugins/eventgateway/handler/*deployment.go, platform-api/plugins/eventgateway/service/*deployment.go, platform-api/internal/service/graphql_deployment_test.go
Records deploy, restore, and undeploy events in deployment services. GraphQL, WebBroker, and WebSub handlers pass request actor IDs through their deployment operations.

Estimated code review effort: 4 (Complex) | ~60 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant PlatformService
  participant AuditService
  participant AuditRepo
  participant AuditSink
  PlatformService->>AuditService: Record an audit event
  AuditService->>AuditRepo: Insert event ID, timestamp, and fields
  AuditService->>AuditSink: Write the JSON record
Loading

Possibly related issues

  • wso2/api-platform issue 3971 — The PR adds database, file, and stdout audit logging requested by the issue. The issue also requests gateway-controller audit logging, which this PR does not change. Completion of the issue is not established.
Merge Risk: Moderate · previous review 0e34c

Audit output still has request and shutdown blocking paths that should be corrected before merging. Large HTTP buffer settings also lack allocation limits, and some credential and deployment operations can lose actor attribution after an identity lookup failure. Auditing remains opt-in, which limits exposure.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed

Check name Status Explanation
Title check Passed The title names two real parts of the changeset: audit log output (the new AuditService with stdout, file and HTTP sinks and the [platform_api.audit] config) and audit coverage for deployments and cre…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description covers the template and explains the changes in detail. The claimed committed integration tests and Helm changes do not appear in the supplied file summary and should be verified.
Full details: Title check

Explanation

The title names two real parts of the changeset: audit log output (the new AuditService with stdout, file and HTTP sinks and the [platform_api.audit] config) and audit coverage for deployments and credential changes (deploy/undeploy/restore and gateway token, secret, and HMAC secret events). It is somewhat broad because it lists two aspects, but it is specific and related to the main change, so it passes.

Full details: Docstring Coverage

Explanation

Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 80 functions across 42 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 145bfc5 and 0e34c26.

Files selected for processing: 7

  • platform-api/config/audit.go
  • platform-api/config/config-template.toml
  • platform-api/internal/service/audit_service.go
  • platform-api/internal/service/audit_sink.go
  • platform-api/internal/service/audit_sink_file.go
  • platform-api/internal/service/audit_sink_http.go
  • platform-api/internal/service/audit_sink_stdout.go
Files skipped from review as they are similar to previous changes: 4

  • platform-api/internal/service/audit_sink_stdout.go
  • platform-api/internal/service/audit_sink.go
  • platform-api/config/config-template.toml
  • platform-api/internal/service/audit_service.go

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

content_type, default application/x-ndjson, sets the Content-Type of each
batch, as in traffic logging. Fluent Bit's http input rejects
application/x-ndjson and needs application/json; the template no longer
says it accepts the default as-is. An empty or invalid value fails startup.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R4Ykia1zPCCS9XjiNMVkVE
@manodyaSenevirathne

Copy link
Copy Markdown
Author

@coderabbitai approve

coderabbitai[bot]
coderabbitai Bot previously approved these changes Nov 4, 2026
@coderabbitai

coderabbitai Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor
Action performed

Comments resolved and changes approved.

Renders config.audit as [platform_api.audit] (and its file, http, auth and tls
tables) only when it is set, so a release without it renders byte-for-byte as
before. Keys are camelCase like the rest of config.*.

Secret values never land in the ConfigMap: an http auth credential must be an
{{ env }} or {{ file }} token, and a literal fails the render.

The "file" output gets its own emptyDir (auditLogVolume), mounted when audit is
enabled and outputs contains "file", and the render fails when file.path is
outside it, so the audit log never lands on the data volume.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R4Ykia1zPCCS9XjiNMVkVE
The chart defaults auditLogVolume and the README documents config.audit,
so values.yaml stays as it was.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@CLAassistant

CLAassistant commented Nov 5, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

…t records

Cover the stdout, file and http outputs (batching, retries, Retry-After,
the queue limit, close, TLS with the receiver's CA and the X25519MLKEM768
key exchange), every [audit] validation rule, mask_pii and a failed
identity lookup, a failed output build, and the GraphQL deploy, undeploy
and restore records.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R4Ykia1zPCCS9XjiNMVkVE
@manodyaSenevirathne

Copy link
Copy Markdown
Author

@coderabbitai approve

coderabbitai[bot]
coderabbitai Bot previously approved these changes Nov 6, 2026
@coderabbitai

coderabbitai Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor
Action performed

Comments resolved and changes approved.

The fields it masks are listed once, in auditSensitiveFields, and masked
by one function. An empty value now stays empty, so "****" always
stands for a real value. The Helm value is maskSensitiveFields.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R4Ykia1zPCCS9XjiNMVkVE
manodyaSenevirathne and others added 4 commits November 6, 2026 13:30
actorIdentity turns the internal user id into the identity the line
shows, or "****" when the lookup fails, and masking is then a separate
step, as in the gateway. The lookup now also runs when masking is on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R4Ykia1zPCCS9XjiNMVkVE
"****" now only ever means mask_sensitive_fields. A failed lookup is
logged, and the table row still holds the internal user id.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R4Ykia1zPCCS9XjiNMVkVE
Two blocks run features/management-portal/resources/audit*.feature on
SQLite: platform-api-audit with every output on, and
platform-api-audit-masked with mask_sensitive_fields. They check that a
change reaches the audit table, stdout, the file and the testbench
webhook, that reads and rejected requests are not recorded, and that
masking hides the user in the outputs only.

openEmbeddedSQLite treated a missing -wal file as a failed copy: the
Docker client marks a daemon 404 for errors.Is, not with a NotFound
method, so a store without a WAL sidecar could not be read.
isNotFound now uses errdefs.IsNotFound, which recognises both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R4Ykia1zPCCS9XjiNMVkVE
Revoking an already revoked gateway token still returns 200 and updates
the row as before, but no longer records a second REVOKE.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R4Ykia1zPCCS9XjiNMVkVE
@manodyaSenevirathne
manodyaSenevirathne force-pushed the feat/platform-api-audit-sinks branch from d22075a to 91d8bfe Compare November 6, 2026 09:20
…udit-sinks

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R4Ykia1zPCCS9XjiNMVkVE
@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Dependency Validation Results

Dependency name: github.com/containerd/errdefs
Version: v1.0.0
Approved: ❌ No - Module not found in dependency registry


Next Steps

  1. Review the validation failures listed above
  2. Check if dependencies are in the approved dependency list
  3. Options to resolve:
    • Remove the unapproved dependencies from this PR
    • OR submit a PR to add these dependencies to the approved list in engineering-governance
  4. Once resolved, push changes to re-run validation

This PR is blocked until all dependencies are approved.

⚠️ Please verify the scope of the dependencies usage is necessary

containerd/errdefs is not in the approved Go dependency list, so it goes
back to an indirect dependency. isNotFound keeps the NotFound method check
and also matches the daemon's "Could not find the file" message, the only
mark a 404 from the archive endpoint carries. Any other error is still a
real copy failure.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NkCRUwS9ATVCewAE7e97xr
manodyaSenevirathne and others added 2 commits November 9, 2026 10:55
…udit-sinks

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…udit-sinks

main split the integration suite's blocks into suites/it/blocks/ (wso2#4094),
so the two platform-api audit blocks move from it-suite.yaml to
blocks/platform-api.yaml.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@manodyaSenevirathne
manodyaSenevirathne force-pushed the feat/platform-api-audit-sinks branch from 9b45c33 to b292313 Compare November 12, 2026 06:14
manodyaSenevirathne added a commit to manodyaSenevirathne/docs-api-platform that referenced this pull request Nov 25, 2026
The Platform API's audit outputs on main (wso2/api-platform#4000) work
as in the 1.0.0 update, so the page is the 1.0.0 page with three
differences: no update-level note, subscription plan changes from the
portal are recorded, and performedBy shows the user's display name, or
their sub if none is recorded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants