Giter Club home page Giter Club logo

soter-core's Issues

API response edge cases

Vulnerability 8958: The vulnerability was reported against the bbPress plugin but the fix came from WP core.

Since there is no "fixed in" version on the bbPress API response, this vulnerability will always be returned by the ->vulnerabilities_by_version() method.

Add support for v3 of the API

v3 requires an authorization token for all requests.

Not sure if support for v2 should be removed completely or support for both should be maintained...

Consider creating some sort of vulnerability collection class

Ref. ssnepenthe/soter#21.

If do_action() is called with an array containing a single object, that object is passed directly to callbacks instead of the array.

This leads to a situation where a listener can never be certain of the type of $vulnerabilities and must add extra checks.

So - it might be nice to have a collection object that can be used to wrap the array of vulnerabilities.

$this inside closure

array_map( function( array $vulnerability ) {
return new Vulnerability( $this->package, $vulnerability );
}, $data['vulnerabilities'] )

Is it even worth pretending to support PHP 5.3 at this point?

WP_Mock@dev-dev is required as a dev dependency - As of the latest commit to soter-core this put us at ~0.2.x which required PHP5.6+. Currently, it would pull ~0.3.x which requires PHP7+.

All that to say that it is unlikely this package will ever be properly tested below PHP5.6 going forward, and maybe not even below 7.0.

Alternatively - consider introducing a tool such as https://github.com/wimg/PHPCompatibility to avoid simple issues such as this in the future.

Consider dropping unnecessary interfaces

They are really only needed where you might want to create an alternate implementation for use outside of WordPress.

Keepers (and their likely implementations):

  • Package manager interface (wp, composer)
  • Http interface (wp, curl/requests lib?)
  • Cache interface (transients, file, etc)

Consider adding generic event interface

Instead of calling do_action() directly, add a generic event system that can be used outside of WordPress.

Something external like event and event dispatcher interfaces?

Or maybe just methods on the checker instance like add_post_check_callback() and do_post_check_callbacks()?

HTTP errors silently ignored/discarded

The WP_Http_Client class throws an exception in the event of a WP_Error response.

The Api_Client class catches this and converts it to an error Api_Response instance.

The Api_Response class provides a method for checking whether or not there is an error.

However - The Checker class calls $response->get_vulnerabilities_by_version() without checking for errors. In the event of an error, an empty array is returned.

So basically if the HTTP request fails, the checker is unaware and assumes that no vulnerabilities were detected.

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.