server/csharp: Add basic masking support #570
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What changed?
This PR adds very basic masking support to the C# TicketHub server implementation, along with a policy that masks the
tickets.description
field with***
.This is currently done in the slow way-- querying a specific masking rule in OPA directly via an extra HTTP call to
/v1/data/tickets/filters/masks
.Masking Support
The only masking function supported at this time is
replace
, which allows substituting a value with a replacement. Best-effort type conversion occurs behind the scenes, but if it's a sufficient mismatch, runtime exceptions can and will be thrown. 😅Here's the rule that masks all
tickets.description
fields:The server is currently hard-coded to query
/v1/data/tickets/filters/masks
to get the JSON blob describing the column masking rules. These rules can be conditional on other data visible to the policy, but the above example is the "simplest thing that works". (This should be patched before merge.)In the React UI, this looks like:
How to Test?
docker compose build server-csharp --parallel --no-cache
docker compose --profile react --profile csharp up --force-recreate --renew-anon-volumes
docker compose --profile react --profile csharp down