Forum Replies Created

Viewing 15 replies - 1 through 15 (of 25 total)
  • Thread Starter danpowellbvm

    (@danpowellbvm)

    I found a temporary fix.

    • Copy the below code into a text editor
    • Save the file as block-verification.php
    • Upload to WP Plugins directory
    • Activate the plugin in WP Admin

    The plugin blocks dropboxusercontent links and thinkupverification scripts

    <?php
    /**

    Plugin Name: Block External Scripts and Connections

    Description: Blocks specified scripts, network connections, and references to external domains on both frontend and backend.

    Version: 1.2

    Author: Your Name
    */

    if (!defined('ABSPATH')) {
    exit; // Exit if accessed directly.
    }

    class BlockExternalScripts {

    public function __construct() {
    // Block scripts on the frontend.
    add_action('wp_enqueue_scripts', [$this, 'block_scripts'], 9999);

    // Block scripts in the backend.
    add_action('admin_enqueue_scripts', [$this, 'block_scripts'], 9999);

    // Block external HTTP requests for all requests.
    add_filter('http_request_host_is_external', [$this, 'block_external_requests'], 10, 3);

    // Disable DNS prefetching for specified domains on frontend.
    add_filter('wp_resource_hints', [$this, 'remove_dns_prefetch'], 10, 2);

    // Filter database content output on both frontend and backend.
    add_filter('the_content', [$this, 'filter_database_content']);
    add_filter('the_excerpt', [$this, 'filter_database_content']);
    add_filter('widget_text', [$this, 'filter_database_content']);
    add_filter('editor_content', [$this, 'filter_database_content'], 10); // For the block editor.
    add_filter('admin_post_thumbnail_html', [$this, 'filter_database_content']); // Featured image HTML.

    // Block themes from referencing the domains.
    add_action('after_setup_theme', [$this, 'block_theme_references']);
    }

    /**
    * Block specific scripts from being enqueued.
    */
    public function block_scripts() {
    wp_dequeue_script('thinkupverification-js');
    wp_deregister_script('thinkupverification-js');

    wp_dequeue_script('thinkupverification');
    wp_deregister_script('thinkupverification');
    }

    /**
    * Block external HTTP requests to specific domains.
    *
    * @param bool $is_external Whether the host is external.
    * @param string $host The hostname.
    * @param string $url The full URL.
    * @return bool False if the request should be blocked.
    */
    public function block_external_requests($is_external, $host, $url) {
    $blocked_domains = [
    'dl.dropboxusercontent.com',
    'dropboxusercontent.com'
    ];

    if (in_array($host, $blocked_domains, true)) {
    return false;
    }

    return $is_external;
    }

    /**
    * Remove DNS prefetching for blocked domains.
    *
    * @param array $urls Array of resource hints.
    * @param string $relation_type The type of relation (e.g., 'dns-prefetch').
    * @return array Filtered resource hints.
    */
    public function remove_dns_prefetch($urls, $relation_type) {
    if ('dns-prefetch' === $relation_type) {
    $blocked_domains = [
    'dl.dropboxusercontent.com',
    'dropboxusercontent.com'
    ];

    foreach ($blocked_domains as $domain) {
    $prefetch_url = '//' . $domain;
    $key = array_search($prefetch_url, $urls);
    if (false !== $key) {
    unset($urls[$key]);
    }
    }
    }

    return $urls;
    }

    /**
    * Filter content from the database to remove references to blocked domains.
    *
    * @param string $content The post content or widget text.
    * @return string Filtered content.
    */
    public function filter_database_content($content) {
    $blocked_domains = [
    'dl.dropboxusercontent.com',
    'dropboxusercontent.com'
    ];

    foreach ($blocked_domains as $domain) {
    $content = str_replace($domain, '[blocked]', $content);
    }

    return $content;
    }

    /**
    * Block themes from referencing blocked domains.
    */
    public function block_theme_references() {
    add_filter('theme_mod_header_image', [$this, 'block_theme_mod_references']);
    add_filter('theme_mod_background_image', [$this, 'block_theme_mod_references']);
    }

    /**
    * Remove blocked domain references from theme mods.
    *
    * @param string $url The URL of the theme mod.
    * @return string Filtered URL.
    */
    public function block_theme_mod_references($url) {
    $blocked_domains = [
    'dl.dropboxusercontent.com',
    'dropboxusercontent.com'
    ];

    foreach ($blocked_domains as $domain) {
    if (strpos($url, $domain) !== false) {
    return ''; // Remove the reference entirely.
    }
    }

    return $url;
    }

    }

    new BlockExternalScripts();
    Thread Starter danpowellbvm

    (@danpowellbvm)

    I found a few more sites using their themes that have the same issue.

    https://aaanz.info/https://alante.quarternotesys.com/

    I also found this in the theme readme.txt.

    = 1.9.10

    - Fixed:   WooCommerce v3.5.1 compatible.

    - Removed: Fallback verification script re-enabled as false positive reports issue resolved.

    = 1.9.3

    - Fixed:   WooCommerce v3.4.2 compatible.

    - Removed: Fallback verification script disabled due to false positive reports.

    = 1.8.5

    - New:     Theme option added to disable page intro.

    - New:     Header image when assigned from theme options panel outputs image alt text.

    - Fixed:   Main header font family settings now also apply to sticky header.

    - Updated: Fallback verification script improved.

    = 1.7.1

    - New:     License verification script added to improve theme security.
    Thread Starter danpowellbvm

    (@danpowellbvm)

    Hi, thanks for the reply. The problem seems to have gone away. An hour ago I still had the problem (with Jetpack version 13.1.1 installed).

    After reading your last message, I wanted to check to see if it was another plugin causing the problem so I tried disabling all plugins (except Jetpack) and this time the problem went away.

    I enabled all plugins and the problem has not come back.

    Thanks for helping with the issue, I will close this thread and mark it as resolved. If the issue comes back, I’ll use the link you provided.

    Thanks

    Dan

    Thread Starter danpowellbvm

    (@danpowellbvm)

    Hi, thanks for the reply. Here’s a link to a screenshot of the errors.

    https://i.ibb.co/hZ9KxN0/Capture.png

    Thanks

    Dan

    Thread Starter danpowellbvm

    (@danpowellbvm)

    Hi, thanks for the reply. I’m still experiencing the issue.

    My site is https://www.bvm.co.uk/

    Thanks

    Thread Starter danpowellbvm

    (@danpowellbvm)

    V2.2.22 installed and working perfectly. Many thanks for fixing the issue so quick.

    thanks

    Dan

    Thread Starter danpowellbvm

    (@danpowellbvm)

    Its stopped working completely.

    The plugin says:

    19Thumbnails disabled

    9Thumbnails will be generated

    All 28 images are being generated.

    Normally resetting the settings fixes the issue. Today its completely stopped working.

    Thread Starter danpowellbvm

    (@danpowellbvm)

    HI, thanks for the reply. Sorry for the delay getting back to you.

    I checked the server and firewall settings and couldn’t get it working. I ended up temporarily changing to the MC4WP plugin.

    I’ll try your plugin again when I have some free time. If I have any issues, i’ll let you know.

    thanks

    Dan

    Thread Starter danpowellbvm

    (@danpowellbvm)

    Hi

    Thanks for the reply. I’ve double checked and and remote diagnostics is enabled.

    Im using Plesk as my webserver. I cant find where to add a rule to allow the webhook.

    Under “Firewall“, Add custom Rule, I can add ports and IP addresses.
    Under “Web Application Firewall (ModSecurity)” I can switch off rules using IDs and there is a “Regular expressions in rule messages” textbox.

    This morning I deleted then reinstalled the plugin. 153 products synced, then it stopped.

    I found this in the mod security log.

    (32)Broken pipe: mod_fcgid: ap_pass_brigade failed in handle_request_ipc function, referer: https://www.bvm.co.uk/wp-admin/admin.php?page=mailchimp-woocommerce&tab=sync

    thanks

    Dan

    Thread Starter danpowellbvm

    (@danpowellbvm)

    Hi, thanks for the reply. I’ve enabled remote diagnostics.

    thanks

    Dan

    Thread Starter danpowellbvm

    (@danpowellbvm)

    Hi Albert. Thanks for the reply. I will keep an eye our for the update.

    thanks

    Dan

    Thread Starter danpowellbvm

    (@danpowellbvm)

    Hi Dave, thanks for the reply.

    I’ll start updating my pages manually.

    Thread Starter danpowellbvm

    (@danpowellbvm)

    Hi, thanks for the reply. I disabled all plugins except Woocommerce and the problem went away. I could see the missing categories.

    I enabled plugins a few at a time, with all plugins re-activated the problem seems to have gone away.

    I will do some more testing over the weekend.

    thanks

    Dan

    Thread Starter danpowellbvm

    (@danpowellbvm)

    I’ve done some more testing.

    bvm.co.uk/category/dan-test (works perfect)
    bvm.co.uk/category/computers/dan-test (works perfect)
    bvm.co.uk/category/computers/panel-pcs/dan-test (works perfect)
    bvm.co.uk/category/computers/panel-pcs/all-panel-pcs/dan-test (doesnt show)

    bvm.co.uk/category/dan-testing (works)
    bvm.co.uk/category/computers/dan-testing (works)
    bvm.co.uk/category/computers/handheld-pcs-and-rugged-tablets/dan-testing (doesnt work)
    bvm.co.uk/category/computers/industrial-and-embedded-systems/dan-testing (works)
    bvm.co.uk/category/computers/industrial-and-embedded-systems/amd-solutions/dan-testing (doesn’t work)

    The handheld category has no sub categories, I cant add any new categories.
    The industrial and embedded system category already has sub categories, I can add new categories.

    Thread Starter danpowellbvm

    (@danpowellbvm)

    Hi

    The update fixed the problem.

    Many Thanks

    Dan

Viewing 15 replies - 1 through 15 (of 25 total)