[ 
https://issues.apache.org/jira/browse/CASSANDRA-17941?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17611542#comment-17611542
 ] 

Andres de la Peña edited comment on CASSANDRA-17941 at 9/30/22 11:51 AM:
-------------------------------------------------------------------------

Here is the patch adding the functions:
||PR||CI||
|[trunk|https://github.com/apache/cassandra/pull/1892]|[j8|https://app.circleci.com/pipelines/github/adelapena/cassandra/2091/workflows/1d94a287-a23f-4c6c-a594-27b2edd18a77]
 
[j11|https://app.circleci.com/pipelines/github/adelapena/cassandra/2091/workflows/e30934ad-a415-403e-9760-14f8ef9ccda9]|

And here is the documentation of each function:
||Function||Description||
|mask_null(value)|Replaces the first argument by null.
 
Examples:
mask_null('Alice') → null
mask_null(123) → null|
|mask_default(value)|Replaces its argument by an arbitrary, fixed default value 
of the same type. This will be **** for text values, zero for numeric values, 
false for booleans, etc.
 
Examples:
mask_default('Alice') → '****'
mask_default(123) → 0|
|mask_replace(value, replacement])|Replaces the first argument by the 
replacement value on the second argument. Both arguments should have the same 
type.
 
Examples:
mask_replace('Alice', 'REDACTED') → 'REDACTED'
mask_replace(123, -1) → -1|
|mask_inner(value, begin, end, [padding])|Returns the text representation of 
the first argument, replacing each character except the first and last ones by 
a padding character. The 2nd and 3rd arguments are the size of the exposed 
prefix and suffix. The optional 4th argument is the padding character, * by 
default.
 
Examples:
mask_inner('Alice', 1, 2) → 'A**ce'
mask_inner('Alice', 2, 1, '#') → 'Al##e'|
|mask_outer(value, begin, end, [padding])|Returns the text representation of 
the first argument, replacing the first and last character by a padding 
character. The 2nd and 3rd arguments are the size of the exposed prefix and 
suffix. The optional 4th argument is the padding character, * by default.
 
Examples:
mask_outer('Alice', 1, 2) → '*li*'
mask_outer('Alice', 2, 1, '#') → '##ic#'|
|mask_hash(value, [algorithm])|Returns a blob containing the hash of the first 
argument. The optional 2nd argument is the hashing algorithm to be used, 
according the available Java security provider. The default hashing algorithm 
is SHA-256.
 
Examples:
mask_hash('Alice')
mask_hash('Alice', 'SHA-512')|

Note that the functions cannot be applied to collections nor UDTs due to the 
limitations addressed by CASSANDRA-17811. Once we have that ticket ready these 
functions will be updated so they can be used on collections and UDTs.


was (Author: adelapena):
Here is the patch adding the functions:
||PR||CI||
|[trunk|https://github.com/apache/cassandra/pull/1892]|[j8|https://app.circleci.com/pipelines/github/adelapena/cassandra/2091/workflows/1d94a287-a23f-4c6c-a594-27b2edd18a77]
 
[j11|https://app.circleci.com/pipelines/github/adelapena/cassandra/2091/workflows/e30934ad-a415-403e-9760-14f8ef9ccda9]|

And here is the documentation of each function:
||Function||Description||
|mask_null(value)|Replaces the first argument by null.
 
Examples:
mask_null('Alice') → null
mask_null(123) → null|
|mask_default(value)|Replaces its argument by an arbitrary, fixed default value 
of the same type. This will be **** for text values, zero for numeric values, 
false for booleans, etc.
 
Examples:
mask_default('Alice') → '****'
mask_default(123) → 0|
|mask_replace(value, replacement])|Replaces the first argument by the 
replacement value on the second argument. Both arguments should have the same 
type.
 
Examples:
mask_replace('Alice', 'REDACTED') → 'REDACTED'
mask_replace(123, -1) → -1|
|mask_inner(value, begin, end, [padding])|Returns the text representation of 
the first argument, replacing each character except the first and last ones by 
a padding character. The 2nd and 3rd arguments are the size of the exposed 
prefix and suffix. The optional 4th argument is the padding character, * by 
default.
 
Examples:
mask_inner('Alice', 1, 2) → 'A**ce'
mask_inner('Alice', 2, 1, '#') → 'Al##e'|
|mask_outer(value, begin, end, [padding])|Returns the text representation of 
the first argument, replacing the first and last character by a padding 
character. The 2nd and 3rd arguments are the size of the exposed prefix and 
suffix. The optional 4th argument is the padding character, * by default.
 
Examples:
mask_outer('Alice', 1, 2) → '*li*'
mask_outer('Alice', 2, 1, '#') → '##ic#'|
|mask_hash(value, [algorithm])|Returns a blob containing the hash of the first 
argument. The optional 2nd argument is the hashing algorithm to be used, 
according the available Java security provider. The default hashing algorithm 
is SHA-256.
 
Examples:
mask_hash('Alice')
mask_hash('Alice', 'SHA-512')|

> CQL data masking functions
> --------------------------
>
>                 Key: CASSANDRA-17941
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-17941
>             Project: Cassandra
>          Issue Type: New Feature
>          Components: Feature/Dynamic Data Masking
>            Reporter: Andres de la Peña
>            Assignee: Andres de la Peña
>            Priority: Normal
>             Fix For: 4.x
>
>
> Add native CQL functions to mask the contents of a column, as described in 
> [CEP-20|https://cwiki.apache.org/confluence/display/CASSANDRA/CEP-20%3A+Dynamic+Data+Masking].



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to