Protected branches should set allow_force_push = false. Force push rewrites history on the protected branch, breaking downstream clones and bypassing the audit trail of merge-request reviews. Even Maintainers should not have force-push privilege on critical branches.
1. Go to project Settings > Repository > Protected branches. 2. For each protected branch, ensure Allowed to force push is empty (no roles selected). 3. Save changes.
{
"target": "GLProtectedBranch",
"if": {
"allOf": [
{
"resource": "GLProtectedBranch",
"property": "AllowForcePush",
"operator": "equals",
"value": false
}
]
},
"then": {
"effect": "Audit"
}
}
Copyright © DevOps Shield. All Rights Reserved. Privacy Policy | Cookie Policy | Terms and Conditions | v1.0.2