Page MenuHomePhorge

newOAuth1Future doesn't set a User-Agent
Open, Needs TriagePublic

Description

It is good practice to always set a User-Agent.

While debugging why cloudflare was showing a captcha to Phorge, I realised it was because of lack of a captcha. I did exempt it from the rule but I don't see why a User-Agent shouldn't be added (and probably should be added to any other external http(s) requests)

Affected code is https://we.phorge.it/source/phorge/browse/master/src/applications/auth/adapter/PhutilOAuth1AuthAdapter.php;cb934602c2e8c7da4b1c15793fe2511fe47c108d$102?as=source&blame=off

Event Timeline

https://we.phorge.it/source/phorge/browse/master/src/applications/auth/adapter/PhutilGitHubAuthAdapter.php$57-58 uses a boring
$future->addHeader('User-Agent', __CLASS__); for this.

I wonder if both should use something like PhabricatorEnv::getEnvConfig('phabricator.base-uri'); instead.

That would probably be a better User-Agent