Skip to content

Add log masking feature and general updates - #3

Open
MichaelBengtsson wants to merge 11 commits into
developfrom
feature/log-masking
Open

MichaelBengtsson wants to merge 11 commits into
developfrom
feature/log-masking

Conversation

@MichaelBengtsson

Copy link
Copy Markdown
Contributor

This pull request introduces significant enhancements to the log parsing tool, focusing on robust masking of sensitive data, extensibility via interfaces, improved CLI options, and testability. It adds a masking system based on the krokedil/wp-api package, new CLI options (notably --no-mask), and a suite of interfaces and classes to support modular log parsing, masking, and output. The project now also includes PHPUnit tests and improved documentation.

Key changes:

Masking and Security

  • Added masking of matched log rows before output, using FieldMasker and KeyMasker from krokedil/wp-api, and introduced WcLogLineMasker, NullLineMasker, and MaskingProfile for flexible masking strategies. This ensures logs can be safely shared without exposing personal data. (readme.md, changelog.md, composer.json, [1] [2] [3]

  • Introduced the optional --no-mask CLI flag to allow output of unmasked logs for local use only, and updated documentation accordingly. (index.php, readme.md, [1] [2]

Extensibility and Refactoring

  • Added new interfaces: LineMaskerInterface, LogDataProviderInterface, LogResultHandlerInterface, and OutputLoggerInterface to decouple log parsing, masking, and output handling, enabling easier extension and testing. [1] [2] [3] [4]

  • Implemented FileSystemLogDataProvider and StringLogDataProvider to allow logs to be sourced from files or strings, supporting both CLI and programmatic usage. [1] [2]

Testing and Tooling

  • Added PHPUnit as a development dependency, a test script to composer.json, and a phpunit.xml configuration file. Test fixtures and instructions are provided in the documentation. (composer.json, phpunit.xml, readme.md, [1] [2] [3]

CLI and Documentation

  • Enhanced CLI usability: LogParser now returns all lines if no search terms are provided, and the CLI interface and documentation were updated to reflect new options and masking behavior. (index.php, readme.md, [1] [2] [3]

Project Configuration

  • Added a .gitattributes file to enforce LF line endings for code and configuration files and to exclude development tooling from export.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant