For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to page URLs.
Skip to content

Data masking

Learn how Nilus masks sensitive values during ingestion with configurable masking rules.

Nilus masks values during ingestion. The source data stays unchanged, and the destination receives only the masked values. Data masking is useful when you need analytical access to real datasets but do not want sensitive values to land in development, shared, or compliance-sensitive environments.

Nilus applies masking in-flight as records move through the ingestion pipeline. A mask map in connector options drives the masking contract, where each entry follows this format:

mask:
  column_name: algorithm[:parameter]

Nilus does not create a parallel unmasked copy. If you need original values in the destination, run the ingestion again without masking.

Current support model

  • The runtime applies masking when the pipeline receives a MASK configuration.

  • Define mask under sink.options. This placement is also consistent for CDC-oriented pipelines.

  • Older examples may show mask under source.options. That still works for many batch flows, but sink-side placement is the clearer standard.

  • When a masking algorithm changes the output type or representation, update type_hints so the destination type matches the masked value.

Configuration example

name: masked-users-batch
version: v1alpha
type: nilus
spec:
  type: batch
  compute: universe-compute
  source:
    address: postgresql://{PG_USERNAME}:{PG_PASSWORD}@postgres.example.com:5432/commerce
    options:
      source_table: public.users
      type_hints:
        registration_date: text
        salary: bigint
      mask:
        email: hash
        phone: partial:3
        ssn: ssn
        card_number: credit_card
        salary: round:5000
        registration_date: year_only
        
  sink:
    address: dataos://maskedwarehouse?purpose=rw
    options:
      dest_table: pii.users_masked
      incremental_strategy: replace

Masking algorithms

Nilus supports the following masking algorithms:

Hash and redaction

Algorithm
Behavior

hash

Returns a SHA-256 hash of the value. Consistent across runs: the same input always produces the same output. Use for anonymous identifiers and consistent tokenization.

md5

Returns an MD5 hash of the value. Faster than SHA-256 but less secure; adequate for non-security checksums and tokenization.

redact

Replaces the value with REDACTED.

stars

Replaces the value with asterisks of the same length.

Format-preserving and partial masks

Algorithm
Behavior

phone

Keeps the first three digits and masks the rest as 123-***-****.

ssn

Returns ***-**- plus the last four digits for a valid 9-digit value.

first_letter

Keeps the first character and masks the rest.

Tokenization and randomization

Algorithm
Behavior

uuid

Assigns a stable UUID per distinct source value during the run.

sequential

Assigns a stable sequential integer per distinct source value during the run.

random

Generates a random replacement of the same general type.

Numeric and date masks

Algorithm
Behavior

range:<n>

Returns an ASCII range bucket such as 40000-50000.

date_shift:<days>

Shifts dates by up to the supplied number of days.

month_year

Returns YYYY-MM.

Practical notes

  • Use type_hints when the masked output no longer matches the destination type you want to preserve.

  • For CDC pipelines, use sink-side mask configuration so the settings are passed through consistently.

  • Keep HMAC keys simple because the masking syntax uses colon separators.

  • Some masks are deterministic (hash, uuid, sequential). Others intentionally change values (random, noise, date_shift).

Best practices

  • Use hash, md5, redact, phone, or ssn when the priority is Personally Identifiable Information (PII) protection.

  • Use uuid, sequential, or partial when you need testable but still relationally useful output.

  • Use round, range, date_shift, or month_year when the goal is analytical usefulness rather than exact value preservation.

  • Validate masked output types before promoting the pipeline to a production-like environment.

Limitations

  • Masking happens during ingestion. It does not modify the source system.

  • Nilus does not perform dynamic masking after ingestion. Once masked values are written to the destination, the destination dataset contains only those masked or hidden values for all downstream users.

  • Nilus does not create a second unmasked destination dataset automatically.

  • Masking adds work to the pipeline. Very wide datasets or many masked fields can increase runtime cost.

Last updated

Was this helpful?