php / web-php

The www.php.net site
http://www.php.net
Other
835 stars 534 forks source link

Use HTTPS URL for event submission to main.php.net, match spam check expectation to web-master #1017

Closed iansltx closed 3 months ago

iansltx commented 3 months ago

Resolves #999 / GH-999

At some point in the past 12 years (this line was modified in the last 3 years but I doubt it got tested when modified) main.php.net started redirecting insecure HTTP to HTTPS, including for POSTs. The catch with those redirects is that POSTs won't get resubmitted when redirected, so when submitting an event the redirect would result in a GET with no parameters to the event submission endpoint, hence "Missing parameters." So event submission has been broken since main.php.net started redirecting HTTP to HTTPS.

Back in 2012 there was an attempt to switch this and other URLs to HTTPS, but it got rolled back because "there could be mirrors without ssl support." (see blame for the line this commit modifies). Since then, mirrors have been phased out, so we can safely assume we're calling HTTPS endpoints now (and that's the only way this will work anyway).

Verified by hitting the mentioned endpoint both on HTTP and HTTPS. HTTP gets redirected and fails due to missing parameters, HTTPS makes it through to the next step.

Additionally swaps the spam check value back to matching the web-master repo's expected value, as once the above was fixed that became the issue for calling the endpoint through this form. Optimizing for having only one repo needing to be fixed here rather than both this repo and the web-master one, hence not changing the expected antispam value there.

github-actions[bot] commented 3 months ago

🚀 Commit fadb53cb6d81f6f603e055d4e0edc5f425004576 Deployed on https://web-php-pr-1017.preview.thephp.foundation

iansltx commented 3 months ago

Verified in the preview environment by @tiffany-taylor

tiffany-taylor commented 3 months ago

I tested here https://web-php-pr-1017.preview.thephp.foundation/submit-event.php with dummy form data. First attempt, the spam check in event.php had caught my manual test. @iansltx modified the spam check and array order in submit-event.php, which enabled me to reach the form submission success message on my second manual test. As far as I can tell from testing on my phone, it seems correct.