Skip to content

[Bug]: OneSignal intercepts POST requests from other plugins causing 403 error #392

@cortesfrau

Description

@cortesfrau

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:

  1. That it's a POST request
  2. 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

  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"

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

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions