Skip to content

Core: Fix hash Variant object keys in ExpressionUtil.sanitize - #17840

Open
waterWang wants to merge 1 commit into
apache:mainfrom
waterWang:fix-hash-variant-object-keys
Open

Core: Fix hash Variant object keys in ExpressionUtil.sanitize#17840
waterWang wants to merge 1 commit into
apache:mainfrom
waterWang:fix-hash-variant-object-keys

Conversation

@waterWang

Copy link
Copy Markdown

Summary

ExpressionUtil.sanitize redacts predicate constants (hashed strings, digit-count for numbers, coarse dates). For Variant objects it was formatting keys as (hash-%s) with the original field name while hashing only the value. Variant object keys are query literals (they can hold the same secrets people put in string literals), and leaked into SnapshotScan ScanReport.filter (REST catalog metrics) and logs.

Fix

Run object keys through sanitizeSimpleString (the same hashing used for string values), and update the unit test expectations to match.

  • api/.../ExpressionUtil.java: sanitizeVariantObject now emits (hash-<hash-of-key>): <value>
  • api/.../TestExpressionUtil.java: update testSanitizeVariantObject / testSanitizeVariantArray expectations

Closes #17836

Variant object keys are query literals, not schema identifiers, and can hold sensitive values like string literals. sanitizeVariantObject was formatting keys as (hash-<field>) with the original field name in the clear, leaking them into ScanReport filters and operator metrics/logs. Run object keys through sanitizeSimpleString (same as string values) so they are hashed like other predicate constants.

Closes apache#17836
@github-actions github-actions Bot added the API label Aug 26, 2026

@anoopj anoopj left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice catch! Variant object keys are query literals, so leaving them in the clear didn't make sense. The code looks correct to me.

One minor comment; ExpressionUtil is in the API module and the change doesn't touch core/, so the title prefix should be API:[...] rather than Core: [...]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hash Variant object keys in ExpressionUtil.sanitize (not only values)

4 participants