Add sensitive data masking support#1343
Merged
TharmiganK merged 45 commits intomasterfrom Oct 8, 2025
Merged
Conversation
# Conflicts: # ballerina/Ballerina.toml # ballerina/CompilerPlugin.toml # ballerina/Dependencies.toml # gradle.properties # native/src/main/java/io/ballerina/stdlib/log/Utils.java
# Conflicts: # ballerina/Ballerina.toml # ballerina/CompilerPlugin.toml # gradle.properties
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1343 +/- ##
============================================
- Coverage 90.75% 81.67% -9.09%
- Complexity 7 81 +74
============================================
Files 6 8 +2
Lines 238 562 +324
Branches 59 114 +55
============================================
+ Hits 216 459 +243
- Misses 19 76 +57
- Partials 3 27 +24 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
52f7abb to
a41fcc9
Compare
a41fcc9 to
2f2e3cb
Compare
c86a86f to
78298b2
Compare
Contributor
Author
|
Pending tasks:
|
…for improved clarity
209778f to
a4a6766
Compare
native/src/main/java/io/ballerina/stdlib/log/MaskedStringBuilder.java
Outdated
Show resolved
Hide resolved
native/src/main/java/io/ballerina/stdlib/log/MaskedStringBuilder.java
Outdated
Show resolved
Hide resolved
native/src/main/java/io/ballerina/stdlib/log/MaskedStringBuilder.java
Outdated
Show resolved
Hide resolved
native/src/main/java/io/ballerina/stdlib/log/MaskedStringBuilder.java
Outdated
Show resolved
Hide resolved
Contributor
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 22 out of 22 changed files in this pull request and generated 3 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
d3a4c45 to
37603fb
Compare
native/src/main/java/io/ballerina/stdlib/log/MaskedStringBuilder.java
Outdated
Show resolved
Hide resolved
native/src/main/java/io/ballerina/stdlib/log/MaskedStringBuilder.java
Outdated
Show resolved
Hide resolved
daneshk
reviewed
Oct 8, 2025
integration-tests/tests/resources/samples/masked-logger/Config.toml
Outdated
Show resolved
Hide resolved
|
daneshk
approved these changes
Oct 8, 2025
daneshk
added a commit
to daneshk/module-ballerina-log
that referenced
this pull request
Nov 10, 2025
* [Automated] Update the native jar versions * Add initial implementation * Refactor with perf improvements * Refactor by adding a builder * Fix checkstyle issues * Add sensitive data masking support for root logger * Add annotation caching support * Fix xml toString * Support undefined fields in the record to string * Add tests for masked string function * Refactor class to reduce cognitive complexity * Add support for map value * Fix issues with field names with special characters * Add support to enable sensitive data masking via configuration * Add tests for masked logging * Enhance type processing to handle intersection and reference types * Add support for sensitive data masking in templates and value functions * Add tests for readonly types * Add an integration test * Update changelog * Update spec * Optimize Unicode escaping by using a pre-computed hex lookup table * Add tests for masking structurally similar records and basic types * Add test for masking special characters in strings * Update spec to clarify masking behavior and type extraction * Add tests for masking empty arrays, tables, and records * Add documentation for sensitive data masking features * Enhance sensitive data masking documentation and functionality * Refactor sensitive data masking strategy to use a dedicated maskString function * Refactor sensitive data annotation from @sensitivedata to @sensitive * Deprecate processTemplate function and replace with evaluateTemplate for improved clarity * Address review suggestions * Address review suggestions * Update integration-tests/tests/resources/samples/masked-logger/Config.toml --------- Co-authored-by: Danesh Kuruppu <daneshk@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Purpose
Fixes: ballerina-platform/ballerina-library#8211
Examples
Enable sensitive data masking
By default, sensitive data masking is disabled. Enable it in
Config.toml:Or configure it per logger:
Simple Example
Output (with masking enabled):
Multiple Strategies
Masked String Function
Checklist