Geekzone: technology news, blogs, forums
Guest
Welcome Guest.
You haven't logged in yet. If you don't have an account you can register now.


martyyn

1971 posts

Uber Geek
+1 received by user: 772

ID Verified

#290717 30-Nov-2021 12:27
Send private message

I've recently inherited a website where the previous dev has created their own plugin. It was written a few years ago but the dev left, the site hasn't been updated and so it's over to me :)

 

The functions are grouped by relevance to each other in their own php files and included in the plugin's functions.php file which I assume is to keep the theme files clean.

 

Some of the code is simple shortcodes, some of it is manipulating their own mysql tables to store customer addresses and orders.

 

The code in each function is wrapped with:

 

 

function blah(){

 

if (is_user_logged_in()) {

 

ob_start();

 

global $wpdb;

 

  blah blah blah;

 

return ob_get_clean();

 

} else {
    echo "Not logged in";
    wp_redirect(home_url());
    exit;
}

 

}

 

 

And all the db interactions appear to be cleaned before actioned and it uses variables such as $querystr and $wpdb->insert etc.

 

The staff have their own WP users and log in via the Wordpress login page. They are directed to different pages depending on their roles. Some get to insert, update, delete, others just get to see custom reports to let them know what they are supposed to do on a given day.

 

So my question is, is that enough for it be considered secure (from both a WP and DB view) or should I be looking to add something else ?

 

[e] Got the wrong brackets for the BBCode, hopefully it's right now.


Create new topic
timmmay
20858 posts

Uber Geek
+1 received by user: 5350

Trusted
Lifetime subscriber

  #2821613 30-Nov-2021 13:12
Send private message

Nothing is really secure. Make sure you have excellent backups, which should be on a completely separate server / service from the website. I would put it behind a WAF given the risk of custom plugins that haven't been security reviewed. CloudFlare is fairly cheap but you have to pay for a plan to get WAF features.




wpcharged
18 posts

Geek
+1 received by user: 4


  #2821832 30-Nov-2021 16:59
Send private message

It's a bit tricky to say without seeing the actual code. If the values for the SQL statements are escaped and sanitized on output and only trusted users can register/login I wouldn't be too concerned about the previous developer's code.

 

It's unlikely custom code would be targeted by an attacker. Most hacks are from known vulnerabilities in public plugins, and scanning of other vulnerabilities such as SQL injection and XSS wouldn't hit that code you mentioned. 

 

It sounds like the site may not need to be public either? Search engine indexing could be disabled, if it isn't already, to help to prevent the site being found and scanned by malicious bots.


martyyn

1971 posts

Uber Geek
+1 received by user: 772

ID Verified

  #2821888 30-Nov-2021 17:10
Send private message

Thanks @wpcharged

 

Having looked through it more this afternoon, I'm happy with the sanitisation etc. All the functions ensure the user must be logged in before they do anything and all the db access is with $wpdb methods.

 

The code is currently part of their public facing site, so the first thing I said to them was I would split it and move this code to it's own server and hide it away.


Create new topic








Geekzone Live »

Try automatic live updates from Geekzone directly in your browser, without refreshing the page, with Geekzone Live now.



Are you subscribed to our RSS feed? You can download the latest headlines and summaries from our stories directly to your computer or smartphone by using a feed reader.