Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .github/assets/easyadmin_integration.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,35 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

---

## [2.2.0]

### 2.2.0 Installation Note

**Important for UI updates**: Please run the following command to publish the newly added CSS file for the EasyAdmin integration:

```bash
php bin/console assets:install
```

### 2.2.0 New Features

- **JSON & CSV Export**: Added ability to export filtered audit logs to JSON or CSV directly from the index page via a dropdown action menu. Uses memory-efficient `toIterable()` streaming for large datasets through the new `findAllWithFilters()` repository method.
- **Transaction Drill-down Pagination**: The transaction drill-down view now supports cursor-based (keyset) pagination using `afterId`/`beforeId` for deterministic, offset-free navigation through large transaction groups.
- **Integrity Signature Badge**: Visual integrity verification on the Changes tab — displays "Verified Authentic", "Tampered / Invalid", or "Integrity Disabled" badges with corresponding icons and color coding to instantly alert admins to tampered logs.
- **"Reverted" UI State Protection**: Added an `isReverted()` repository check that powers a new "REVERTED" badge on the detail page. The revert button is now dynamically disabled with an "Already Reverted" state to prevent duplicate reverts of the same log.
- **Conditional EasyAdmin Registration**: The `AuditLogCrudController` is now conditionally registered as a service only when `EasyAdminBundle` is actively installed, checked via `kernel.bundles` at compile time in `AuditTrailExtension`.

### 2.2.0 Improvements

- **Optimized `isReverted()` Query**: Replaced N+1 entity hydration with a single `COUNT` + `LIKE` query against the JSON `context` column, eliminating full result set loading for the "Reverted" UI check.
- **Keyset Pagination UUID Typing**: `afterId`/`beforeId` parameters now explicitly use the `'uuid'` Doctrine type constraint for proper cross-database UUID comparison in cursor-based pagination.
- **Soft Delete Detection Fix**: `ChangeProcessor::determineUpdateAction()` now correctly detects soft-deletes when `oldValue` is `null` and `newValue` is not (previously only detected restores).
- **Revert Subscriber Silencing**: Wrapped the entire revert operation in a `try/finally` block to ensure the `ScheduledAuditManagerInterface` subscriber is reliably re-enabled even if the revert fails mid-transaction.
- **Revert Dry-Run Associations**: `RevertValueDenormalizer` now uses `EntityManager::getReference()` instead of `find()` during dry-runs to avoid unnecessary database query overhead for associated entities.
- **Revert Access Action**: `AuditReverter::determineChanges()` now gracefully handles `ACTION_ACCESS` (read-tracking) logs by returning empty changes instead of throwing an exception.

---

## [2.1.0]

### 2.1.0 Breaking Changes
Expand Down
4 changes: 2 additions & 2 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ The following versions of AuditTrailBundle are currently being supported with se

| Version | Supported |
| ------- | ------------------ |
| 1.9 | :white_check_mark: |
| < 1.0 | :x: |
| 2.0 | :white_check_mark: |
| < 2.0 | :x: |

## Reporting a Vulnerability

Expand Down
8 changes: 8 additions & 0 deletions docs/integrations.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,12 @@ yield MenuItem::linkToCrud('Audit Logs', 'fas fa-history', AuditLog::class)
->setController(AuditLogCrudController::class);
```

### Publishing Assets

To ensure the custom styling for the Audit Log UI (diffs, action badges, and revert modals) loads correctly, you must install the bundle's public assets:

```bash
php bin/console assets:install
```

![EasyAdmin Integration Showcase](../.github/assets/easyadmin_integration.png)
4 changes: 2 additions & 2 deletions src/Contract/AuditExporterInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
interface AuditExporterInterface
{
/**
* @param array<AuditLog> $audits
* @param iterable<AuditLog> $audits
*/
public function formatAudits(array $audits, string $format): string;
public function formatAudits(iterable $audits, string $format): string;

public function formatFileSize(int $bytes): string;
}
16 changes: 16 additions & 0 deletions src/Contract/AuditLogRepositoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,26 @@ public function deleteOldLogs(DateTimeImmutable $before): int;
*/
public function findWithFilters(array $filters = [], int $limit = 30): array;

/**
* @param array<string, mixed> $filters
*
* @return iterable<AuditLog>
*/
public function findAllWithFilters(array $filters = []): iterable;

/**
* @return array<AuditLog>
*/
public function findOlderThan(DateTimeImmutable $before): array;

public function countOlderThan(DateTimeImmutable $before): int;

/**
* @param array<string, mixed> $criteria
*/
public function count(array $criteria = []): int;

public function find(mixed $id): ?object;

public function isReverted(AuditLog $log): bool;
}
1 change: 1 addition & 0 deletions src/Contract/AuditReverterInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@ public function revert(
bool $force = false,
array $context = [],
bool $silenceSubscriber = true,
bool $verifySignature = true,
): array;
}
Loading
Loading