Skip to content

🛡️ Sentinel: [MEDIUM] Fix PII exposure in audit logging - #211

Closed
seonghobae wants to merge 1 commit into
mainfrom
sentinel-fix-approver-id-pii-exposure-17477171752181716386
Closed

🛡️ Sentinel: [MEDIUM] Fix PII exposure in audit logging#211
seonghobae wants to merge 1 commit into
mainfrom
sentinel-fix-approver-id-pii-exposure-17477171752181716386

Conversation

@seonghobae

@seonghobae seonghobae commented Jul 26, 2026

Copy link
Copy Markdown
Collaborator

Superseded by #165.

🚨 Severity: MEDIUM
💡 Vulnerability: The `approverId` in the `PolicyOverrideRequest` was being logged in plaintext when a blocked file extension was allowed.
🎯 Impact: System audit logs were capturing sensitive user identifiers without pseudonimization, violating PII rules.
🔧 Fix: Added `hashApproverId` method that checks for null values and uses SHA-256 to hash the `approverId` before logging it. Updated test cases to achieve 100% test coverage.
✅ Verification: `mvn test` passes successfully and jacoco coverage correctly ensures coverage of `hashApproverId`.
@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copilot AI review requested due to automatic review settings July 26, 2026 21:22
@coderabbitai

coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@seonghobae, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 5 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 052ae66b-5030-4d87-b6ce-538e75cd5d37

📥 Commits

Reviewing files that changed from the base of the PR and between ae0bc74 and d867f00.

📒 Files selected for processing (3)
  • .jules/sentinel.md
  • src/main/java/com/clearfolio/viewer/service/DefaultDocumentValidationService.java
  • src/test/java/com/clearfolio/viewer/service/DefaultDocumentValidationServiceTest.java
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch sentinel-fix-approver-id-pii-exposure-17477171752181716386

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses a medium-severity privacy issue in Clearfolio’s document validation/audit logging path by ensuring the PolicyOverrideRequest.approverId is no longer logged in plaintext when a blocked extension override is accepted.

Changes:

  • Replaced audit logging of plaintext approverId with a SHA-256 hash via a new hashApproverId helper.
  • Added unit tests to cover the new hashing behavior and the digest-unavailable failure path.
  • Documented the incident/learning in .jules/sentinel.md.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/main/java/com/clearfolio/viewer/service/DefaultDocumentValidationService.java Hashes approverId before logging during blocked-extension override acceptance.
src/test/java/com/clearfolio/viewer/service/DefaultDocumentValidationServiceTest.java Adds tests for hashApproverId behavior and failure mode coverage.
.jules/sentinel.md Records the PII-in-logs issue and prevention guidance for future Sentinel learnings.
Comments suppressed due to low confidence (2)

src/main/java/com/clearfolio/viewer/service/DefaultDocumentValidationService.java:215

  • hashApproverId returns the literal string "null" for a null input, which mixes a sentinel value into a method that otherwise returns a hex digest. Returning null keeps the method contract consistent and avoids downstream consumers treating the result as a valid hash string.
    private String hashApproverId(String approverId) {
        if (approverId == null) {
            return "null";
        }

src/test/java/com/clearfolio/viewer/service/DefaultDocumentValidationServiceTest.java:549

  • This test removes all JVM security providers to force MessageDigest.getInstance("SHA-256") to fail. Since this is global JVM state, the pattern is brittle and duplicated with the similar provider-removal logic in throwsWhenSha256DigestIsUnavailableForOverrideAuditFingerprint() below; consider extracting a shared helper that temporarily clears/restores providers to reduce duplication and make the restoration logic harder to get wrong.
        synchronized (SECURITY_PROVIDERS_LOCK) {
            Provider[] providers = Security.getProviders();
            for (Provider provider : providers) {
                Security.removeProvider(provider.getName());
            }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 115 to 120
LOGGER.info(
"Blocked-format override accepted extension={} approverId={} tokenFingerprint={}",
sanitizeForLog(extension),
sanitizeForLog(overrideApproverIdForAudit),
hashApproverId(overrideApproverIdForAudit),
tokenFingerprint(overrideTokenForAudit)
);
Comment on lines +516 to +524
@Test
void hashApproverIdReturnsNullStringWhenInputIsNull() throws Exception {
ConversionProperties conversionProperties = new ConversionProperties();
DefaultDocumentValidationService validationService = new DefaultDocumentValidationService(conversionProperties);
Method method = DefaultDocumentValidationService.class.getDeclaredMethod("hashApproverId", String.class);
method.setAccessible(true);
String hashed = (String) method.invoke(validationService, (String) null);
assertEquals("null", hashed);
}
Comment thread .jules/sentinel.md

## 2026-07-26 - [PII exposure in audit logging]
**Vulnerability:** The `approverId` in the `PolicyOverrideRequest` was being logged in plaintext when a blocked file extension was allowed.
**Learning:** System audit logs were capturing sensitive user identifiers without pseudonimization, violating PII rules.
@seonghobae seonghobae closed this Aug 4, 2026
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.

2 participants