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
F18114059: D7490.id16879.diff
Wed, Aug 13, 3:35 AM
F18113502: D7490.id16875.diff
Wed, Aug 13, 2:25 AM
F18112758: D7490.id.diff
Tue, Aug 12, 8:21 PM
F18110743: D7490.diff
Mon, Aug 11, 11:27 PM
Unknown Object (File)
Jun 3 2025, 10:30 PM
Unknown Object (File)
May 7 2025, 7:02 PM
Unknown Object (File)
Apr 21 2025, 6:58 AM
Unknown Object (File)
Apr 19 2025, 5:22 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).