Skip to content

About

Expression Lab is a sandboxed diagnostics and data inspection plugin for WordPress.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

216 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Expression Lab Logo

Expression Lab

A Jupyter-like notebook interface and declarative DSL for WordPress.

Code Style (WPCS) PHPUnit Test Matrix Jest Tests PHP 8.4 to 8.5 WordPress 6.4+ Multisite Supported License: EULA / GPL-2.0-or-later


Expression Lab is an in-browser, Jupyter-like notebook interface and diagnostics plugin for WordPress. Powered by a declarative Domain-Specific Language (DSL), it lets you inspect posts, options, database tables, caches, HTTP requests, and files-and visualize results with Vega-Lite charts-without writing raw PHP snippets or using eval().

Key capabilities include multi-cell interactive notebooks and a scratchpad mode, visual query and HTTP request builders, in-memory SQLite analytics (Database.mirror()), a filesystem inspector, and encrypted .elab notebook storage (Professional Edition).


Security Pillars

Expression Lab is built around four core security pillars to protect your WordPress environment:

  • Declarative AST Sandbox: Expressions are parsed and evaluated through an isolated Abstract Syntax Tree (AST) engine based on Symfony Expression Language, preventing arbitrary PHP code execution.
  • Client-Side Cryptography: Authentication uses browser-derived ephemeral Ed25519 keys to sign every request. Master passphrases, private keys, and credentials are never stored in the WordPress database.
  • Operational Boundaries: Database operations default to read-only access with in-memory SQLite mirroring, filesystem access enforces path canonicalization, and a CPU watchdog enforces execution time limits.
  • Isolated UI & Auditability: The notebook interface runs inside a sandboxed iframe with a null origin, and actions are recorded in a built-in audit log.

Note

Expression Lab has not undergone a formal security audit by an independent third-party security firm. For details on the threat model and boundary limits, see the Security Model documentation.


The DSL at a Glance

Fluent Entity Queries

/* Query the latest 5 published posts */
Posts.where('post_type', 'post')
  .where('post_status', 'publish')
  .order_by('post_date', 'DESC')
  .limit(5)
  .get()
/* Inspect user details and capabilities */
Users.get('anderson')
/* Inspect registered cron schedules */
Options.get('cron')

In-Memory SQLite Analytics

Database.mirror('posts', { 'post_author': 1 }, { 'limit': 100 })
  .query('
    SELECT 
      (SELECT count(*) FROM wp_posts WHERE post_status = "publish") published,
      (SELECT count(*) FROM wp_posts WHERE post_status = "draft") drafts,
      (SELECT count(*) FROM wp_posts WHERE post_status = "trash") trashed
  ')

Functional Pipeline Operations

prog[
  set[
    'posts',
    Database.mirror('posts', { 'post_status': 'publish' }, { 'limit': 5 })
      .query('SELECT ID, post_title, comment_count FROM wp_posts')
  ],
  map[
    var['posts'],
    fn[
      ['item'],
      'Post #' ~ args['item']['ID'] 
        ~ ': "' ~ args['item']['post_title'] 
        ~ '" (' ~ args['item']['comment_count'] ~ ' comments)'
    ]
  ]
]

System Requirements

Component Requirement Note
PHP 8.4 – 8.5 Tested against PHP 8.4 and 8.5
WordPress 6.4+ Tested on modern WordPress releases and Core trunk
PHP Extensions sodium, sqlite3 sodium for Ed25519 signature verification; sqlite3 for in-memory database mirroring
Environment Single-site & Multisite Automated tests run against both configurations
Browser Modern Chromium, Firefox, or Safari Requires native Web Crypto API and WebAssembly support

Installation & Setup

1. Installation

Pre-built ZIP Archive - Professional Edition (Recommended)

Pre-built release packages compiled by the repository's CI/CD pipeline are distributed as .zip archives via GitHub Releases. These releases ship Expression Lab Professional Edition (governed by the EULA) with bundled frontend assets and scoped dependencies, installable via Plugins → Add New Plugin → Upload Plugin in WordPress.

From Source - Community Edition (Development)

To build the Community Edition from source:

  1. Clone the repository into wp-content/plugins:
    cd wp-content/plugins
    git clone https://github.com/andersonsalas/expressionlab.git
    cd expressionlab
  2. Install PHP dependencies:
    composer install
    (For a build without development tooling, use composer install --no-dev --optimize-autoloader.)
  3. Install JavaScript dependencies and compile frontend assets:
    pnpm install
    pnpm run build

2. Configuration

  1. Navigate to Tools → Expression Lab in the WordPress administration dashboard as an administrator.
  2. Complete the onboarding wizard by defining a master passphrase.
  3. Append the generated constants to wp-config.php:
define( 'EXPRESSION_LAB_ADMIN_USER_ID', 1 );
define( 'EXPRESSION_LAB_ADMIN_PUBLIC_KEY', 'your_hex_encoded_public_key' );
define( 'EXPRESSION_LAB_ADMIN_SALT', 'your_unique_salt' );
  1. Reload the administration interface.

Development & Tooling

# Linting (PHPCS, ESLint, Stylelint)
pnpm run lint

# Automated Tests
pnpm run test:php       # PHPUnit (Single-site)
pnpm run test:php:ms    # PHPUnit (Multisite)
pnpm run test:php:all   # PHPUnit (Single-site + Multisite)
pnpm run test:js        # Jest (Frontend)

# Frontend Builds
pnpm run dev            # Development build
pnpm run watch          # Incremental watch mode
pnpm run dev-server     # Webpack Encore dev server (HMR)
pnpm run build          # Production minified bundle

Tip

Frontend Hot Reload: Because the sandboxed iframe blocks localStorage access, disable the iframe sandbox in wp-config.php during local UI development (define( 'EXPRESSION_LAB_SANDBOX_ENABLED', false );) and keep it enabled otherwise.

Documentation (Docusaurus)

pnpm run docs:dev       # Start local docs server (English)
pnpm run docs:dev:es    # Start local docs server (Spanish)
pnpm run docs:build     # Build static docs
pnpm run docs:serve     # Preview built docs

Documentation

Full guides and API references are available at docs.expressionlab.io (Español):


Contributing & Security Inquiries

  • Contributing: See CONTRIBUTING.md and CODE_OF_CONDUCT.md. Working branches (fix/*, improve/*, feature/*) target master via Pull Requests and must pass pnpm run lint and pnpm run test.
  • Security Inquiries: Do not report vulnerabilities via public issues. See SECURITY.md or submit reports via GitHub Security Advisories or github@andersonsalas.com.

License

About

Expression Lab is a sandboxed diagnostics and data inspection plugin for WordPress.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages