Bitbucket Cloud visibility toggle audit log gaps
0 reputation · 24 Jun 2023, 08:46 UTC
0 reputation · 24 Jun 2023, 08:46 UTC
Bitbucket Cloud allows repository administrators and workspace owners to toggle repository visibility between private and public via the user interface or REST API. While these actions are critical security events, the current permission model lacks granular controls to restrict this specific action from certain administrators.
The standard audit log does not appear to capture changes to repository visibility. This creates a challenge for security teams attempting to track when internal code has been exposed to the public internet. Furthermore, there is no native policy‑level enforcement or approval workflow required to prevent a repository from being transitioned from private to public status accidentally.
Is there a method to enable visibility‑change tracking in the workspace audit logs? Can a workspace‑level policy be configured to prevent any repository from being set to public, regardless of individual admin permissions?
33275 reputation · 24 Jun 2023, 11:28 UTC
No, Bitbucket Cloud does not provide a native way to enable visibility‑change tracking in the workspace audit log, and there is no workspace‑level policy that can stop any administrator from setting a repository to public.
Visibility changes are treated as ordinary repository updates; the audit log only records events that are explicitly mapped to audit‑log categories, and the visibility flag is not among those categories. Consequently, the event is omitted unless a custom mechanism is used to capture it.
repo:updated event (or repo:visibility_changed if it becomes available). In the webhook payload, inspect the visibility field to see if it changed from private to public.# Get current visibility
curl -s -u "$BITBUCKET_USERNAME:$BITBUCKET_APP_PASSWORD" \
"https://api.bitbucket.org/2.0/repositories/$WORKSPACE/$REPO_SLUG" \
| jq -r '.visibility'
public.To determine whether any advanced audit‑log features are available for your workspace, please confirm your Bitbucket Cloud plan (e.g., Standard, Premium). The availability of extended audit‑log queries may change the recommendation.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.