Giter Club home page Giter Club logo

wp-ignitor's Introduction

WP IGNITOR

WordPress Plugin: Requires at least WordPress Plugin: Tested up to WordPress Plugin Version WordPress Plugin: Requires PHP WordPress Plugin Downloads WordPress Plugin Active Installs License

DescriptionInstallationContributorsLicense

Description

All sites created with WordPress have the same file and directory structure, and the database table structure is simple. So it's easy to imagine that it's a website that is fairly easy to attack from the attacker. This plugin doesn't easily make visitors aware that your site is written in WordPress and provides robust performance in terms of security. In addition, it retains the versatility of being able to track updates such as cores and plugins as usual.

By using this plugin, we can easily perform troublesome server-side access restrictions and maintenance of various configuration files as likes above from the admin panel.

Main plugin features:

  • Move WordPress installation directory
  • Update and move wp-config.php
  • .htaccess maintenance
  • Cleanup HTML that output by WordPress
  • Control behavior each route of WP REST API
  • Set up a new login page URL
  • Restricted access to login page

Let's get rid of our tedious configuration work right away and ignite the launch of the site!

Installation

  1. From the WP admin panel, click "Plugins" -> "Add new".
  2. In the browser input box, type "WP Ignitor".
  3. Select the "WP Ignitor" plugin and click “Install”.

1, 2, 3: You're done!

Contributors

Ka2 (Katsuhiko Maeno)

If you liked using this app or it has helped you in any way, I'd like you send me an email at [email protected] about anything you'd want to say about this software. I'd really appreciate it!

Copyright and license

Code and documentation copyright 2020 the ka2. Code released under the GPL v2 or later.

wp-ignitor's People

Contributors

ka215 avatar

Watchers

 avatar  avatar

wp-ignitor's Issues

Data Must be Sanitized, Escaped, and Validated

When you include POST/GET/REQUEST/FILE calls in your plugin, it's important to sanitize, validate, and escape them. The goal here is to prevent a user from accidentally sending trash data through the system, as well as protecting them from potential security issues.

SANITIZE: Data that is input (either by a user or automatically) must be sanitized as soon as possible. This lessens the possibility of XSS vulnerabilities and MITM attacks where posted data is subverted.

VALIDATE: All data should be validated, no matter what. Even when you sanitize, remember that you don’t want someone putting in ‘dog’ when the only valid values are numbers.

ESCAPE: Data that is output must be escaped properly when it is echo'd, so it can't hijack admin screens. There are many esc_*() functions you can use to make sure you don't show people the wrong data.

To help you with this, WordPress comes with a number of sanitization and escaping functions. You can read about those here:

https://developer.wordpress.org/plugins/security/securing-input/
https://developer.wordpress.org/plugins/security/securing-output/

Remember: You must use the most appropriate functions for the context. If you’re sanitizing email, use sanitize_email(), if you’re outputting HTML, use esc_html(), and so on.

An easy mantra here is this:

Sanitize early
Escape Late
Always Validate

Clean everything, check everything, escape everything, and never trust the users to always have input sane data. After all, users come from all walks of life.

Example(s) from your plugin:

wp-ignitor-1.0.0-beta.2/src/admin.php:98: $_page = (string)filter_var( $_REQUEST['page'] ?? '', FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_BACKTICK | FILTER_FLAG_STRIP_HIGH );
wp-ignitor-1.0.0-beta.2/src/admin.php:488: 'current_tab' => (string)filter_var( $_REQUEST['tab'] ?? 'globals', FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_BACKTICK | FILTER_FLAG_STRIP_HIGH ),

We ask you use the sanitize functions from WordPress rather than filter_var, as the former is built for use with WordPress specifically and can account for it's usecases.

Using CURL Instead of HTTP API

WordPress comes with an extensive HTTP API that should be used instead of creating your own curl calls. It’s both faster and more extensive. It’ll fall back to curl if it has to, but it’ll use a lot of WordPress’ native functionality first.

https://developer.wordpress.org/plugins/http-api/

Please note: If you're using CURL in 3rd party vendor libraries, that's permitted. It's in your own code unique to this plugin (or any dedicated WordPress libraries) that we need it corrected.

Example(s) from your plugin:

wp-ignitor-1.0.0-beta.2/src/utils.php:198: $raw_html = curl_exec( $ch );

Should remove those fallbacks that using file_get_contents

This is not actually going to work:

        $raw_html = wp_remote_retrieve_body( wp_remote_request( $get_uri ) );
        if ( ! $raw_html ) {
            if ( preg_match( '@^https://@', $get_uri ) == 1 ) {
                $options = stream_context_create([
                    'ssl' => [
                        'verify_peer' => false,
                        'verify_peer_name' => false,
                    ]
                ]);
                $raw_html = file_get_contents( $get_uri, false, $options );
            } else {
                $raw_html = file_get_contents( $get_uri, false );
            }

Many hosts block the use of file_get_contents on remote content. This is a security measure that we fully endorse.

The HTTP API you already included is far more reliable. You should remove those fallbacks.

Calling core loading files directly

Including wp-config.php, wp-blog-header.php, wp-load.php directly via an include is not permitted.

These calls are prone to failure as not all WordPress installs have the exact same file structure. In addition it opens your plugin to security issues, as WordPress can be easily tricked into running code in an unauthenticated manner.

Your code should always exist in functions and be called by action hooks. This is true even if you need code to exist outside of WordPress. Code should only be accessible to people who are logged in and authorized, if it needs that kind of access. Your plugin's pages should be called via the dashboard like all the other settings panels, and in that way, they'll always have access to WordPress functions.

https://developer.wordpress.org/plugins/hooks/

If you need to have a ‘page’ accessed directly by an external service, you should use query_vars and/or rewrite rules to create a virtual page which calls a function.

https://developer.wordpress.org/reference/hooks/query_vars/
https://codepen.io/the_ruther4d/post/custom-query-string-vars-in-wordpress

If you're trying to use AJAX, please read this:

https://developer.wordpress.org/plugins/javascript/ajax/

Example(s) from your plugin:

wp-ignitor-1.0.0-beta.2/views/entrance.php:24: require_once $core_files['wp-load.php'];

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.