Skip to content

fix(admin_audit): handle audit reads for new files - #63305

Open
joshtrichards wants to merge 5 commits into
masterfrom
jtr/fix-auditLog-files-null
Open

fix(admin_audit): handle audit reads for new files#63305
joshtrichards wants to merge 5 commits into
masterfrom
jtr/fix-auditLog-files-null

Conversation

@joshtrichards

Copy link
Copy Markdown
Member
  • Resolves: #

Summary

Handle audit logging for file reads that occur before a new file has been assigned a file ID.

BeforeNodeReadEvent can provide a NonExistingFile without an ID. Although #47071 avoided calling getId() for this case, Action::log() still treated the resulting parameter as missing because it used !isset(). As a result, the intended audit entry was not written.

Changes:

  • Use not-yet-assigned as the audit ID for NonExistingFile reads.
  • Treat explicitly provided null values as valid audit parameters.
  • Clarify Action::log() parameter validation and formatting.
  • Support both DateTime and DateTimeImmutable through DateTimeInterface.
  • Contraint onAction::log() with PHPDoc to values that can be safely normalized and passed to vsprintf() without introducing a behavior change (static analysis only).
  • Avoid repeated node and source/target accessor calls in file actions as a small clarity and performance cleanup.

This preserves the audit event and makes the unavailable ID explicit in the log output:

File with id "not-yet-assigned" accessed: "..."

TODO

  • ...

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
refactor(admin_audit): improve audit parameter handling
refactor(admin_audit): improve audit parameter handling
- clarify missing-parameter validation and logging;
- support DateTimeInterface values;
- simplify the vsprintf invocation.
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
And align event handlers for consistency.
Signed-off-by: Josh <josh.t.richards@gmail.com>
@joshtrichards
joshtrichards requested a review from a team as a code ownerAugust 17, 2026 00:24
@joshtrichards
joshtrichards requested review from Altahrim, CarlSchwan, come-nc and leftybournes and removed request for a teamAugust 17, 2026 00:24
@CarlSchwanCarlSchwan added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Aug 17, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@joshtrichards@CarlSchwan@come-nc