Skip to content

Field masking for pluggable data formats and query execution - #4

Draft
nibix wants to merge 3 commits into
pluggable-df-flsfrom
pluggable-df-fm
Draft

nibix wants to merge 3 commits into
pluggable-df-flsfrom
pluggable-df-fm

Conversation

@nibix

@nibix nibix commented Oct 23, 2026

Copy link
Copy Markdown
Owner

Description

Adds Security plugin support for field-masking enforcement in analytics queries against pluggable data formats according to the RFC in opensearch-project/OpenSearch#22828.

This implements the Security plugin side of the companion OpenSearch PR: nibix/OpenSearch#4.

The Security plugin remains the source of the effective authorization policy. This change registers a FieldValueTransformationProvider component that exposes the request-scoped field-masking decision for a concrete index and mapped leaf field.

FieldValueTransformationResolver uses the existing DlsFlsBaseContext and authenticated PrivilegesEvaluationContext to obtain the effective FieldMaskingRule. It then converts the matching Security field-masking rule into a backend-neutral FieldValueTransformation descriptor.

The companion OpenSearch analytics implementation consumes this descriptor on the node executing the shard fragment and applies it at the raw DataFusion read boundary. The Security plugin does not expose roles, users, or raw Security configuration to analytics plugins.

The following existing Security masking configurations can be represented for pluggable data formats:

  • the legacy BLAKE2b-256 default using personalization;
  • the current BLAKE2b-256 default using a salt;
  • SHA-256;
  • SHA-512; and
  • ordered regular-expression replacements.

The same existing role combination and field-pattern resolution is used for both standard Lucene field masking and pluggable data formats. Rules are resolved independently for each concrete index, which supports aliases and data streams whose backing indices have different effective policies.

If privilege evaluation fails, transformation resolution fails closed with an OpenSearchSecurityException. Requests without a user privilege context, such as internal system operations, do not receive a transformation.

Notes

  • This change does not replace or modify the existing Lucene field-masking implementation. Standard Lucene searches continue to use the Security plugin's request-aware reader wrapper.
  • For pluggable data formats, the Security plugin supplies the effective authorization information while the companion OpenSearch analytics implementation is responsible for enforcing it at every raw-read path.
  • The provider returns only transformation descriptors. It does not expose role definitions, backend-role mappings, users, or other Security internals.
  • The new provider is published through the plugin component registry so that analytics plugins can discover it without introducing a dependency on Security implementation classes.

Current limitations

The following limitations apply to analytics execution through the companion OpenSearch implementation. They do not change the behavior of the existing standard Lucene search path:

  • Masking is initially supported for string-valued keyword and text fields, including dotted object leaves and string-valued lists. Unsupported mapped or physical types fail closed.
  • Types such as date, ip, and geo fields may have textual input or display forms but use numerical or encoded internal representations. They require separately defined masking semantics and are not initially supported.
  • Pluggable data formats support BLAKE2b-256, SHA-256, SHA-512, and the portable regular-expression subset only. Other algorithms that may be available through Java MessageDigest on the existing Lucene path are rejected for analytics execution.
  • Regular-expression rules must be portable between Java and Rust. Constructs such as lookaround, pattern backreferences, named captures, inline flags, Unicode properties and shorthand classes, lazy or possessive quantifiers, atomic groups, and conditionals are rejected.
  • Analytics operations that cannot safely operate on masked values, including joins, window expressions, PPL dedup, text-relevance functions, and PPL search criteria involving masked fields, fail closed.
  • Parquet-primary configurations are supported through DataFusion. Lucene-primary configurations are not currently supported for masked analytics scans, even when Parquet is configured as a secondary format, because field-storage resolution does not yet select that secondary representation.
  • Predicates and sorting on masked fields can be more expensive because raw-value indices, Parquet statistics, raw index ordering, and related Top-K optimizations cannot safely be used.

Tests

  • Unit tests verify resolution of the effective field-masking rule for a concrete index and field.

Check List

  • New functionality includes testing
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@nibix
nibix added this pull request to stack #5 October 23, 2026 06:25
Signed-off-by: Nils Bandener <nils.bandener@eliatra.com>
Signed-off-by: Nils Bandener <nils.bandener@eliatra.com>
Signed-off-by: Nils Bandener <nils.bandener@eliatra.com>
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.

1 participant