Page MenuHomePhabricator

Prevent enormous changes from being pushed to repositoires by default
ClosedPublic

Authored by epriestley on Dec 26 2017, 7:10 PM.
Tags
None
Referenced Files
F13084802: D18850.diff
Wed, Apr 24, 11:24 PM
Unknown Object (File)
Fri, Apr 19, 7:03 PM
Unknown Object (File)
Mon, Apr 15, 12:21 PM
Unknown Object (File)
Mon, Apr 15, 9:21 AM
Unknown Object (File)
Thu, Apr 11, 9:12 PM
Unknown Object (File)
Wed, Apr 10, 7:44 PM
Unknown Object (File)
Mon, Apr 1, 5:37 AM
Unknown Object (File)
Sun, Mar 31, 4:11 AM
Subscribers

Details

Summary

Fixes T13031. "Enormous" changes are basically changes which are too large to hold in memory, although the actual definition we use today is "more than 1GB of change text or git diff runs for more than 15 minutes".

If an install configures a Herald content rule like "when content matches /XYZ/, do something" and then a user pushes a 30 GB source file, we can't put it into memory to preg_match() it. Currently, the way to handle this case is to write a separate Herald rule that rejects enormous changes. However, this isn't obvious and means the default behavior is unsafe.

Make the default behavior safe by rejecting these changes with a message, similar to how we reject "dangerous" changes (which permanently delete or overwrite history) by default.

Also, change a couple of UI strings from "Enormous" to "Very Large" to reduce ambiguity. See https://discourse.phabricator-community.org/t/herald-enormous-check/822.

Test Plan

Changed the definition of "enormous" from 1GB to 1 byte. Pushed a change; got rejected. Allowed enormous changes, pushed, got rejected by a Herald rule. Disabled the Herald rule, pushed, got a clean push. Prevented enormous changes again. Grepped for "enormous" elsewhere in the UI.

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

amckinley added inline comments.
src/applications/diffusion/editor/DiffusionRepositoryEditEngine.php
321

"enormous"

This revision is now accepted and ready to land.Jan 2 2018, 7:09 PM
This revision was automatically updated to reflect the committed changes.