Skip to content

Commit b511163

Browse files
authored
Merge pull request #49 from bytebase/chore/BYT-6829
chore: update sample
2 parents d53c7d0 + 7bb06d5 commit b511163

File tree

11 files changed

+101
-164
lines changed

11 files changed

+101
-164
lines changed

masking/README.md

+12-24
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,18 @@ Tutorials: [Data Masking with GitHub Actions](https://www.bytebase.com/docs/tuto
66

77
## Workspace-level policies and settings
88

9+
### Semantic type
10+
11+
Docs: https://www.bytebase.com/docs/security/data-masking/semantic-types/
12+
13+
API: https://api.bytebase.com/#tag/settingservice/PATCH/v1/settings/{setting}
14+
15+
```bash
16+
curl --request PATCH ${bytebase_url}/v1/settings/bb.workspace.semantic-types \
17+
--header 'Authorization: Bearer '${bytebase_token} \
18+
--data @semantic-type.json
19+
```
20+
921
### Global masking rule
1022

1123
Docs: https://www.bytebase.com/docs/security/data-masking/global-masking-rule/
@@ -30,30 +42,6 @@ curl --request PATCH ${bytebase_url}/v1/settings/bb.workspace.data-classificatio
3042
--data @data-classification.json
3143
```
3244

33-
### Masking algorithm
34-
35-
Docs: https://www.bytebase.com/docs/security/data-masking/masking-algorithm/
36-
37-
API: https://api.bytebase.com/#tag/settingservice/PATCH/v1/settings/{setting}
38-
39-
```bash
40-
curl --request PATCH ${bytebase_url}/v1/settings/bb.workspace.masking-algorithm \
41-
--header 'Authorization: Bearer '${bytebase_token} \
42-
--data @masking-algorithm.json
43-
```
44-
45-
### Semantic type
46-
47-
Docs: https://www.bytebase.com/docs/security/data-masking/semantic-types/
48-
49-
API: https://api.bytebase.com/#tag/settingservice/PATCH/v1/settings/{setting}
50-
51-
```bash
52-
curl --request PATCH ${bytebase_url}/v1/settings/bb.workspace.semantic-types \
53-
--header 'Authorization: Bearer '${bytebase_token} \
54-
--data @semantic-type.json
55-
```
56-
5745
## Project-level masking exception
5846

5947
Project-level masking exception to overrule the workspace-level setting.

masking/databases/README.md

+6-17
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,14 @@
1-
## Column masking explicitly
1+
## Database catalog for semantic type and classification
22

3-
Docs: https://www.bytebase.com/docs/security/data-masking/column-masking/
4-
5-
API: https://api.bytebase.com/#tag/orgpolicyservice/PATCH/v1/instances/{instance}/databases/{database}/policies/{policy}
6-
7-
```bash
8-
curl --request PATCH "${bytebase_url}/v1/instances/prod-sample-instance/databases/hr_prod/policies/masking?allow_missing=true&update_mask=payload" \
9-
--header 'Authorization: Bearer '${bytebase_token} \
10-
--data @column-masking.json
11-
```
12-
13-
## Column semantic type and classification
14-
15-
Docs:
3+
Docs:
164
- Semantic type: https://www.bytebase.com/docs/security/data-masking/semantic-types/
175
- Classification: https://www.bytebase.com/docs/security/data-masking/data-classification/#manual-classification
186

19-
API: https://api.bytebase.com/#tag/databaseservice/PATCH/v1/instances/{instance}/databases/{database}/metadata
7+
API: https://api.bytebase.com/#tag/databasecatalogservice/PATCH/v1/instances/%7Binstance%7D/databases/{database}/catalog
208

219
```bash
22-
curl --request PATCH ${bytebase_url}/v1/instances/prod-sample-instance/databases/hr_prod/metadata \
10+
cd prod-sample-instance/hr_prod
11+
curl --request PATCH ${bytebase_url}/v1/instances/prod-sample-instance/databases/hr_prod/catalog \
2312
--header 'Authorization: Bearer '${bytebase_token} \
24-
--data @metadata.json
13+
--data @database-catalog.json
2514
```

masking/databases/prod-sample-instance/hr_prod/column-masking.json

-18
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"name": "instances/prod-sample-instance/databases/hr_test/catalog",
3+
"schemas": [
4+
{
5+
"name": "",
6+
"tables": [
7+
{
8+
"name": "salary",
9+
"columns": {
10+
"columns": [
11+
{
12+
"name": "amount",
13+
"semanticType": "bb.default",
14+
"labels": {},
15+
"classification": ""
16+
}
17+
]
18+
},
19+
"classification": "2-2"
20+
}
21+
]
22+
}
23+
]
24+
}

masking/databases/prod-sample-instance/hr_prod/metadata.json

-27
This file was deleted.

masking/databases/test-sample-instance/hr_test/column-masking.json

-18
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"name": "instances/test-sample-instance/databases/hr_test/catalog",
3+
"schemas": [
4+
{
5+
"name": "",
6+
"tables": [
7+
{
8+
"name": "salary",
9+
"columns": {
10+
"columns": [
11+
{
12+
"name": "amount",
13+
"semanticType": "bb.default",
14+
"labels": {},
15+
"classification": ""
16+
}
17+
]
18+
},
19+
"classification": ""
20+
}
21+
]
22+
}
23+
]
24+
}

masking/global-masking-rule.json

+2-20
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,14 @@
44
"type": "MASKING_RULE",
55
"maskingRulePolicy": {
66
"rules": [
7-
{
8-
"id": "9dda9145-895e-451a-99d8-16254c4eb287",
9-
"condition": {
10-
"expression": "environment_id == \"test\"",
11-
"title": "",
12-
"description": ""
13-
},
14-
"maskingLevel": "NONE"
15-
},
16-
{
17-
"id": "d188a226-5ed6-45cc-82e3-baa890a87962",
18-
"condition": {
19-
"expression": "classification_level in [\"1\"]",
20-
"title": "",
21-
"description": ""
22-
},
23-
"maskingLevel": "NONE"
24-
},
257
{
268
"id": "76356d81-6231-4128-9be7-2c549fc505f5",
279
"condition": {
2810
"expression": "classification_level in [\"2\", \"3\"]",
2911
"title": "",
3012
"description": ""
3113
},
32-
"maskingLevel": "PARTIAL"
14+
"semanticType": "bb.default-partial"
3315
},
3416
{
3517
"id": "1ddc47c9-6ab6-4760-accd-947bc1a5f155",
@@ -38,7 +20,7 @@
3820
"title": "",
3921
"description": ""
4022
},
41-
"maskingLevel": "FULL"
23+
"semanticType": "bb.default"
4224
}
4325
]
4426
},

masking/masking-algorithm.json

-33
This file was deleted.

masking/projects/project-sample/masking-exception.json

-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
"maskingExceptions": [
66
{
77
"action": "EXPORT",
8-
"maskingLevel": "NONE",
98
"member": "user:[email protected]",
109
"condition": {
1110
"expression": "resource.instance_id == \"prod-sample-instance\" && resource.database_name == \"hr_prod\" && resource.schema_name == \"public\" && resource.table_name == \"salary\" && resource.column_name == \"amount\"",
@@ -15,7 +14,6 @@
1514
},
1615
{
1716
"action": "QUERY",
18-
"maskingLevel": "PARTIAL",
1917
"member": "user:[email protected]",
2018
"condition": {
2119
"expression": "resource.instance_id == \"prod-sample-instance\" && resource.database_name == \"hr_prod\" && resource.schema_name == \"public\" && resource.table_name == \"salary\" && resource.column_name == \"amount\"",
@@ -25,7 +23,6 @@
2523
},
2624
{
2725
"action": "QUERY",
28-
"maskingLevel": "PARTIAL",
2926
"member": "group:[email protected]",
3027
"condition": {
3128
"expression": "resource.instance_id == \"prod-sample-instance\" && resource.database_name == \"hr_prod\" && resource.schema_name == \"public\" && resource.table_name == \"salary\" && resource.column_name == \"amount\"",

masking/semantic-type.json

+33-4
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,41 @@
33
"value": {
44
"semanticTypeSettingValue": {
55
"types": [
6+
{
7+
"id": "bb.default",
8+
"title": "Default",
9+
"description": "Default semantic type for full masking"
10+
},
11+
{
12+
"id": "bb.default-partial",
13+
"title": "Default Partial",
14+
"description": "Default semantic for partial masking"
15+
},
616
{
717
"id": "e8d3fd41-eba0-4afd-ae0f-32c91a4ee710",
8-
"title": "semantic-type-001",
9-
"description": "",
10-
"partialMaskAlgorithmId": "9347822e-5a4a-4797-85ed-a59bb3115622",
11-
"fullMaskAlgorithmId": ""
18+
"title": "Personal sensitive data",
19+
"description": "Custom semantic type with full masking for personal sensitive data",
20+
"algorithm": {
21+
"fullMask": {
22+
"substitution": "***"
23+
}
24+
}
25+
},
26+
{
27+
"id": "38b31ac4-b90d-44ac-b42a-19d9c76c83ea",
28+
"title": "Location",
29+
"description": "Custom semantic type with range masking for location",
30+
"algorithm": {
31+
"rangeMask": {
32+
"slices": [
33+
{
34+
"start": 0,
35+
"end": 4,
36+
"substitution": "*"
37+
}
38+
]
39+
}
40+
}
1241
}
1342
]
1443
}

0 commit comments

Comments
 (0)