Prepare and test your skills
Prepare and test your skills
Free sample question, answered and explained below. The Professional Cloud Security Engineer practice bank has 1,343 more like it. Try 10 free: instant score, no account.
A security engineer needs to configure a conditional IAM role binding for an external operations team in Google Cloud. The team requires administrative access to compute resources only during standard working business hours in Germany.
The access must satisfy the following criteria:
Europe/Berlin).Europe/Berlin) so that no access is granted once the clock strikes 17:00:00.Which Common Expression Language (CEL) condition expression should the engineer bind to the IAM policy?
This expression uses logical disjunction (|| or OR operators) instead of logical conjunction (&& or AND operators) between each temporal condition.
|| causes the entire condition to evaluate to true whenever any single sub-expression is true.request.time.getDayOfWeek("Europe/Berlin") <= 5 will evaluate to true on Monday through Friday regardless of the hour, permitting 24-hour access during weekdays.request.time.getHours("Europe/Berlin") >= 9 would evaluate to true on weekends during the day, entirely bypassing the day-of-week restriction.|| grants access if any single condition evaluates to true.&& to enforce intersection rather than union.The policy intended to grant access either during specific hours OR during specific days as independent alternative criteria.
This expression invokes the getHours() and getDayOfWeek() functions without passing the mandatory timezone string argument.
request.time.getHours() and request.time.getDayOfWeek() require an explicit IANA timezone identifier string (such as "Europe/Berlin" or "UTC")."Europe/Berlin" parameter, the expression cannot account for local business hours or daylight saving time in Germany.CEL timestamp methods accepted a parameterless call that implicitly evaluated against the target local timezone, which is not supported.
This CEL expression permits access on weekdays (Monday through Friday) whenever request.time.getHours("Europe/Berlin") evaluates to any integer between 9 and 17 inclusive.
getHours() returns discrete integer values representing the entire 60-minute block for that hour. The value 17 represents the full hour from 17:00:00 to 17:59:59 (5:00 PM to 5:59 PM).<= 17 causes the condition to remain true throughout the entire 5:00 PM hour, resulting in access extending until 5:59:59 PM. This violates the explicit requirement that access must terminate at 16:59:59.<= 17 creates an effective end time of 17:59:59 rather than 17:00:00.The business requirement allowed access to continue throughout the entire 5:00 PM hour until 5:59:59 PM.
This Common Expression Language (CEL) expression defines a recurring, time-based schedule condition evaluated dynamically against incoming API requests in Google Cloud IAM.
request.time.getDayOfWeek("Europe/Berlin") returns an integer where 1 corresponds to Monday and 7 corresponds to Sunday. The clause >= 1 && <= 5 restricts access strictly from Monday through Friday.request.time.getHours("Europe/Berlin") returns an integer representing the hour in 24-hour notation (from 0 through 23). The integer 16 represents the hour interval 16:00:00 through 16:59:59 (4:00 PM to 4:59 PM). Specifying <= 16 guarantees that as soon as the time becomes 17:00:00, the expression evaluates to false, revoking access immediately at 5:00 PM.&& (AND) operators ensure that all criteria—valid days and valid hours in the designated timezone—must simultaneously be satisfied for the IAM role permissions to be granted.Europe/Berlin).Using request.time.getHours("Europe/Berlin") <= 16 correctly closes access at 4:59:59 PM, avoiding the common error of specifying <= 17, which would inadvertently allow access through 5:59:59 PM.
Answer them yourself and get your score the moment you finish. No account needed.
Full access includes
Keep the momentum going with these hand-picked practice scenarios
Last updated Validated