What happened?
Bug: OneSignal intercepts POST requests from other plugins causing 403 error
Problem
OneSignal incorrectly intercepts POST requests from other plugins when they try to save options, causing the error "The link you followed has expired".
Location
File: v3/onesignal-admin/onesignal-admin.php (lines 30-54)
Function: onesignal_handle_settings_save()
Root Cause
The function is hooked to admin_init and executes for all POST requests. It only checks:
- That it's a POST request
- That the submit button text is "Save Settings"
It does NOT verify if the request comes from OneSignal's settings page, so it intercepts forms from other plugins that have the same button name.
Steps to Reproduce
- Activate OneSignal plugin
- Activate any other plugin with a "Save Settings" button
- Try to save options from the other plugin
- Error: "The link you followed has expired"
Expected Behavior
OneSignal should only process POST requests from its own settings page, not intercept requests from other plugins.
Solution
Add page verification before processing:
function onesignal_handle_settings_save() {
if (!isset($_SERVER['REQUEST_METHOD']) || $_SERVER['REQUEST_METHOD'] !== 'POST') {
return;
}
// MISSING CHECK: Verify we're on OneSignal's settings page
if (!isset($_GET['page']) || $_GET['page'] !== 'onesignal-admin-page.php') {
return;
}
if (!isset($_POST["submit"]) || $_POST["submit"] !== "Save Settings") {
return;
}
check_admin_referer('onesignal_v3_save_settings', 'onesignal_v3_settings_nonce');
// ... rest of code
}
Alternative: Check for OneSignal-specific fields before processing:
if (!isset($_POST['onesignal_app_id']) && !isset($_POST['onesignal_rest_api_key'])) {
return;
}
Impact
- Severity: High - Prevents other plugins from saving their options
- Affected Version: v3 (v2 doesn't have this issue)
- Frequency: 100% reproducible when another plugin has a "Save Settings" button
Wordpress version
6.0.2
OneSignal Plugin version
6.0.2
Steps to reproduce?
1. Activate OneSignal plugin
2. Activate any other plugin with a "Save Settings" button
3. Try to save options from the other plugin
4. **Error:** "The link you followed has expired"
What did you expect to happen?
OneSignal should only process POST requests from its own settings page, not intercept requests from other plugins.
Relevant log output
Code of Conduct
What happened?
Bug: OneSignal intercepts POST requests from other plugins causing 403 error
Problem
OneSignal incorrectly intercepts POST requests from other plugins when they try to save options, causing the error "The link you followed has expired".
Location
File:
v3/onesignal-admin/onesignal-admin.php(lines 30-54)Function:
onesignal_handle_settings_save()Root Cause
The function is hooked to
admin_initand executes for all POST requests. It only checks:It does NOT verify if the request comes from OneSignal's settings page, so it intercepts forms from other plugins that have the same button name.
Steps to Reproduce
Expected Behavior
OneSignal should only process POST requests from its own settings page, not intercept requests from other plugins.
Solution
Add page verification before processing:
Alternative: Check for OneSignal-specific fields before processing:
Impact
Wordpress version
6.0.2
OneSignal Plugin version
6.0.2
Steps to reproduce?
What did you expect to happen?
OneSignal should only process POST requests from its own settings page, not intercept requests from other plugins.
Relevant log output
Code of Conduct