• Resolved supaiku

    (@supaiku)


    Hi there,

    I had a WPML translation post edit blocked by NinjaFirewall – this is generally great that it’s noticing and blocking something like that, except that I do want WPML servers to be able to update our page 🙂

    It seems I could whitelist this script using .htninja and this php:
    if (strpos($_SERVER[‘SCRIPT_FILENAME’], ‘/wp-json/wpml/’) !== FALSE) {
    return ‘ALLOW’;
    }

    But I’m not sure:
    1. If that’s really the best way
    2. How to make sure it’s really doing it (except, perhaps the absence of errors and functioning translation – BUT, it works some of the time, so it seems it wasn’t blocked all posts).

    Message about the blocked edit:

    NinjaFirewall has blocked an attempt to edit/create a post by a user
    who doesn’t have the right capabilities:

    Blog: [url]
    Username: Unauthenticated user
    Action: Attempt to edit a published post (ID: 40209)
    post_title: [el titulo en espanol]
    post_content: [blah blah blah psot content]…
    User IP: [WPML IP ADDRESS LISTED]
    SCRIPT_FILENAME: /nas/wp/www/sites/so4a/index.php
    REQUEST_URI: /wp-json/wpml/tm/v1/ate/jobs/receive/202
    Date: julio 3, 2020 @ 17:31:21 (UTC -0400)

    A PHP backtrace has been attached to this message for your convenience.

    This protection (and notification) can be turned off from
    NinjaFirewall “Firewall Policies” page.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author nintechnet

    (@nintechnet)

    This code should work:

    <?php
    if (strpos($_SERVER['SCRIPT_FILENAME'], '/wp-json/wpml/') !== FALSE) {
       define('NFW_UWL', true);
       return 'ALLOW';
    }
    

    The define('NFW_UWL', true); is mandatory here, it will whitelist the request for the plugin part of NinjaFirewall which handles this option (it isn’t handled by the firewall because it relies on the WordPress API).

    Thread Starter supaiku

    (@supaiku)

    Thank you so much! For the fantastic plugin and this little bit of info 🙂

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘WPML & NinjaFirewall’ is closed to new replies.