이 주제에서는 새 검사 템플릿을 만드는 방법을 자세하게 설명합니다. Cloud Data Loss Prevention UI를 사용하여 새 검사 템플릿을 만드는 방법을 빠르게 둘러보려면 빠른 시작: Cloud DLP 검사 템플릿 만들기를 참조하세요.
템플릿 정보
템플릿을 사용하여 Cloud DLP에서 사용할 구성 정보를 만들고 유지할 수 있습니다. 템플릿은 검사 대상 및 익명화 방법과 같은 구성 정보를 요청 구현에서 분리하는 데 유용하며, 구성을 재사용할 수 있는 방법을 제공하고 사용자와 데이터세트 전반에서 일관성을 유지할 수 있게 해줍니다. 또한 템플릿을 업데이트할 때마다 템플릿을 사용하는 모든 작업 트리거에 대해 업데이트됩니다.
Cloud DLP는 검사 템플릿과 익명화 템플릿을 지원합니다. 검사 템플릿은 이 주제에서 다루며 익명화 템플릿은 Cloud DLP 익명화 템플릿 만들기에서 다룹니다.
Cloud DLP 템플릿의 개념 정보는 템플릿을 참조하세요.
새 검사 템플릿 만들기
새 Cloud DLP 템플릿을 만드는 방법은 다음과 같습니다.
Console
Cloud Console에서 Cloud DLP를 엽니다.
만들기 메뉴에서 템플릿을 선택합니다.
또는 다음 버튼을 클릭합니다.
템플릿 만들기 페이지는 다음 섹션으로 구성되어 있습니다.
템플릿 정의
템플릿 정의에서 검사 템플릿의 식별자를 입력합니다. 그러면 작업을 실행하거나 작업 트리거를 만들 때 이 이름으로 템플릿을 참조할 수 있습니다. 문자, 숫자, 하이픈을 사용할 수 있습니다. 필요한 경우 템플릿 기능을 기억하는 데 도움이 되도록 설명과 함께 사용자 친화적인 표시 이름을 입력할 수도 있습니다.
감지 구성
다음으로 infoType 및 기타 옵션을 선택하여 Cloud DLP가 콘텐츠에서 감지하는 항목을 구성합니다.
InfoType 감지기는 특정 유형의 민감한 정보를 찾습니다. 예들 들어 Cloud DLP US_SOCIAL_SECURITY_NUMBER
infoType 감지기는 미국 사회보장 번호를 찾습니다. 기본 제공 infoType 감지기 외에 고유 한 커스텀 infoType 감지기도 만들 수 있습니다.
InfoTypes에서 스캔할 데이터 유형에 해당하는 infoType 감지기를 선택합니다. 또한 모든 기본 infoType을 스캔하려면 이 필드를 비워둘 수 있습니다. 각 감지기에 대한 자세한 내용은 InfoType 감지기 참조를 확인하세요.
또한 커스텀 infoType 섹션에 커스텀 infoType 감지기를 추가하고 검사 규칙 세트 섹션에서 기본 제공 infoType 감지기와 커스텀 infoType 감지기를 모두 맞춤설정할 수 있습니다.
커스텀 infoType
To add a custom infoType detector:
- Click Add custom infoType.
- Choose the type of custom infoType detector you want to create:
- Words or phrases: Matches on one or more words or phrases that you enter into the field. Use this custom infoType when you have just a few words or phrases to search for. Give your custom infoType a name, and then, under List of words or phrases, type the word or phrase you want Cloud DLP to match on. To search on multiple words or phrases, press Enter after each one. For more information, see Creating a regular custom dictionary detector.
- Dictionary path: Searches your content for items in a list of words and phrases. The list is stored in a text file in Cloud Storage. Use this custom infoType when you have anywhere from a few to several hundred thousand words or phrases to search for. This method is also useful if your list contains sensitive elements and you don't want to store them inside of a job or template. Give your custom infoType a name, and then, under Dictionary location, enter or browse to the Cloud Storage path where the dictionary file is stored. For more information, see Creating a regular custom dictionary detector.
- Regex: Matches content based on a regular expression. Give your custom infoType a name, and then, in the Regex field, enter a regex pattern to match words and phrases. See the supported regex syntax.
- Stored infoType: This option adds a stored custom dictionary detector, which is a kind of dictionary detector that is built from either a large text file stored in Cloud Storage or a single column of a BigQuery table. Use this kind of custom infoType when you have anywhere from several hundred thousand to tens of millions of words or phrases to search for. Be aware that this is the only option in this menu for which you must have already created the stored infoType to use it. Give your custom infoType a name (different from the name you gave the stored infoType), and then, in the Stored infoType field, enter the name of the stored infoType. For more information about creating stored custom dictionaries, see Creating a stored custom dictionary detector.
Click Add custom infoType again to add additional custom infoType detectors.
검사 규칙 세트
Inspection rulesets allow you to customize both built-in and custom infoType detectors using context rules. The two types of inspection rules are:
- Exclusion rules, which help exclude false or unwanted findings.
- Hotword rules, which help detect additional findings.
To add a new ruleset, first specify one or more built-in or custom infoType detectors in the InfoTypes section. These are the infoType detectors that your rulesets will be modifying. Then, do the following:
- Click in the Choose infoTypes field. The infoType or infoTypes you specified previously appear below the field in a menu, as shown here:
- Choose an infoType from the menu, and then click Add rule. A menu appears with the two options Hotword rule and Exclusion rule.

For hotword rules, choose Hotword rules. Then, do the following:
- In the Hotword field, enter a regular expression that Cloud DLP should look for.
- From the Hotword proximity menu, choose whether the hotword you entered is found before or after the chosen infoType.
- In Hotword distance from infoType, enter the approximate number of characters between the hotword and the chosen infoType.
- In Confidence level adjustment, choose whether to assign matches a fixed likelihood level, or to increase or decrease the default likelihood level by a certain amount.
For exclusion rules, choose Exclusion rules. Then, do the following:
- In the Exclude field, enter a regular expression (regex) that Cloud DLP should look for.
- From the Matching type menu, choose one of the following:
- Full match: The finding must completely match the regex.
- Partial match: A substring of the finding can match the regex.
- Inverse match: The finding doesn't match the regex.
You can add additional hotword or exclusion rules and rulesets to further refine your scan results.
신뢰도 기준
Cloud DLP가 민감한 정보의 잠재적인 일치 항목을 감지할 때마다 일치 항목에 'Very unlikely'에서 'Very likely' 범위의 가능성 값을 할당합니다. 여기서 가능성 값을 설정하면 Cloud DLP는 이 가능성 값 이상에 해당하는 데이터만 비교하게 됩니다.
기본값인 '가능성 있음'은 대부분의 용도에 적합합니다. 일반적으로 결과가 너무 많이 검색되면 슬라이더를 위로 이동합니다. 일치 항목 결과가 너무 적으면 슬라이더를 아래로 이동합니다.
완료되면 만들기를 클릭하여 템플릿을 만듭니다. 템플릿의 요약 정보 페이지가 표시됩니다.
기본 Cloud DLP 페이지로 돌아가려면 Cloud Console에서 뒤로 화살표를 클릭합니다.
프로토콜
검사 템플릿은 재사용 가능한 검사 구성에 일부 메타데이터를 더한 것일 뿐입니다. API 용어에서 InspectTemplate
객체는 사실상 표시 이름 및 설명과 같은 몇 가지 추가 메타데이터 필드가 포함된 InspectConfig
객체입니다. 따라서 새 검사 템플릿을 만들기 위한 기본 단계는 다음과 같습니다.
InspectConfig
객체로 시작합니다.projects.inspectTemplates
또는organizations.inspectTemplates
리소스의create
메서드를 호출하거나 게시하며, 이때 요청에 표시 이름, 설명,InspectConfig
객체가 있는InspectTemplate
객체를 포함합니다.
반환되는 InspectTemplate
은 즉시 사용할 수 있습니다. 다른 호출 또는 작업에서 name
으로 참조할 수 있습니다. *.inspectTemplates.list
메서드를 호출하여 기존 템플릿을 나열할 수 있습니다. 특정 템플릿을 보려면 *.inspectTemplates.get
메서드를 호출합니다. 만들 수 있는 템플릿 수의 한도는 1000개입니다.
Cloud DLP를 사용하여 텍스트, 이미지, 구조화된 콘텐츠에서 민감한 콘텐츠를 검사한 경험이 있다면 이미 InspectConfig
객체를 만든 것입니다. 한 가지 부가적인 단계로 이 객체를 InspectTemplate
객체로 변환합니다.
다음 JSON은 projects.inspectTemplates.create
메서드에 전송할 수 있는 항목의 예시입니다. 이 JSON은 주어진 표시 이름과 설명으로 새 템플릿을 만들고 infoType PHONE_NUMBER
및 US_TOLLFREE_PHONE_NUMBER
의 일치 항목을 스캔합니다. 결과에 가능성이 POSSIBLE
이상인 일치 항목을 최대 100개 포함하며, 각각의 맥락도 일부분 포함합니다.
JSON 입력:
POST https://dlp.googleapis.com/v2/projects/[PROJECT_ID]/inspectTemplates?key={YOUR_API_KEY}
{
"inspectTemplate":{
"displayName":"Phone number inspection",
"description":"Scans for phone numbers",
"inspectConfig":{
"infoTypes":[
{
"name":"PHONE_NUMBER"
},
{
"name":"US_TOLLFREE_PHONE_NUMBER"
}
],
"minLikelihood":"POSSIBLE",
"limits":{
"maxFindingsPerRequest":100
},
"includeQuote":true
}
}
}
JSON 출력:
응답 JSON은 다음과 비슷합니다.
{
"name":"projects/[PROJECT_ID]/inspectTemplates/[JOB_ID]",
"displayName":"Phone number inspection",
"description":"Scans for phone numbers",
"createTime":"2018-11-30T07:26:28.164136Z",
"updateTime":"2018-11-30T07:26:28.164136Z",
"inspectConfig":{
"infoTypes":[
{
"name":"PHONE_NUMBER"
},
{
"name":"US_TOLLFREE_PHONE_NUMBER"
}
],
"minLikelihood":"POSSIBLE",
"limits":{
"maxFindingsPerRequest":100
},
"includeQuote":true
}
}
이를 빠르게 시도하려면 아래에 포함된 API 탐색기를 사용할 수 있습니다. JSON을 사용하여 DLP API로 요청을 전송하는 데 대한 일반적인 정보는 JSON 빠른 시작을 참조하세요.
자바
Cloud DLP용 클라이언트 라이브러리를 설치하고 사용하는 방법은 Cloud DLP 클라이언트 라이브러리를 참조하세요.
Node.js
Cloud DLP용 클라이언트 라이브러리를 설치하고 사용하는 방법은 Cloud DLP 클라이언트 라이브러리를 참조하세요.
Python
Cloud DLP용 클라이언트 라이브러리를 설치하고 사용하는 방법은 Cloud DLP 클라이언트 라이브러리를 참조하세요.
Go
Cloud DLP용 클라이언트 라이브러리를 설치하고 사용하는 방법은 Cloud DLP 클라이언트 라이브러리를 참조하세요.
PHP
Cloud DLP용 클라이언트 라이브러리를 설치하고 사용하는 방법은 Cloud DLP 클라이언트 라이브러리를 참조하세요.
C#
Cloud DLP용 클라이언트 라이브러리를 설치하고 사용하는 방법은 Cloud DLP 클라이언트 라이브러리를 참조하세요.
검사 템플릿 사용
새 검사 템플릿을 만든 후에는 새 검사 작업 또는 작업 트리거를 만들 때 이 템플릿을 사용할 수 있습니다. 또한 템플릿을 업데이트할 때마다 템플릿을 사용하는 모든 작업 트리거에 대해 업데이트됩니다. 코드 샘플을 포함한 자세한 내용은 다음을 참조하세요.
Console
새 템플릿을 사용하여 빠르게 시작하려면 다음 변경사항과 함께 빠른 시작: Cloud DLP 검사 템플릿 만들기에 제공된 안내를 따르세요.
- 감지 구성 > 템플릿 섹션에서 템플릿 이름 필드를 클릭하고 방금 만든 템플릿을 선택합니다.
콘텐츠 스캔 방법에 대해 더 심층적으로 알아보려면 '감지 구성' 섹션에 특히 주의하여 Cloud DLP 검사 작업 만들기 및 예약을 참조하세요.
프로토콜
다음과 같이 inspectTemplateName
이 허용되는 모든 위치에서 템플릿을 만들 때 지정한 템플릿 식별자를 사용할 수 있습니다.
projects.content.inspect
: 템플릿을 구성으로 사용하여 콘텐츠의 잠재적인 민감한 정보를 익명화합니다.projects.content.deidentify
: 템플릿을 구성으로 사용하여 콘텐츠의 잠재적인 민감한 정보를 찾아서 익명화합니다. 이 메서드는 검사 템플릿과 익명화 템플릿을 모두 사용합니다.projects.dlpJobs.create
(InspectJobConfig
객체): 템플릿을 구성으로 포함하는 검사 작업을 만듭니다.
검사 템플릿 나열
현재 프로젝트 또는 조직에서 만든 모든 검사 템플릿을 나열하는 방법은 다음과 같습니다.
Console
Cloud Console에서 Cloud DLP를 엽니다.
템플릿 탭을 클릭합니다.
콘솔에 현재 프로젝트의 모든 검사 템플릿 목록이 표시됩니다.
프로토콜
*.*.list
메서드 중 하나를 사용합니다.
자바
Cloud DLP용 클라이언트 라이브러리를 설치하고 사용하는 방법은 Cloud DLP 클라이언트 라이브러리를 참조하세요.
Node.js
Cloud DLP용 클라이언트 라이브러리를 설치하고 사용하는 방법은 Cloud DLP 클라이언트 라이브러리를 참조하세요.
Python
Cloud DLP용 클라이언트 라이브러리를 설치하고 사용하는 방법은 Cloud DLP 클라이언트 라이브러리를 참조하세요.
Go
Cloud DLP용 클라이언트 라이브러리를 설치하고 사용하는 방법은 Cloud DLP 클라이언트 라이브러리를 참조하세요.
PHP
Cloud DLP용 클라이언트 라이브러리를 설치하고 사용하는 방법은 Cloud DLP 클라이언트 라이브러리를 참조하세요.
C#
Cloud DLP용 클라이언트 라이브러리를 설치하고 사용하는 방법은 Cloud DLP 클라이언트 라이브러리를 참조하세요.
검사 템플릿을 global
리전에 복사합니다.
구성 목록으로 이동하세요.
필요한 경우 사용하려는 검사 템플릿이 포함된 프로젝트로 전환합니다.
템플릿 탭을 클릭한 다음, 검사 하위 탭을 클릭합니다.
사용할 템플릿을 찾습니다.
작업을 클릭한 다음 복사를 클릭하세요.
템플릿 만들기 페이지의 리소스 위치 목록에서 글로벌(모든 리전)을 선택하세요.
만들기를 클릭합니다.
템플릿이 global
리전에 복사됩니다.
다른 프로젝트에 검사 템플릿 복사
구성 목록으로 이동하세요.
필요한 경우 사용하려는 검사 템플릿이 포함된 프로젝트로 전환합니다.
템플릿 탭을 클릭한 다음, 검사 하위 탭을 클릭합니다.
사용할 템플릿을 찾습니다.
작업을 클릭한 다음 복사를 클릭하세요.
툴바에서
프로젝트 선택기를 클릭하고 검사 템플릿을 복사할 프로젝트를 선택합니다.선택한 프로젝트에서 템플릿 만들기 페이지가 새로고침됩니다.
만들기를 클릭합니다.
선택한 프로젝트에서 템플릿이 생성됩니다.
검사 템플릿 삭제
검사 템플릿을 삭제하는 방법은 다음과 같습니다.
Console
Cloud Console에서 Cloud DLP를 엽니다.
구성 탭을 클릭한 다음 템플릿 탭을 클릭합니다. 콘솔에 현재 프로젝트의 모든 템플릿 목록이 표시됩니다.
삭제할 템플릿의 작업 열에서 작업 더보기 메뉴(세로로 정렬된 세 개의 점으로 표시됨)
를 클릭한 다음 삭제를 클릭합니다.
또는 템플릿 목록에서 삭제할 템플릿 이름을 클릭합니다. 템플릿의 세부정보 페이지에서 삭제를 클릭합니다.
프로토콜
*.*.delete
메서드 중 하나를 사용합니다.
각 *.*.delete
메서드에는 삭제할 템플릿의 리소스 이름을 포함합니다.
자바
Cloud DLP용 클라이언트 라이브러리를 설치하고 사용하는 방법은 Cloud DLP 클라이언트 라이브러리를 참조하세요.
Node.js
Cloud DLP용 클라이언트 라이브러리를 설치하고 사용하는 방법은 Cloud DLP 클라이언트 라이브러리를 참조하세요.
Python
Cloud DLP용 클라이언트 라이브러리를 설치하고 사용하는 방법은 Cloud DLP 클라이언트 라이브러리를 참조하세요.
Go
Cloud DLP용 클라이언트 라이브러리를 설치하고 사용하는 방법은 Cloud DLP 클라이언트 라이브러리를 참조하세요.
PHP
Cloud DLP용 클라이언트 라이브러리를 설치하고 사용하는 방법은 Cloud DLP 클라이언트 라이브러리를 참조하세요.
C#
Cloud DLP용 클라이언트 라이브러리를 설치하고 사용하는 방법은 Cloud DLP 클라이언트 라이브러리를 참조하세요.