Giter Club home page Giter Club logo

soter-command's Issues

Add new format for dislaying list of slugs

Plugin and theme commands accept a space-separated list of slugs.

To stick with the WP-CLI philosophy of "composability is always a good idea" it would be nice if bulk commands were able to output a list of vulnerable package slugs.

--format=ids already does something similar, but it is for vulnerability IDs and so is not useful in this particular case.

Maybe we could add a custom --format=slugs?

Alternatively - consider --format=porcelain or just--porcelain.

Of note - some of the core commands (like https://github.com/wp-cli/entity-command) allow for a --porcelain flag which just outputs the ID of the entity that is the subject of the command.

Consider adding config component

Could be stored in the options table or maybe better as a file under ~/.wp-cli.

Primary goal would be to allow user to override defaults for command options:

Would need add, remove, set and unset commands to go with it.

Consider implementing update command

Something like wp soter update-vulnerable - would be great for a system cron job to ensure any security issues are automatically addressed.

Then again, core already handles automatic security updates - maybe this is just wasted time?

An alternative might be to implement a list format or porcelain like in wp-cli/entity-command that just prints a list of slugs which could be piped to various update commands... The problem (at least as far as I can tell): there is no master command for updating everything so you would have to run once each for plugins, themes and core.

Consider adding command-specific post-check hooks

Similar to the hooks available in the soter plugin.

It would provide a simple way for plugins to perform custom actions (logging, mailing, etc.) based on the results of a check.

Or maybe the expectation should be that since we are running from the command line, results can already be piped elsewhere so there is no need for plugins to be able to extend...

Prepare/format datetime fields before output

Currently:

$ wp soter check-plugin contact-form-7 --format=yml --fields=title,created_at

---
-
  title: 'Contact Form 7 <= 3.7.1 - Security Bypass'
  created_at:
    date: 2014-08-01 10:59:06.000000
    timezone_type: 2
    timezone: Z
-
  title: 'Contact Form 7 <= 3.5.2 - File Upload Remote Code Execution'
  created_at:
    date: 2014-08-01 10:59:07.000000
    timezone_type: 2
    timezone: Z

$ wp soter check-plugin contact-form-7 --format=json --fields=title,created_at

[{"title":"Contact Form 7 <= 3.7.1 - Security Bypass","created_at":{"date":"2014-08-01 10:59:06.000000","timezone_type":2,"timezone":"Z"}},{"title":"Contact Form 7 <= 3.5.2 - File Upload Remote Code Execution","created_at":{"date":"2014-08-01 10:59:07.000000","timezone_type":2,"timezone":"Z"}}]

$ wp soter check-plugin contact-form-7 --format=csv --fields=title,created_at

title,created_at
"Contact Form 7 <= 3.7.1 - Security Bypass","{""date"":""2014-08-01 10:59:06.000000"",""timezone_type"":2,""timezone"":""Z""}"
"Contact Form 7 <= 3.5.2 - File Upload Remote Code Execution","{""date"":""2014-08-01 10:59:07.000000"",""timezone_type"":2,""timezone"":""Z""}"

Action not triggered when no vulns

->display_results() prints a success message and exits if there are no vulnerabilities.

Since soter_command_{$command}_results is triggered after results are displayed, it won't actually be triggered when there are no vulnerabilities.

Consider creating WP-CLI package manager implementation

Ex:

public function get_plugins( $ignored = [] ) {
    $plugins = WP_CLI::runcommand( 'plugin list --fields=name,version --format=json', [
        'parse' => 'json',
        'return' => true,
    ] );

    // Filter ignored.

    // Map to Soter_Core\Package instances.

    return $plugins;
}

Not sure there is much benefit here aside from staying within WP-CLI...

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.