Page MenuHomePhabricator

Reject dangerous changes in Git repositories by default
ClosedPublic

Authored by epriestley on Dec 3 2013, 4:24 PM.
Tags
None
Referenced Files
F18806284: D7689.id17360.diff
Sat, Oct 18, 6:44 PM
F18790409: D7689.id17367.diff
Wed, Oct 15, 2:14 PM
F18724848: D7689.id.diff
Sep 30 2025, 4:06 AM
F18621892: D7689.diff
Sep 15 2025, 9:50 AM
F18618944: D7689.diff
Sep 15 2025, 1:23 AM
F18583078: D7689.id.diff
Sep 11 2025, 9:25 AM
F18339470: D7689.diff
Aug 25 2025, 9:30 PM
F17921070: D7689.id17367.diff
Jul 30 2025, 4:46 AM
Tokens
"Piece of Eight" token, awarded by poop."The World Burns" token, awarded by bitglue."Mountain of Wealth" token, awarded by dctrwatson.

Details

Summary

Ref T4189. This adds a per-repository "dangerous changes" flag, which defaults to off. This flag must be enabled to do non-appending branch mutation (delete branches / rewrite history).

Test Plan

With flag on and off, performed various safe and dangerous pushes.

>>> orbital ~/repos/POEMS $ git push origin :blarp
remote: +---------------------------------------------------------------+
remote: |      * * * PUSH REJECTED BY EVIL DRAGON BUREAUCRATS * * *     |
remote: +---------------------------------------------------------------+
remote:             \
remote:              \                    ^    /^
remote:               \                  / \  // \
remote:                \   |\___/|      /   \//  .\
remote:                 \  /V  V  \__  /    //  | \ \           *----*
remote:                   /     /  \/_/    //   |  \  \          \   |
remote:                   @___@`    \/_   //    |   \   \         \/\ \
remote:                  0/0/|       \/_ //     |    \    \         \  \
remote:              0/0/0/0/|        \///      |     \     \       |  |
remote:           0/0/0/0/0/_|_ /   (  //       |      \     _\     |  /
remote:        0/0/0/0/0/0/`/,_ _ _/  ) ; -.    |    _ _\.-~       /   /
remote:                    ,-}        _      *-.|.-~-.           .~    ~
remote:   \     \__/        `/\      /                 ~-. _ .-~      /
remote:    \____(Oo)           *.   }            {                   /
remote:    (    (--)          .----~-.\        \-`                 .~
remote:    //__\\  \ DENIED!  ///.----..<        \             _ -~
remote:   //    \\               ///-._ _ _ _ _ _ _{^ - - - - ~
remote: 
remote: 
remote: DANGEROUS CHANGE: The change you're attempting to push deletes the branch 'blarp'.
remote: Dangerous change protection is enabled for this repository.
remote: Edit the repository configuration before making dangerous changes.
remote: 
To ssh://dweller@localhost/diffusion/POEMS/
 ! [remote rejected] blarp (pre-receive hook declined)
error: failed to push some refs to 'ssh://dweller@localhost/diffusion/POEMS/'

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped