Repository navigation
Security Overview
tvranjes edited this page Jun 29, 2026
·
2 revisions
Bricklayer implements a defense-in-depth security model with multiple layers of protection for Magento installations.
Deploy-mode-aware defaults protect production environments:
| Category | Developer Mode | Production Mode |
|---|---|---|
Code execution (code-runner) |
Enabled | Hard-blocked (no override) |
| Destructive tools (delete, cancel) | Enabled | Disabled by default |
| Code generation | Enabled | Disabled by default |
| Read operations | Enabled | Enabled |
| Introspection tools | Enabled | Enabled |
Fail-closed behavior: When Magento bootstrap is unavailable, isProductionMode() returns true, blocking destructive tools by default rather than allowing them.
Every tool can be individually enabled or disabled in .bricklayer.json:
{
"tools": {
"product-delete": { "enabled": false },
"database-query": { "enabled": true, "max_rows": 50 }
}
}-
Read-only SQL — Only
SELECTstatements are accepted - Table validation — Table names are verified against actual database tables before use (prevents SQL injection)
-
Row limits — Configurable
max_rowsprevents unbounded result sets -
Sensitive path masking — Configuration values for
payment/*,carriers/*,oauth/*, and similar paths are masked in query results
The code-runner tool has multiple safeguards:
-
Read-only by default — Uses database transaction rollback unless
allow_write=true -
Blocked patterns — 9 dangerous PHP patterns are detected and rejected (e.g.,
exec(),system(),file_put_contents()) -
Path traversal protection —
realpath()boundary checks prevent file access outside the Magento root - No network access — External HTTP requests are blocked
- Timeout enforcement — Configurable max execution time (default: 30s)
- Hard-blocked in production — Cannot be enabled even with explicit configuration
- File overwrite detection — Existing files cause a conflict error instead of silent overwrite
-
Force parameter — Explicit
force=truerequired to overwrite existing files - Dry-run support — Preview generated files without writing to disk
- Production blocking — All code generation tools are blocked in production mode
-
Line limits —
max_linesconfig prevents reading unbounded log data -
Entry truncation —
max_entry_lengthparameter truncates long stack traces -
Sensitive data — Log content is returned as-is (no filtering) but access is controlled via
tools.log.enabled
{
"tools": {
"code-runner": { "enabled": false },
"database-query": { "enabled": false },
"product-delete": { "enabled": false },
"customer-delete": { "enabled": false },
"category-delete": { "enabled": false },
"generate-module": { "enabled": false },
"generate-model": { "enabled": false },
"generate-controller": { "enabled": false },
"generate-api": { "enabled": false }
}
}- Configuration — Per-tool enable/disable
- Code Runner — Execution safety details
- Database Tools — Query restrictions
Getting Started
Architecture
Tools Reference
- Overview (84 Tools)
- Introspection
- Catalog
- Orders
- Customers
- Database
- Logs & Diagnostics
- GraphQL
- Development
Configuration
Guidelines & Skills
Code Generation
Diagnostics
Security