Skip to content

Commit

Permalink
Merge pull request #23 from ethyca/field_level_masking
Browse files Browse the repository at this point in the history
Add masking strategy override to FidesMeta
  • Loading branch information
Linker44 authored Nov 11, 2024
2 parents 1847185 + 55f627e commit 3a18406
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ The types of changes are:

## [Unreleased](https://github.com/ethyca/fideslang/compare/3.0.8...main)

- Add field-level masking strategy overrides [#23](https://github.com/ethyca/fideslang/pull/23)

## [3.0.8](https://github.com/ethyca/fideslang/compare/3.0.7...3.0.8)

Expand Down
15 changes: 13 additions & 2 deletions src/fideslang/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from datetime import datetime
from enum import Enum
from typing import Annotated, Dict, List, Optional, Union
from typing import Annotated, Dict, List, Optional, Union, Any

from packaging.version import InvalidVersion, Version
from pydantic import (
Expand Down Expand Up @@ -69,11 +69,18 @@ class MaskingStrategies(str, Enum):


class MaskingStrategyOverride(BaseModel):
"""Overrides policy-level masking strategies."""
"""Overrides collection-level masking strategies."""

strategy: MaskingStrategies


class FieldMaskingStrategyOverride(BaseModel): # type: ignore[misc]
"""Overrides field-level masking strategies."""

strategy: str
configuration: Optional[Dict[str, Any]] = {} # type: ignore[misc]


class FidesModel(BaseModel):
"""The base model for most top-level Fides objects."""

Expand Down Expand Up @@ -418,6 +425,10 @@ class FidesMeta(BaseModel):
default=None,
description="Optionally specify that a field may be used as a custom request field in DSRs. The value is the name of the field in the DSR.",
)
masking_strategy_override: Optional[FieldMaskingStrategyOverride] = Field(
default=None,
description="Optionally specify a masking strategy override for this field.",
)

@field_validator("data_type")
@classmethod
Expand Down

0 comments on commit 3a18406

Please sign in to comment.