Skip to content

Commit 77fe825

Browse files
committed
docs: consolidate data masking
1 parent 64eefef commit 77fe825

File tree

16 files changed

+147
-66
lines changed

16 files changed

+147
-66
lines changed

data-masking/README.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

data-masking/projects/project-sample/README.md

Lines changed: 0 additions & 10 deletions
This file was deleted.

data-masking/workspace/README.md

Lines changed: 0 additions & 31 deletions
This file was deleted.

data-security/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This directory demonstrates how to use API to configure:
66
1. Database query and export access control.
77
1. Dynamic data masking.
88

9-
You can expand this example to build a GitOps solution to configure all data security policies as code.
9+
You can expand this example to build a GitOps solution to codify all data security policies.
1010

1111
# Fetch the access token
1212

data-masking/databases/hr_prod/README.md renamed to data-security/databases/hr_prod/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Configure column masking explicitly
1+
## Column masking explicitly
22

33
Correspond to https://www.bytebase.com/docs/security/data-masking/column-masking/
44

@@ -8,7 +8,7 @@ curl --request PATCH "${bytebase_url}/v1/instances/prod-sample-instance/database
88
--data @column-masking.json
99
```
1010

11-
## Configure column semantic type and classification
11+
## Column semantic type and classification
1212

1313
- Semantic type: https://www.bytebase.com/docs/security/data-masking/semantic-types/
1414
- Classification: https://www.bytebase.com/docs/security/data-masking/data-classification/#manual-classification

data-security/projects/project-sample/README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Configure IAM
1+
# IAM
22

33
API: https://api.bytebase.com/#tag/projectservice/POST/v1/projects/{project}:setIamPolicy
44

@@ -8,3 +8,16 @@ curl --request POST "${bytebase_url}/v1/projects/${project_id}:setIamPolicy" \
88
--header 'Authorization: Bearer '${bytebase_token} \
99
--data @iam.json
1010
```
11+
12+
# Masking exception
13+
14+
Docs: https://www.bytebase.com/docs/security/data-masking/access-unmasked-data/
15+
16+
API: https://api.bytebase.com/#tag/orgpolicyservice/PATCH/v1/projects/{project}/policies/{policy}
17+
18+
```bash
19+
export project_id=project-sample
20+
curl --request PATCH "${bytebase_url}/v1/projects/${project_id}/policies/masking_exception?allow_missing=true&update_mask=payload" \
21+
--header 'Authorization: Bearer '${bytebase_token} \
22+
--data @masking-exception.json
23+
```

data-security/workspace/README.md

Lines changed: 113 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,45 @@
1-
# Configure users
1+
# Users
2+
3+
We highly recommend using [SSO](https://www.bytebase.com/docs/administration/sso/overview/) to provision
4+
user instead of using API.
5+
6+
API: https://api.bytebase.com/#tag/authservice/POST/v1/users
7+
8+
```bash
9+
## Create
10+
curl --request POST ${bytebase_url}/v1/users \
11+
--header 'Authorization: Bearer '${bytebase_token} \
12+
--data @user.json
13+
```
14+
15+
```bash
16+
## Update
17+
curl --request PATCH "${bytebase_url}/v1/users/111" \
18+
--header 'Authorization: Bearer '${bytebase_token} \
19+
--data '{
20+
"email":"[email protected]",
21+
"title": "User updated",
22+
"phone": "+14082121234"
23+
}'
24+
```
25+
26+
```bash
27+
## Deactivate
28+
curl --request DELETE "${bytebase_url}/v1/users/111" \
29+
--header 'Authorization: Bearer '${bytebase_token}
30+
```
31+
32+
```bash
33+
## Activate
34+
curl --request POST "${bytebase_url}/v1/users/111:undelete" \
35+
--header 'Authorization: Bearer '${bytebase_token}
36+
```
237

338
We don't provide example to configure users as we recommend using [SSO](https://www.bytebase.com/docs/administration/sso/overview/).
439

540
Another challenge for configuring users is you need to specify the password, which is not desirable.
641

7-
# Configure groups
42+
# Groups
843

944
You can skip this if you have [SCIM](https://www.bytebase.com/docs/administration/scim/overview/) to
1045
provision users and groups in an organization.
@@ -14,11 +49,27 @@ API: https://api.bytebase.com/#tag/groupservice
1449
```bash
1550
## Create
1651
curl --request POST ${bytebase_url}/v1/groups \
52+
--header 'Authorization: Bearer '${bytebase_token} \
53+
--data "$(jq -n --arg name 'groups/[email protected]' \
54+
'. + {name: $name} + input' group.json)"
55+
```
56+
57+
You must be the **Group Owner** to update/delete the group.
58+
59+
```bash
60+
## Update
61+
curl --request PATCH "${bytebase_url}/v1/groups/[email protected]" \
1762
--header 'Authorization: Bearer '${bytebase_token} \
1863
--data @group.json
1964
```
2065

21-
# Configure custom roles
66+
```bash
67+
## Delete
68+
curl --request DELETE "${bytebase_url}/v1/groups/[email protected]" \
69+
--header 'Authorization: Bearer '${bytebase_token}
70+
```
71+
72+
# Custom roles
2273

2374
Docs: https://www.bytebase.com/docs/administration/custom-roles/
2475

@@ -38,7 +89,13 @@ curl --request PATCH "${bytebase_url}/v1/roles/auditor" \
3889
--data @custom-role.json
3990
```
4091

41-
# Configure IAM
92+
```bash
93+
## Delete
94+
curl --request DELETE "${bytebase_url}/v1/roles/auditor" \
95+
--header 'Authorization: Bearer '${bytebase_token}
96+
```
97+
98+
# IAM
4299

43100
API: https://api.bytebase.com/#tag/workspaceservice
44101

@@ -48,3 +105,55 @@ curl --request POST "${bytebase_url}/v1/workspaces/${workspace_id}:setIamPolicy"
48105
--header 'Authorization: Bearer '${bytebase_token} \
49106
--data @iam.json
50107
```
108+
109+
# Dynamic Data Masking
110+
111+
Docs: https://www.bytebase.com/docs/security/data-masking/overview/
112+
113+
## Global masking rule
114+
115+
Docs: https://www.bytebase.com/docs/security/data-masking/global-masking-rule/
116+
117+
API: https://api.bytebase.com/#tag/orgpolicyservice/PATCH/v1/policies/{policy}
118+
119+
```bash
120+
curl --request PATCH "${bytebase_url}/v1/policies/masking_rule?allow_missing=true&update_mask=payload" \
121+
--header 'Authorization: Bearer '${bytebase_token} \
122+
--data @global-masking-rule.json
123+
```
124+
125+
## Data classification
126+
127+
Docs: https://www.bytebase.com/docs/security/data-masking/data-classification/
128+
129+
API: https://api.bytebase.com/#tag/settingservice/PATCH/v1/settings/{setting}
130+
131+
```bash
132+
curl --request PATCH ${bytebase_url}/v1/settings/bb.workspace.data-classification \
133+
--header 'Authorization: Bearer '${bytebase_token} \
134+
--data @data-classification.json
135+
```
136+
137+
## Masking algorithm
138+
139+
Docs: https://www.bytebase.com/docs/security/data-masking/masking-algorithm/
140+
141+
API: https://api.bytebase.com/#tag/settingservice/PATCH/v1/settings/{setting}
142+
143+
```bash
144+
curl --request PATCH ${bytebase_url}/v1/settings/bb.workspace.masking-algorithm \
145+
--header 'Authorization: Bearer '${bytebase_token} \
146+
--data @masking-algorithm.json
147+
```
148+
149+
## Semantic type
150+
151+
Docs: https://www.bytebase.com/docs/security/data-masking/semantic-types/
152+
153+
API: https://api.bytebase.com/#tag/settingservice/PATCH/v1/settings/{setting}
154+
155+
```bash
156+
curl --request PATCH ${bytebase_url}/v1/settings/bb.workspace.semantic-types \
157+
--header 'Authorization: Bearer '${bytebase_token} \
158+
--data @semantic-type.json
159+
```

data-security/workspace/group.json

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
{
2-
"name": "groups/[email protected]",
3-
"title": "Contractor Group",
4-
"description": "A group for contractors",
5-
"creator": "users/[email protected]",
6-
"members": [
7-
{
8-
"member": "users/[email protected]",
9-
"role": "OWNER"
10-
}
11-
],
12-
"createTime": "2024-10-11T16:30:40.608Z"
13-
}
2+
"title": "Contractor Group",
3+
"description": "A group for contractors",
4+
"members": [
5+
{
6+
"member": "users/[email protected]",
7+
"role": "OWNER"
8+
}
9+
]
10+
}

data-security/workspace/user.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"email": "[email protected]",
3+
"title": "Test 2",
4+
"userType": "USER",
5+
"password": "",
6+
"mfaEnabled": false,
7+
"phone": "+14082120000"
8+
}

0 commit comments

Comments
 (0)