Page MenuHomePhabricator

Disable CSRF checks on Git push when updating repository.
ClosedPublic

Authored by hach-que on Nov 4 2013, 7:32 AM.
Tags
None
Referenced Files
F15482612: D7490.id16879.diff
Wed, Apr 9, 6:33 AM
F15480838: D7490.id.diff
Tue, Apr 8, 4:54 PM
F15480782: D7490.id.diff
Tue, Apr 8, 4:26 PM
F15478063: D7490.diff
Mon, Apr 7, 8:21 PM
F15433463: D7490.diff
Mon, Mar 24, 11:21 PM
F15432212: D7490.id.diff
Mon, Mar 24, 4:47 PM
F15384424: D7490.id16875.diff
Fri, Mar 14, 7:51 PM
F15352340: D7490.id.diff
Mon, Mar 10, 4:23 PM

Details

Summary

This disables CSRF checking around the $repository->writeStatusMessage so that pushing changes over HTTP to Git repositories doesn't fail miserably.

Test Plan

Applied this fix and I could git push to hosted repositories again.

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

A slightly better approach is:

$unguarded = AphrontWriteGuard::beginScopedUnguardedWrites();
// ...
unset($unguarded);

This does the right thing if the intervening code throws an exception. I'll tweak that in the pull. Thanks!

I also made a small change to populate:

'REMOTE_USER' => $viewer->getUsername(),

...since Git seemed cranky without it when I was testing the $unguarded flavor.

Closed by commit rP3e2efaf00e57 (authored by @hach-que, committed by @epriestley).