Repository navigation
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
|
刚 force push 了 erraform fmt 修复 Repository Lint(for_each map key 对齐)。CI 会重新跑。 |
|
Hi, I just signed the Google Contributor License Agreement (CLA). Could someone please re-run the \cla/google\ check? Thanks! |
aghassemlouei
left a comment
There was a problem hiding this comment.
Thanks for tackling the modules/access-context-manager and modules/beyondcorp updates for #372. Validating the IAM condition against the GCP IAM API and testing optional condition inputs surfaced two blocking issues and one release-note requirement:
modules/beyondcorp/main.tfcalls.match(...)onrequest.auth.access_levels, which the GCP IAM CEL compiler rejects becauseaccess_levelsis alist<string>, and double-prefixesaccessPolicies/.../accessLevels/ontogoogle_access_context_manager_access_level.endpoint_verified.name.modules/access-context-manager/main.tfunconditionally dereferencesconditions.value.device_policy.require_screen_lock, which fails at plan time if a condition omitsdevice_policy.- Changing
output "endpoint_name"from the resource object to.name, removingENCRYPTION_UNSUPPORTED, and attaching an IAM condition ongoogle_project_iam_member.iap_useralter module outputs and access behavior; please populate.github/pull_request_template.mdand document any breaking output change if callers depend onendpoint_nameattributes.
| condition { | ||
| title = "endpoint-verified" | ||
| description = "Require endpoint verification access level" | ||
| expression = "request.auth.access_levels.match('accessPolicies/${data.google_access_context_manager_access_policy.existing_policy.id}/accessLevels/${google_access_context_manager_access_level.endpoint_verified.name}')" | ||
| } |
There was a problem hiding this comment.
Two defects cause this IAM condition to fail at apply time and never match at runtime:
- In GCP IAM Conditions CEL,
request.auth.access_levelshas typelist<string>, so.match(...)fails compilation on the IAM API with400 INVALID_ARGUMENT: Compilation error: undeclared reference to 'match'. Membership checks onrequest.auth.access_levelsmust use theinoperator. google_access_context_manager_access_level.endpoint_verified.nameis already exported in fullaccessPolicies/{policy_id}/accessLevels/{name}format, so interpolating it insideaccessPolicies/.../accessLevels/${...name}duplicates the prefix.
| condition { | |
| title = "endpoint-verified" | |
| description = "Require endpoint verification access level" | |
| expression = "request.auth.access_levels.match('accessPolicies/${data.google_access_context_manager_access_policy.existing_policy.id}/accessLevels/${google_access_context_manager_access_level.endpoint_verified.name}')" | |
| } | |
| condition { | |
| title = "endpoint-verified" | |
| description = "Require endpoint verification access level" | |
| expression = "\"${google_access_context_manager_access_level.endpoint_verified.name}\" in request.auth.access_levels" | |
| } |
| device_policy { | ||
| require_screen_lock = conditions.value.device_policy.require_screen_lock | ||
| } |
There was a problem hiding this comment.
Make device_policy optional in variables.tf as device_policy = optional(object({ require_screen_lock = optional(bool) })) and render it via a dynamic "device_policy" block when conditions.value.device_policy != null so callers defining IP-only or region-only conditions do not fail terraform plan when device_policy is null:
| device_policy { | |
| require_screen_lock = conditions.value.device_policy.require_screen_lock | |
| } | |
| dynamic "device_policy" { | |
| for_each = conditions.value.device_policy != null ? [conditions.value.device_policy] : [] | |
| content { | |
| require_screen_lock = device_policy.value.require_screen_lock | |
| } | |
| } |
|
Hi maintainers! @GoogleCloudPlatform/foundation-framework 👋 This PR is all green (no conflicts, CI passing) and has been rebased on latest. Could someone take a look when you have a moment? Thanks! |
Handing off review to @pulsingSignal.
…gaps - access-context-manager: iterate all conditions via dynamic block instead of hardcoded [0] - access-context-manager: make unused project_id and region variables optional - beyondcorp: restrict encryption_statuses to only ENCRYPTED (removed ENCRYPTION_UNSUPPORTED) - beyondcorp: bind endpoint_verified access level condition to IAP IAM member - beyondcorp: mark oauth_client_secret variable as sensitive - beyondcorp: output endpoint_verified.name instead of full resource object
914f8ad to
75de5a8
Compare
|
@LeonxLJX Hello, thank you for the contribution so far. Please let us know if you are able to reconcile all outstanding comments/conversations related to the submitted code for this PR. If you are not able to resolve them by Friday, we will close this PR as the review is becoming stale. |
|
Hi! The failing check — I just rebased this PR. Could you re-trigger CI? Thanks! |
Fixes #372.
Summary
This PR addresses functional and security gaps in
modules/access-context-managerandmodules/beyondcorp.Changes Made
modules/access-context-manager
each.value.conditions[0]indexing with adynamic "conditions"block that iterates over all elements, ensuring all caller-supplied conditions are evaluated.default = nulltoproject_idandregionvariables, making them optional since they are not referenced by the module.modules/beyondcorp
ENCRYPTION_UNSUPPORTEDfromallowed_encryption_statuses, now only allows["ENCRYPTED"].conditionblock togoogle_project_iam_member.iap_userthat requires theendpoint_verifiedaccess level before granting IAP access.oauth_client_secretassensitive = trueto prevent secret leakage in logs and plan output.endpoint_nameoutput from returning the full resource object to returning.name.Security Impact
ENCRYPTION_UNSUPPORTED