이 페이지에는 Google Cloud Armor 보안 정책과 함께 사용할 수 있는 선택적 기능인 POST 본문 콘텐츠 파싱을 구성하는 방법에 관한 정보가 포함되어 있습니다.
기본적으로 Google Cloud Armor는 사전 구성된 WAF 규칙의 서명에 대해 POST 본문의 전체 콘텐츠를 균일한 문자열(본문 크기 제한사항 적용)로 평가합니다. JSON과 같은 대체 인코딩이 포함된 요청의 경우(사용자가 지정하지 않은) 메시지의 구조적 구성요소가 사전 구성된 WAF 서명에 대한 일치를 트리거할 수 있습니다. 노이즈를 방지하고 거짓양성 위험을 줄이려면 보호된 워크로드가 다음을 수행하는 경우 지원되는 모든 콘텐츠 유형에 대체 파싱을 사용 설정하도록 Google Cloud Armor를 구성하는 것이 좋습니다.
REST API 제공
GraphQL 사용
JSON 인코딩 콘텐츠가 있는 요청 수신
각 보안 정책에 대한 POST 요청의 JSON 본문 콘텐츠 파싱을 사용 설정 또는 중지할 수 있습니다. Content-Type 헤더가 application/json으로 설정된 경우 Google Cloud CLI에서 --json-parsing 플래그를 사용합니다.
플래그는 gcloud compute security-policies update에서만 사용할 수 있습니다. 파일에 보안 정책을 만들고 해당 파일을 가져오지 않는 한 이 옵션으로 새 보안 정책을 만들 수 없습니다. 자세한 내용은 보안 정책 가져오기를 참조하세요.
JSON 파싱 사용
다음 예에서는 대체 파싱이 적용되는 커스텀 Content-Type 헤더 값 목록을 구성합니다. 다음 예에서는 보안 정책 POLICY_NAME을 업데이트하여 JSON 파싱을 사용 설정하고 콘텐츠 유형 application/json, application/vnd.api+json, application/vnd.collection+json, application/vnd.hyper+json을 지정합니다.
Google Cloud Armor 보안 정책에 대해 평가되는 각 HTTP(S) 요청은 Cloud Logging을 통해 로깅됩니다. 로그는 적용된 보안 정책의 이름, 일치 규칙, 규칙 적용 여부와 같은 세부정보를 제공합니다. 새 백엔드 서비스 리소스의 요청 로깅은 기본적으로 중지되어 있습니다. Google Cloud Armor 요청을 로깅하려면 보안 정책으로 보호되는 각 백엔드 서비스에 HTTP(S) 로깅 설정을 사용 설정해야 합니다.
자세한 내용은 전역 외부 애플리케이션 부하 분산기 로깅 및 모니터링을 참조하세요.
제한사항
JSON 파싱을 구성할 때는 다음 제한사항을 고려하세요.
Google Cloud Armor는 기본적으로 처음 8kB까지의 HTTP POST 본문을 검사합니다. 이 한도는 8kB, 16kB, 32kB, 48kB 또는 64kB로 구성할 수 있습니다. JSON 콘텐츠가 구성된 검사 한도보다 큰 경우 Google Cloud Armor는 이 한도까지 JSON 파싱을 적용하며, 이는 사전 구성된 WAF 규칙으로 검사됩니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-07-31(UTC)"],[[["\u003cp\u003eThis page details how to configure Google Cloud Armor to parse POST body content, an optional feature that can help avoid false positives with preconfigured Web Application Firewall (WAF) rules.\u003c/p\u003e\n"],["\u003cp\u003eEnabling alternative parsing for supported content types like JSON is recommended for workloads that serve REST APIs, use GraphQL, or receive JSON-encoded requests to minimize noise and the risk of false positives.\u003c/p\u003e\n"],["\u003cp\u003eJSON body content parsing can be enabled or disabled per security policy using the \u003ccode\u003e--json-parsing\u003c/code\u003e flag in the Google Cloud CLI, supporting \u003ccode\u003eSTANDARD\u003c/code\u003e, \u003ccode\u003eSTANDARD_WITH_GRAPHQL\u003c/code\u003e, and \u003ccode\u003eDISABLED\u003c/code\u003e options.\u003c/p\u003e\n"],["\u003cp\u003eWhen configuring JSON parsing, you can specify custom \u003ccode\u003eContent-Type\u003c/code\u003e header values for alternative parsing and set the policy to include GraphQL parsing with \u003ccode\u003eSTANDARD_WITH_GRAPHQL\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe inspection of POST body content is limited to the first 8 KB, and if the JSON parser fails to produce a result, URI parsing may be attempted.\u003c/p\u003e\n"]]],[],null,["# Request body content parsing\n\nThis page contains information about configuring request body content parsing, an\noptional feature that you can use with your Cloud Armor security\npolicies.\n\nBy default, Cloud Armor evaluates the full content of a request body as a\nuniform string (subject to [body size limitations](#limitations))\nagainst the signatures in your preconfigured WAF rules. For requests that\ncontain alternative encoding like JSON, structural components of the message\n(not user specified) can trigger matches against the preconfigured WAF\nsignatures. To avoid noise and reduce the risk of false positives, we recommend\nthat you configure Cloud Armor to enable alternative parsing for any\nsupported content type if your protected workloads do the following:\n\n- Serve REST APIs\n- Use GraphQL\n- Receive any requests with JSON encoded content.\n\nFor each security policy, you can enable or disable JSON parsing for request\nbodies. When the `Content-Type` header is set to\n`application/json`, use the `--json-parsing` flag in the Google Cloud CLI.\n\nBy default, this option is disabled. The syntax for the flag follows:\n\n`--json-parsing=[STANDARD | STANDARD_WITH_GRAPHQL | DISABLED]`\n\nThe flag is available only with `gcloud compute security-policies update`. You\ncannot create a new security policy with this option unless you create a\nsecurity policy in a file and then import that file. For more information, see\n[Import security policies](/armor/docs/configure-security-policies#importing-policies).\n\nUse JSON parsing\n----------------\n\nIn the following example, you configure a list of custom `Content-Type` header\nvalues for which alternative parsing is applied. The example updates the\nsecurity policy \u003cvar translate=\"no\"\u003ePOLICY_NAME\u003c/var\u003e to enable JSON parsing, and specifies the\ncontent types `application/json`, `application/vnd.api+json`,\n`application/vnd.collection+json`, and `application/vnd.hyper+json`: \n\n```\ngcloud compute security-policies update POLICY_NAME \\\n --json-parsing STANDARD \\\n --json-custom-content-types \"application/json,application/vnd.api+json,application/vnd.collection+json,application/vnd.hyper+json\"\n```\n\nUse GraphQL parsing\n-------------------\n\nTo configure GraphQL parsing, update your security policy to set the\n`--json-parsing` flag to `STANDARD_WITH_GRAPHQL`: \n\n```\ngcloud compute security-policies update POLICY_NAME \\\n --json-parsing STANDARD_WITH_GRAPHQL\n```\n\nLogging\n-------\n\nEach HTTP(S) request that is evaluated against a Cloud Armor security\npolicy is logged through Cloud Logging. The logs provide details, such as the\nname of the applied security policy, the matching rule, and whether the rule was\nenforced. Request logging for new backend service resources is disabled by\ndefault. To log Cloud Armor requests, you must enable the HTTP(S)\nlogging setting for each backend service protected by a security policy.\n\nFor more information, see\n[Global external Application Load Balancer logging and monitoring](/load-balancing/docs/https/https-logging-monitoring).\n\n\nLimitations\n-----------\n\nConsider the following limitations when configuring JSON parsing:\n\n- Cloud Armor inspects the `HTTP POST` body up to the first 8 kB by default. You can configure this limit to either 8 kB,\n 16 kB, 32 kB, 48 kB, or 64 kB. If the JSON content is larger than the\n configured inspection limit, then Cloud Armor applies JSON parsing\n up to this limit, which is then inspected by any of the preconfigured WAF rules.\n\n For more information about configuring the inspection limit for the request\n body when using preconfigured WAF rules, see\n [POST and PATCH body inspection limitation](/armor/docs/security-policy-overview#post-body).\n- If the JSON parser returns no result, URI parsing might be attempted. If the\n URI parser returns no name-value parameters or only partial\n name-value parameters, the entire or partial string might be treated as the\n parameter name for the inspection.\n\nWhat's next\n-----------\n\n- [Configure Cloud Armor security policies](/armor/docs/configure-security-policies)\n- [Use request logging](/armor/docs/request-logging)"]]