tourze / doctrine-sensitive-tag-bundle
敏感数据标记
0.0.3
2025-04-25 05:45 UTC
Requires
- php: ^8.1
- doctrine/common: ^3.5
- doctrine/dbal: ^3.7.0 || ^4.0
- doctrine/doctrine-bundle: ^2.13
- doctrine/orm: ^2.20 || ^3.0
- doctrine/persistence: ^3.1 || ^4
- psr/log: ^3|^2|^1
- symfony/config: ^6.4
- symfony/dependency-injection: ^6.4
- symfony/framework-bundle: ^6.4
- symfony/http-kernel: ^6.4
- symfony/yaml: ^6.4 || ^7.1
- tourze/bundle-dependency: 0.0.*
- tourze/doctrine-helper: 0.0.*
- 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-04-25 14:29:23 UTC
README
A Symfony bundle to mark and track sensitive data in Doctrine entities.
Installation
composer require tourze/doctrine-sensitive-tag-bundle
Features
- Mark sensitive data through the
SensitiveTagAwareInterface
interface - Automatically log access, creation, update, and deletion operations on sensitive data
- Provides entities and event subscribers for recording sensitive data access logs
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
TouchLog
table.
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
License
This bundle is released under the MIT License. See the LICENSE file for more information.