Page MenuHomePhabricator

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

Authored by epriestley on Nov 26 2018, 1:43 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Dec 22, 3:46 AM
Unknown Object (File)
Mon, Dec 16, 5:47 PM
Unknown Object (File)
Sat, Dec 7, 1:12 PM
Unknown Object (File)
Wed, Dec 4, 12:07 AM
Unknown Object (File)
Sun, Dec 1, 3:58 PM
Unknown Object (File)
Sun, Dec 1, 3:58 PM
Unknown Object (File)
Sun, Dec 1, 11:39 AM
Unknown Object (File)
Nov 19 2024, 10:23 PM
Subscribers
None

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
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

  • Separate the "touch" and "filesize" code a bit better and give "Touches Too Many Paths" its own reject code.
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.Nov 28 2018, 6:40 PM
This revision was automatically updated to reflect the committed changes.