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
Unknown Object (File)
Sat, Jan 25, 5:42 AM
Unknown Object (File)
Tue, Jan 21, 9:01 AM
Unknown Object (File)
Sat, Jan 18, 12:54 AM
Unknown Object (File)
Thu, Jan 16, 11:26 PM
Unknown Object (File)
Fri, Jan 3, 2:20 PM
Unknown Object (File)
Dec 22 2024, 9:59 PM
Unknown Object (File)
Dec 13 2024, 7:10 AM
Unknown Object (File)
Dec 12 2024, 9:42 AM

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).