Table of Contents

Class AuditActionFilter

Namespace
FishMMO.ControlPanel.Services
Assembly
FishMMO-ControlPanel.dll

Records every privileged request — reads as well as writes — whether or not its author remembered to.

public sealed class AuditActionFilter : IAsyncActionFilter, IFilterMetadata
Inheritance
AuditActionFilter
Implements
Inherited Members

Remarks

Every Game Master and Admin action must appear in the audit log. The in-game commands get that for free because they are audited at the single access gate where a command cannot be registered without declaring a level. HTTP endpoints had no equivalent: coverage depended on each author adding a call, which is exactly the kind of discipline that holds until the day somebody is in a hurry.

This filter is that equivalent. It runs on every action, decides from the endpoint's own authorization policy whether the action is privileged, and writes a row if it is. An endpoint added tomorrow with no audit code in it is still recorded.

Reads are recorded too (2026-09-14). Every Game Master and Admin action is tracked, with no exception, and looking at a player's account, tickets or chat is an action. A read with no AuditedAttribute is recorded under view.<controller>.<action> with its query string as the details, so what was searched for is part of the record. Player self-service and anonymous endpoints are still not recorded: those are not staff.

It records refusals as well as successes, including the request that never reached the action because model binding rejected it — an operator repeatedly failing to reach something is the more interesting record.

Automatic refreshes are not recorded (2026-09-14, the owner's decision "skip auto-refreshes"). The first load of a page and every refresh somebody asked for — a Refresh button, a filter change, a page click, the re-read after an action — are recorded. A page re-reading itself on a timer is not: the browser marks those requests with X-Panel-Refresh: auto (RefreshHeader), and a GET or HEAD carrying it is skipped here unless it was refused. A board polled every five seconds would otherwise bury every row that matters.

The header is trusted for reads only. A write is recorded whatever it carries; nothing a client sends can make one skippable. For a read, the browser already decides whether to issue the request at all — the mark hides nothing the shipped page does not leave out by simply not polling — and the shipped page marks only its timers, so every page an operator opens still leaves its row. A refused read is recorded even when marked (here, and by PrivilegedRequestMiddleware for a refusal decided by policy): a refused poll is a probe, and refusals are rare. What the mark cannot defend against is an operator who edits the page's script to mark every read; those reads would go unrecorded. That is the cost of a client-side mark, accepted with the decision. Closing it would need a server-side rule, such as skipping only a repeat of a read the same session recorded recently.

Constructors

AuditActionFilter(AuditScope, AuditWriter, ILogger<AuditActionFilter>)

public AuditActionFilter(AuditScope scope, AuditWriter writer, ILogger<AuditActionFilter> log)

Parameters

scope AuditScope
writer AuditWriter
log ILogger<AuditActionFilter>

Fields

AutomaticRefresh

The one value of RefreshHeader that marks an automatic refresh.

public const string AutomaticRefresh = "auto"

Field Value

string

RefreshHeader

The request header the panel's browser code sets on a timer-driven reload.

public const string RefreshHeader = "X-Panel-Refresh"

Field Value

string

Methods

OnActionExecutionAsync(ActionExecutingContext, ActionExecutionDelegate)

Called asynchronously before the action, after model binding is complete.

public Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)

Parameters

context ActionExecutingContext

The ActionExecutingContext.

next ActionExecutionDelegate

The ActionExecutionDelegate. Invoked to execute the next action filter or the action itself.

Returns

Task

A Task that on completion indicates the filter has executed.