mirror of
https://github.com/ivuorinen/monolog-gdpr-filter.git
synced 2026-03-12 06:01:02 +00:00
* fix(tests): remove error_log calls and clean up ComprehensiveValidationTest * refactor: replace hardcoded strings with MaskConstants and TestConstants references * fix(streaming): replace overcounting '[' heuristic with proper mask detection StreamingProcessor::getStatistics() was counting any message containing '[' as masked, causing false positives. Now checks for specific mask constants (MASK_GENERIC, MASK_BRACKETS, MASK_REDACTED_BRACKETS) instead. Also adds MASK_REDACTED_BRACKETS constant to MaskConstants and removes the now-unnecessary UnusedFunctionCall psalm suppression. * refactor(tests): replace remaining hardcoded literals with constant references Add new constants to TestConstants (MASK_REDACTED_PLAIN, MASK_SECRET_BRACKETS, MASK_SSN_BRACKETS, PATTERN_REDOS_NESTED_STAR, FIELD_USER_SSN, FIELD_USER_DATA) and replace all matching literals across 21 test files. Also removes dead memory_get_usage() call and uses existing TestConstants::IP_ADDRESS_PUBLIC for hardcoded IP. * fix(streaming): replace mask-token heuristic with accurate record comparison in getStatistics() The previous implementation only detected masking when specific mask tokens appeared in the message, missing cases where context was masked or different mask values were used. Compare original vs processed records instead. * refactor(tests): add PATTERN_EMAIL_SIMPLE, MASK_CARD_BRACKETS, EXPECTED_SSN_MASKED constants Replace cross-file duplicate literals with TestConstants references: - Email regex (4 files), '[CARD]' (2 files), 'SSN: [SSN]' (2 files) * fix(streaming): bypass audit logger in getStatistics() by calling orchestrator directly getStatistics() previously routed through processStream()/processChunk() which triggered the audit logger for each record. A read-only statistics method should not produce audit side-effects. Now calls orchestrator.process() directly and processes records one at a time without materializing the entire iterable. * refactor(tests): fix test quality issues and add PATTERN_CREDIT_CARD constant - Replace fail() message that leaked sensitive terms with count-only message - Replace bare 'EMAIL' string with MaskConstants::MASK_EMAIL for consistency - Remove error_log() debug output from CriticalBugRegressionTest - Add TestConstants::PATTERN_CREDIT_CARD and replace inline regex in 3 files
139 lines
4.4 KiB
XML
139 lines
4.4 KiB
XML
<?xml version="1.0" ?>
|
|
<psalm
|
|
errorLevel="5"
|
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
xmlns="https://getpsalm.org/schema/config"
|
|
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
|
|
phpVersion="8.4"
|
|
noCache="false"
|
|
findUnusedPsalmSuppress="true"
|
|
skipChecksOnUnresolvableIncludes="true"
|
|
allowPhpStormGenerics="true"
|
|
allowStringToStandInForClass="true"
|
|
memoizeMethodCallResults="true"
|
|
hoistConstants="true"
|
|
addParamTypehint="false"
|
|
checkForThrowsDocblock="false"
|
|
checkForThrowsInGlobalScope="false"
|
|
sealAllMethods="false"
|
|
sealAllProperties="false"
|
|
>
|
|
<projectFiles>
|
|
<directory name="src" />
|
|
<directory name="examples" />
|
|
<directory name="config" />
|
|
<directory name="tests" />
|
|
<ignoreFiles>
|
|
<directory name="vendor" />
|
|
<directory name="src/Laravel" />
|
|
</ignoreFiles>
|
|
</projectFiles>
|
|
|
|
<plugins>
|
|
<pluginClass class="Psalm\PhpUnitPlugin\Plugin" />
|
|
</plugins>
|
|
|
|
<issueHandlers>
|
|
<!-- Laravel function compatibility -->
|
|
<UndefinedFunction>
|
|
<errorLevel type="suppress">
|
|
<referencedFunction name="config" />
|
|
<referencedFunction name="app" />
|
|
<referencedFunction name="now" />
|
|
<referencedFunction name="config_path" />
|
|
<referencedFunction name="env" />
|
|
</errorLevel>
|
|
</UndefinedFunction>
|
|
|
|
<!-- Complex return type issues in GdprProcessor -->
|
|
<InvalidReturnType>
|
|
<errorLevel type="suppress">
|
|
<file name="src/GdprProcessor.php" />
|
|
</errorLevel>
|
|
</InvalidReturnType>
|
|
|
|
<!-- Override attributes - suppress for now to avoid breaking changes -->
|
|
<MissingOverrideAttribute errorLevel="suppress" />
|
|
|
|
<!-- Class finalization - suppress to avoid API breaking changes -->
|
|
<ClassMustBeFinal errorLevel="suppress" />
|
|
|
|
<!-- Mixed types - necessary for flexible APIs -->
|
|
<MixedArgument errorLevel="suppress" />
|
|
<MixedAssignment errorLevel="suppress" />
|
|
<MixedMethodCall errorLevel="suppress" />
|
|
<MixedPropertyFetch errorLevel="suppress" />
|
|
<MixedArrayAccess errorLevel="suppress" />
|
|
|
|
<!-- Missing type annotations - backward compatibility -->
|
|
<MissingReturnType errorLevel="suppress" />
|
|
<MissingParamType errorLevel="suppress" />
|
|
<MissingPropertyType errorLevel="suppress" />
|
|
|
|
<!-- Prevent Psalm from adding complex nested return types -->
|
|
<MismatchingDocblockReturnType errorLevel="suppress" />
|
|
<MoreSpecificReturnType errorLevel="suppress" />
|
|
<LessSpecificReturnStatement errorLevel="suppress" />
|
|
|
|
<!-- Test-specific suppressions -->
|
|
|
|
<!-- Redundant test assertions - provide defensive runtime validation -->
|
|
<RedundantCondition>
|
|
<errorLevel type="suppress">
|
|
<directory name="tests" />
|
|
</errorLevel>
|
|
</RedundantCondition>
|
|
<RedundantConditionGivenDocblockType>
|
|
<errorLevel type="suppress">
|
|
<directory name="tests" />
|
|
</errorLevel>
|
|
</RedundantConditionGivenDocblockType>
|
|
<ArgumentTypeCoercion>
|
|
<errorLevel type="suppress">
|
|
<directory name="tests" />
|
|
</errorLevel>
|
|
</ArgumentTypeCoercion>
|
|
|
|
<!-- Test validation issues -->
|
|
<InvalidArgument>
|
|
<errorLevel type="suppress">
|
|
<directory name="tests" />
|
|
</errorLevel>
|
|
</InvalidArgument>
|
|
|
|
<!-- Test helper methods in anonymous classes -->
|
|
<UndefinedMethod>
|
|
<errorLevel type="suppress">
|
|
<file name="tests/Strategies/AbstractMaskingStrategyTest.php" />
|
|
</errorLevel>
|
|
</UndefinedMethod>
|
|
|
|
<!-- Test function calls -->
|
|
<UndefinedFunction>
|
|
<errorLevel type="suppress">
|
|
<directory name="tests" />
|
|
</errorLevel>
|
|
</UndefinedFunction>
|
|
|
|
<!-- Laravel-specific patterns -->
|
|
<!-- (Laravel directory is excluded from scanning) -->
|
|
|
|
<!-- Intentional design choices -->
|
|
<PropertyNotSetInConstructor errorLevel="suppress" />
|
|
<PossiblyUnusedMethod errorLevel="suppress" />
|
|
<PossiblyUnusedProperty errorLevel="suppress" />
|
|
|
|
<!-- Array access patterns for configuration -->
|
|
<PossiblyUndefinedArrayOffset errorLevel="suppress" />
|
|
<PossiblyInvalidArrayOffset errorLevel="suppress" />
|
|
|
|
<!-- Closure patterns in callbacks -->
|
|
<UnusedClosureParam errorLevel="suppress" />
|
|
<MissingClosureParamType errorLevel="suppress" />
|
|
<MissingClosureReturnType errorLevel="suppress" />
|
|
|
|
<!-- String manipulation patterns -->
|
|
<PossiblyInvalidCast errorLevel="suppress" />
|
|
</issueHandlers>
|
|
</psalm>
|