Skip to content

Refactor/simplify v4 - #9

Merged
vibhorkum merged 2 commits into
masterfrom
refactor/simplify-v4
Apr 6, 2026
Merged

Refactor/simplify v4#9
vibhorkum merged 2 commits into
masterfrom
refactor/simplify-v4

Conversation

@vibhorkum

Copy link
Copy Markdown
Owner

Summary

Describe the problem and the fix clearly and briefly.

Maintainer: Vibhor Kumar

vibhorkum and others added 2 commits April 5, 2026 16:49
…nd_index

The emit_log_hook masking regex was missing v4.0 function names:
- encrypt.register_key() - leaked DEK and passphrase in STATEMENT/CONTEXT
- encrypt.blind_index() - leaked HMAC key in STATEMENT/CONTEXT

This allowed secrets to appear in PostgreSQL logs when validation errors
occurred (e.g., "encryption key must be at least 16 bytes").

Fix: Added register_key and blind_index to the regex alternation group
in suppress_keylog_hook().

Also updated:
- CLAUDE.md: Added "Log Masking for Sensitive Functions" section with
  contributor guidance for adding new sensitive functions
- CHANGELOG.md: Documented the security fix

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…ery_literals

INSERT/UPDATE statements with plaintext values in encrypted columns
leak to PostgreSQL logs. Document the encrypt.mask_query_literals GUC
which masks ALL string literals when enabled.

Updates:
- README.md: Added Step 2.5 explaining when/why to enable mask_query_literals
- CLAUDE.md: Added detailed section on INSERT/UPDATE data masking with
  trade-offs, best practices, and alternative approaches
- CHANGELOG.md: Added documentation entry

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 improves the extension’s log-leak protections and contributor/user guidance by documenting literal-masking and expanding the emit_log_hook masking regex to cover v4 API calls that accept secrets.

Changes:

  • Document encrypt.mask_query_literals usage (session/global) and its trade-offs (README, CLAUDE.md).
  • Extend suppress_keylog_hook regex masking to include register_key and blind_index (plus explanatory comment) in column_encrypt.c.
  • Update the changelog to record the log-masking documentation and the security fix.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
README.md Adds a usage step recommending enabling encrypt.mask_query_literals to prevent plaintext literal leakage in logs.
column_encrypt.c Updates the log-masking regex to include v4+ sensitive functions (register_key, blind_index) and documents the intent inline.
CLAUDE.md Adds contributor-focused guidance on which functions must be masked and how to extend/test masking.
CHANGELOG.md Records the documentation additions and the security fix for masking v4 API calls.

Comment thread README.md
@vibhorkum
vibhorkum merged commit 5eb3a40 into master Apr 6, 2026
10 checks passed
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