@bostonuniversity/buwp-local 0.7.3 → 0.7.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/docs/CHANGELOG.md CHANGED
@@ -5,6 +5,12 @@ All notable changes to buwp-local will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.7.4]
9
+
10
+ ### Changed
11
+ - **Localhost-Only Port Binding for Database & Redis**
12
+ - Database and Redis services now bind to `127.0.0.1` instead of `0.0.0.0` for improved security and local development isolation
13
+
8
14
  ## [0.7.3]
9
15
 
10
16
  ### Added
package/docs/COMMANDS.md CHANGED
@@ -17,6 +17,7 @@ npx buwp-local init [options]
17
17
  - `--plugin` - Non-interactive: initialize as plugin project
18
18
  - `--mu-plugin` - Non-interactive: initialize as mu-plugin project
19
19
  - `--theme` - Non-interactive: initialize as theme project
20
+ - `--sandbox` - Non-interactive: initialize as sandbox project
20
21
  - `-f, --force` - Overwrite existing configuration file
21
22
 
22
23
  **Examples:**
@@ -28,13 +29,14 @@ npx buwp-local init
28
29
  npx buwp-local init --plugin
29
30
  npx buwp-local init --mu-plugin --force
30
31
  npx buwp-local init --theme --no-interactive
32
+ npx buwp-local init --sandbox --no-interactive
31
33
  ```
32
34
 
33
35
  **What it does:**
34
36
  - Creates `.buwp-local.json` configuration file
35
37
  - Auto-detects project type from directory structure
36
38
  - Generates hostname from directory name
37
- - Creates appropriate volume mappings for plugin/theme/mu-plugin types
39
+ - Creates appropriate volume mappings for plugin/theme/mu-plugin/sandbox types
38
40
  - Configures services (Redis, S3, Shibboleth)
39
41
  - Sets up port mappings
40
42
 
@@ -93,6 +93,8 @@ sudo bash -c 'echo "127.0.0.1 username-myproject.local" >> /etc/hosts'
93
93
 
94
94
  Replace `username-myproject.local` with the hostname you chose in step 4.
95
95
 
96
+ The `init` command will also display this command for you to run.
97
+
96
98
  ### 6. Start Your Environment
97
99
 
98
100
  Start the Docker containers:
package/docs/ROADMAP.md CHANGED
@@ -174,39 +174,55 @@ hostile.remove('127.0.0.1', config.hostname);
174
174
 
175
175
  ### Shipped in v0.7.3
176
176
 
177
- - **Job Watcher Command** 🚧
177
+ - **Job Watcher Command**
178
178
  - New `watch-jobs` command to periodically run `wp site-manager process-jobs`
179
- - Configurable polling interval (default: 5 minutes)
179
+ - Configurable polling interval (default: 60 seconds)
180
180
  - Runs as standalone process in terminal window
181
181
  - Timestamped output for job processing visibility
182
+ - True quiet mode for long-running background monitoring
182
183
  - Graceful shutdown (Ctrl+C)
183
184
 
184
185
  **Problem:** Production environments use cron/AWS EventBridge to automatically process site-manager jobs (content migration, deployments). Local developers currently must manually run `npx buwp-local wp site-manager process-jobs` to see queued jobs complete.
185
186
 
186
187
  **Solution:** Standalone `watch-jobs` command that runs indefinitely, polling for jobs at configurable intervals. Mirrors production behavior without requiring cron setup. Enables developers to use the site-manager web UI for content operations and see jobs complete automatically.
188
+
189
+ ### Shipped in v0.7.4
190
+
191
+ - **Localhost-Only Port Binding for Database & Redis** ✅
192
+ - Bind database (3306) and Redis (6379) ports to 127.0.0.1 only
193
+ - Prevents network exposure of confidential database content
194
+ - HTTP/HTTPS remain on all interfaces (0.0.0.0) for device testing
195
+ - Local database tools (TablePlus, Sequel Pro, etc.) still work perfectly
187
196
 
188
- **Implementation location:** `lib/commands/watch-jobs.js`
197
+ **Security Problem:** Default Docker port binding (`3306:3306`) exposes database on all network interfaces (0.0.0.0), including public WiFi. Confidential data accessible to anyone on the network.
189
198
 
190
- **Configuration support:**
191
- ```json
192
- {
193
- "jobWatchInterval": 60 // seconds, default 60 seconds
194
- }
195
- ```
199
+ **Solution:** Explicit localhost binding (`127.0.0.1:3306:3306`) restricts access to the laptop only. Network isolation provides defense-in-depth beyond password protection.
196
200
 
197
- **Command syntax:**
198
- ```bash
199
- buwp-local watch-jobs [--interval 200] [--quiet]
201
+ **Implementation:**
202
+ ```javascript
203
+ // Database - localhost only (network isolated)
204
+ ports: [`127.0.0.1:${config.ports.db}:3306`]
205
+
206
+ // Redis - localhost only (session data protected)
207
+ ports: [`127.0.0.1:${config.ports.redis}:6379`]
208
+
209
+ // HTTP/HTTPS - all interfaces (device testing enabled)
210
+ ports: [`${config.ports.http}:80`, `${config.ports.https}:443`]
200
211
  ```
201
212
 
202
- **Technical considerations:**
203
- - Requires WordPress container to be running
204
- - Uses `docker compose exec` to run WP-CLI command
205
- - Handles container stop/restart gracefully
206
- - Minimal resource usage (sleeps between checks)
207
- - Output includes timestamps for audit trail
213
+ **Benefits:**
214
+ - Coffee shop/airport WiFi cannot reach database
215
+ - Brute-force attacks prevented by network isolation
216
+ - Zero performance impact
217
+ - Industry best practice (matching Laravel Sail, wp-env)
208
218
 
209
- **Future enhancement (v0.8.0+):** If widely adopted, consider adding `--watch-jobs` flag to `start` command for automatic background execution.
219
+ **Breaking Change Note:** Existing projects will need `buwp-local update` or restart to apply new port bindings. Database access from phones/tablets/other computers will no longer work (rare use case).
220
+
221
+ ### Shipped in v0.7.5
222
+ - **Init Template updated with WP_ENVIRONMENT_TYPE** ✅
223
+ - New projects set `WP_ENVIRONMENT_TYPE=local` by default
224
+ - Provides standardized environment detection for plugins/themes
225
+ - Can be overridden to simulate staging/production if needed
210
226
 
211
227
  ### Potential Features
212
228
 
@@ -217,10 +233,10 @@ hostile.remove('127.0.0.1', config.hostname);
217
233
  - Commands to export credentials to JSON file
218
234
  - Useful for migrating between machines or sharing setup
219
235
 
220
- - **Database Security**
221
- - Check database access on db port (e.g. `localhost:3306`)
222
- - Consider more stringent default database passwords
223
- - The database can have restricted content in it, so we need to ensure that users are aware of this and take appropriate measures.
236
+ - **Advanced Port Binding Configuration**
237
+ - Optional config to override localhost-only binding for database/Redis
238
+ - For advanced users who need network access to services
239
+ - Example: `"portBindings": { "db": "0.0.0.0", "redis": "127.0.0.1" }`
224
240
 
225
241
  - **Xdebug Integration**
226
242
  - Command to help generate Xdebug configuration for IDEs (VSCode, Zed)
@@ -234,6 +250,10 @@ hostile.remove('127.0.0.1', config.hostname);
234
250
  - Multiplatform /etc/hosts hostname guide
235
251
  - Evaluate credential storage solutions for non-macOS platforms (https://www.npmjs.com/package/keytar)
236
252
 
253
+ - **Custom Docker Compose Overrides**
254
+ - Support for user-provided `docker-compose.override.yml` files
255
+ - Allows advanced users to customize services, add new ones, etc.
256
+
237
257
  - **Project Status & Listing**
238
258
  - Central tracking of all buwp-local projects in `~/.buwp-local/projects.json`
239
259
  - View all running projects: `buwp-local list`
@@ -262,6 +262,7 @@ async function initCommand(options) {
262
262
  mappings: [],
263
263
  env: {
264
264
  WP_DEBUG: true,
265
+ WP_ENVIRONMENT_TYPE: 'local',
265
266
  XDEBUG: answers.xdebug || false
266
267
  }
267
268
  };
@@ -66,7 +66,7 @@ function generateDbService(config, dbVolumeName) {
66
66
  MYSQL_PASSWORD: '${WORDPRESS_DB_PASSWORD:-password}',
67
67
  MYSQL_ROOT_PASSWORD: '${DB_ROOT_PASSWORD:-rootpassword}'
68
68
  },
69
- ports: [`${config.ports.db}:3306`],
69
+ ports: [`127.0.0.1:${config.ports.db}:3306`],
70
70
  networks: ['wp-network']
71
71
  };
72
72
  }
@@ -212,7 +212,7 @@ function generateRedisService(config) {
212
212
  return {
213
213
  image: 'redis:alpine',
214
214
  restart: 'always',
215
- ports: [`${config.ports.redis}:6379`],
215
+ ports: [`127.0.0.1:${config.ports.redis}:6379`],
216
216
  networks: ['wp-network']
217
217
  };
218
218
  }
package/lib/config.js CHANGED
@@ -228,6 +228,7 @@ function initConfig(projectPath = process.cwd(), options = {}) {
228
228
  mappings: [],
229
229
  env: {
230
230
  WP_DEBUG: true,
231
+ WP_ENVIRONMENT_TYPE: 'local',
231
232
  XDEBUG: false
232
233
  }
233
234
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bostonuniversity/buwp-local",
3
- "version": "0.7.3",
3
+ "version": "0.7.5",
4
4
  "description": "Local WordPress development environment for Boston University projects",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
package/readme.md CHANGED
@@ -113,3 +113,4 @@ Your local WordPress site should now be accessible at the hostname you configure
113
113
  - ✅ Smart initialization for plugins, themes, and mu-plugins
114
114
  - ✅ Volume mapping for live code sync
115
115
  - ✅ Xdebug support for step debugging
116
+ - ✅ WordPress environment detection (`WP_ENVIRONMENT_TYPE` set to `local`)