Skip to content

Commit 2faa1b9

Browse files
update github actions datamasking tutorial (#470)
1 parent 1ad0e32 commit 2faa1b9

File tree

1 file changed

+23
-13
lines changed

1 file changed

+23
-13
lines changed

content/docs/tutorials/github-action-data-masking-part1.md

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ Before you begin, make sure you have:
7575
- `BYTEBASE_SERVICE_KEY`: `[email protected]`
7676
- `BYTEBASE_SERVICE_SECRET`: service key copied in the previous step
7777

78-
## Understanding the Workflow
78+
### Step 5 - Understanding the GitHub Workflow
7979

8080
Let's dig into the GitHub Actions workflow [code](https://github.com/bytebase/database-security-github-actions-example/blob/main/.github/workflows/bb-masking-1.yml):
8181

@@ -85,7 +85,15 @@ Let's dig into the GitHub Actions workflow [code](https://github.com/bytebase/da
8585

8686
1. **File Detection**: The step `Get changed files` will monitor the changed files in the pull request. For this workflow, we only care about column masking and masking exception. So `masking/databases/**/**/column-masking.json` and `masking/projects/**/masking-exception.json` are filtered out.
8787

88-
1. **Apply Masking Columns**: Then step `Apply column masking` will apply the column masking to the database. First it will parse all the column masking files and then do a loop to apply the column masking to the database one by one. The code it calls Bytebase API is as follows:
88+
1. **PR Feedback**: The step `Comment on PR` will comment on the merged pull to notify the result.
89+
90+
## Column Masking
91+
92+
[Column Masking](/docs/security/data-masking/column-masking/) lets you specify table columns different Masking Level to mask the data.
93+
94+
In Bytebase console, go to a database page, then pick a table, you can specify masking level by clicking pen icon on table detail page.
95+
96+
In the GitHub workflow, find the step `Apply column masking`, which will apply the column masking to the database via API. First it will parse all the column masking files and then do a loop to apply the column masking to the database one by one. The code it calls Bytebase API is as follows:
8997

9098
```bash
9199
response=$(curl -s -w "\n%{http_code}" --request PATCH "${BYTEBASE_API_URL}/instances/${INSTANCE_NAME}/databases/${DATABASE_NAME}/policies/masking?allow_missing=true&update_mask=payload" \
@@ -94,7 +102,17 @@ Let's dig into the GitHub Actions workflow [code](https://github.com/bytebase/da
94102
--data @"$CHANGED_FILE")
95103
```
96104

97-
1. **Apply Masking Exceptions**: The step `Apply masking exception` will apply the masking exception to the database and the process is similar, the code it calls Bytebase API is as follows:
105+
By changing the files `masking/databases/**/**/column-masking.json`, create a PR and then merge, the change will be applied to the database.
106+
107+
Log in Bytebase console, at the workspace level, click **Data Access > Data Masking**. Click **Explicit Masked Columns**, you can see the column masking is applied to the database.
108+
109+
![bb-column-masking](/content/docs/tutorials/github-action-data-masking-part1/bb-column-masking.webp)
110+
111+
## Access Unmasked Data
112+
113+
[Access Unmasked Data](/docs/security/data-masking/access-unmasked-data/) lets you relax the masking levels for the users. Full masked column to partial or partial masked column to none.
114+
115+
In the GitHub workflow, find the step `Apply masking exception`, which will apply the masking exception to the database and the process is similar, the code it calls Bytebase API is as follows:
98116

99117
```bash
100118
response=$(curl -s -w "\n%{http_code}" --request PATCH "${BYTEBASE_API_URL}/projects/${PROJECT_NAME}/policies/masking_exception?allow_missing=true& update_mask=payload" \
@@ -103,17 +121,9 @@ Let's dig into the GitHub Actions workflow [code](https://github.com/bytebase/da
103121
--data @"$CHANGED_FILE")
104122
```
105123

106-
1. **PR Feedback**: The step `Comment on PR` will comment on the merged pull to notify the result.
107-
108-
## Verifying the Setup
109-
110-
1. Create and merge a test PR with masking changes.
111-
112-
1. Log in Bytebase console, at the workspace level, click **Data Access > Data Masking**. Click **Explicit Masked Columns**, you can see the column masking is applied to the database.
113-
114-
![bb-column-masking](/content/docs/tutorials/github-action-data-masking-part1/bb-column-masking.webp)
124+
By changing the files `masking/projects/**/masking-exception.json`, create a PR and then merge, the change will be applied to the database.
115125

116-
1. Go to the project `Sample Project`, click **Database > Masking Access**, you can see the masking exception is applied to the database.
126+
Log in Bytebase console, go to the project `Sample Project`, click **Database > Masking Access**, you can see the masking exception is applied to the database.
117127

118128
![bb-masking-exception](/content/docs/tutorials/github-action-data-masking-part1/bb-masking-exception.webp)
119129

0 commit comments

Comments
 (0)