navapbc / template-application-flask

Apache License 2.0
9 stars 4 forks source link

Fix error when PII appears in interpolated logs #155

Closed lorenyu closed 1 year ago

lorenyu commented 1 year ago

Ticket

Resolves #154

Changes

Context

Previously, something like logger.info("%s %s", "text", "123456789") would cause a logger error since the mask_pii logic would replace the LogRecord's args tuple with the string '("text", "*****")', which would break the log interpolation logic. This PR fixes that bug and adds some regression tests.

Testing

Added tests that failed before the fix and pass after the fix