tourze / doctrine-sensitive-tag-bundle
Symfony Bundle for tracking sensitive data access with Doctrine entities
Installs: 8
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/tourze/doctrine-sensitive-tag-bundle
Requires
- php: ^8.1
- doctrine/common: ^3.5
- doctrine/dbal: ^4.0
- doctrine/doctrine-bundle: ^2.13
- doctrine/orm: ^3.0
- doctrine/persistence: ^3.1 || ^4
- symfony/config: ^6.4
- symfony/dependency-injection: ^6.4
- symfony/doctrine-bridge: ^6.4
- symfony/framework-bundle: ^6.4
- symfony/http-kernel: ^6.4
- symfony/yaml: ^6.4 || ^7.1
- tourze/doctrine-indexed-bundle: 0.0.*
- tourze/doctrine-ip-bundle: 0.0.*
- tourze/doctrine-timestamp-bundle: 0.0.*
- tourze/doctrine-user-bundle: 0.0.*
Requires (Dev)
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^10.0
This package is auto-updated.
Last update: 2025-11-01 19:14:47 UTC
README
A Symfony bundle to mark and track sensitive data in Doctrine entities, providing automatic logging of access operations for sensitive data.
Features
- Mark sensitive data through the
SensitiveTagAwareInterfaceinterface - Automatically log access, creation, update, and deletion operations on sensitive data
- Provides entities and event subscribers for recording sensitive data access logs
- Supports data classification according to network security standards
- Seamless integration with Doctrine ORM and Symfony framework
Requirements
- PHP 8.1 or higher
- Symfony 7.3 or higher
- Doctrine ORM 3.0 or higher
- Doctrine Bundle 2.13 or higher
Installation
composer require tourze/doctrine-sensitive-tag-bundle
Usage
- Implement the
SensitiveTagAwareInterface:
use Tourze\DoctrineSensitiveTagBundle\Model\SensitiveTagAwareInterface; class User implements SensitiveTagAwareInterface { // ... public function isResourceSensitive(): bool { // Determine if this entity contains sensitive data return true; } }
- The bundle will automatically record operations on sensitive entities in the
TouchLogtable.
Advanced Usage
Custom Touch Log Configuration
You can customize the touch logging behavior by implementing custom event listeners
or extending the default SensitiveEntityListener.
Data Classification Levels
According to "Network Security Standard Practice Guide - Network Data Classification Guidelines", data is classified into four levels:
- Level 1: Public data
- Level 2: Internal data, may cause minor harm to rights and interests
- Level 3: Confidential data, may cause general harm to rights and interests
- Level 4: Highly confidential data, may cause serious harm to rights and interests
Sensitive personal information should be at least Level 4, general personal information at least Level 2.
Running Tests
Execute the following command to run unit tests:
./vendor/bin/phpunit packages/doctrine-sensitive-tag-bundle/tests
Contributing
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests to ensure everything works
- Submit a pull request
Please ensure your code follows the project's coding standards and includes appropriate tests.
License
This bundle is released under the MIT License. See the LICENSE file for more information.