Page MenuHomePhabricator

Add a "touched paths" limit to repositories, limiting the maximum number of paths any commit may touch
ClosedPublic

Authored by epriestley on Mon, Nov 26, 1:43 PM.

Details

Summary

Depends on D19831. Ref T13216. See PHI908. Allegedly, a user copied a large repository into itself and then pushed it. Great backup strategy, but it can create headaches for administrators.

Allow a "maximum paths you can touch with one commit" limit to be configured, to make it harder for users to make this push this kind of commit by accident.

If you actually intended to do this, you can work around this by breaking your commit into pieces (or temporarily removing the limit). This isn't a security/policy sort of option, it's just a guard against silly mistakes.

Test Plan

Set limit to 2, tried to push 3 files, got rejected. Raised limit, pushed changes successfully.

Diff Detail

Repository
rP Phabricator
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

epriestley created this revision.Mon, Nov 26, 1:43 PM
epriestley requested review of this revision.Mon, Nov 26, 1:44 PM
epriestley updated this revision to Diff 47368.Mon, Nov 26, 1:50 PM
  • Separate the "touch" and "filesize" code a bit better and give "Touches Too Many Paths" its own reject code.
amckinley accepted this revision.Wed, Nov 28, 6:40 PM
amckinley added inline comments.
src/applications/diffusion/engine/DiffusionCommitHookEngine.php
1326

Oh this is neat. Never would have imagined this code would get reused! I guess it's not worth fiddling with this to skip the work of computing the file sizes since the vast majority of commits are reasonably-sized anyway.

1329–1335

Consistency between "affects" and "touches".

1347

Oh, and we're caching the result so we only do this work once anyway.

src/applications/diffusion/management/DiffusionRepositoryLimitsManagementPanel.php
41

touchedPathsLimit?

This revision is now accepted and ready to land.Wed, Nov 28, 6:40 PM
This revision was automatically updated to reflect the committed changes.