Version: 1.0.0
Last Updated: 2025-12-28
Status: Active
📚 Complete Reference: This is a detailed validation guide. For quick commands, see QUICK-START.md
Related Documentation:
- Complete guide: DEVELOPMENT-GUIDELINES.md §8
- Pre-commit checklist: DEVELOPMENT-GUIDELINES.md §8.1
- Post-deploy checklist: DEVELOPMENT-GUIDELINES.md §8.3
- Permissions guide: PERMISSIONS-GUIDE.md
- Automation briefing: CODEX.md
This guide explains the validation checks performed on SecuBox modules during generation and before git push.
SecuBox uses a multi-layered validation approach:
Comprehensive validation for a single module during/after generation.
Usage:
./secubox-tools/validate-module-generation.sh luci-app-cdn-cache
Checks performed:
luci. prefix)Exit codes:
0 - All checks passed1 - Critical errors found (module should not be deployed)Validates all modules before allowing git push.
Usage:
# Automatic (via git hook):
git push # validation runs automatically
# Manual:
./secubox-tools/pre-push-validation.sh
Checks performed:
Exit codes:
0 - Push allowed1 - Push blocked (critical errors)Fast validation of all modules (existing tool).
Usage:
./secubox-tools/validate-modules.sh
See secubox-tools/README.md for details.
To enable automatic validation before git push:
./secubox-tools/install-git-hooks.sh
This creates a symbolic link from .git/hooks/pre-push to secubox-tools/pre-push-validation.sh.
Rule: The RPCD script filename MUST exactly match the ubus object name declared in JavaScript.
Why: LuCI’s RPC system looks for RPCD scripts by their filename. If the name doesn’t match, you get:
RPC call failed with error -32000: Object not foundCommand failed: Method not foundExample:
// JavaScript (htdocs/luci-static/resources/view/cdn-cache/overview.js)
var callStatus = rpc.declare({
object: 'luci.cdn-cache', // ← This must match RPCD filename
method: 'status'
});
# RPCD script filename MUST be:
root/usr/libexec/rpcd/luci.cdn-cache # ← Exactly 'luci.cdn-cache'
Common mistakes:
root/usr/libexec/rpcd/cdn-cache (missing luci. prefix)root/usr/libexec/rpcd/luci-cdn-cache (using dash instead of dot)root/usr/libexec/rpcd/cdn_cache (using underscore)Validation:
# Check naming:
./secubox-tools/validate-module-generation.sh luci-app-cdn-cache
# Look for:
# ✓ RPCD script follows naming convention (luci.* prefix)
# ✓ CRITICAL: RPCD script name matches ACL ubus object
Rule: Menu JSON path entries MUST correspond to actual view file paths.
Why: LuCI loads views based on the path in the menu. Wrong path = HTTP 404.
Example:
// Menu (root/usr/share/luci/menu.d/luci-app-netifyd-dashboard.json)
{
"action": {
"type": "view",
"path": "netifyd-dashboard/overview" // ← Must match file location
}
}
# View file MUST exist at:
htdocs/luci-static/resources/view/netifyd-dashboard/overview.js
# ↑ Same path as menu ↑
Common mistakes:
"path": "netifyd/overview" but file at view/netifyd-dashboard/overview.js"path": "overview" but file at view/netifyd-dashboard/overview.jsValidation:
# Check paths:
./secubox-tools/validate-module-generation.sh luci-app-netifyd-dashboard
# Look for:
# ✓ Menu path 'netifyd-dashboard/overview' → view file EXISTS
luci. PrefixRule: Every ubus object declaration must start with luci.
Why: Consistent naming convention for LuCI applications. ACL system expects it.
Example:
// ✅ Correct:
object: 'luci.cdn-cache'
object: 'luci.system-hub'
object: 'luci.wireguard-dashboard'
// ❌ Wrong:
object: 'cdn-cache' // Missing luci. prefix
object: 'systemhub' // Missing luci. prefix
Validation:
# Check convention:
./secubox-tools/validate-modules.sh
# Look for:
# ✓ ubus object 'luci.cdn-cache' follows naming convention
Use this checklist when generating a new module:
luci-app-<module-name>/root/usr/libexec/rpcd/luci.<module-name>chmod +x#!/bin/sh'use strict'; to all JS files./secubox-tools/validate-module-generation.sh luci-app-<module-name>
grep -r "object:" luci-app-<module-name>/htdocs --include="*.js"
ls -la luci-app-<module-name>/root/usr/libexec/rpcd/
# Names must match exactly
grep '"path":' luci-app-<module-name>/root/usr/share/luci/menu.d/*.json
ls -R luci-app-<module-name>/htdocs/luci-static/resources/view/
# Paths must align
grep 'case "$2"' luci-app-<module-name>/root/usr/libexec/rpcd/*
grep -A 20 '"ubus":' luci-app-<module-name>/root/usr/share/rpcd/acl.d/*.json
# All methods should be in ACL
./secubox-tools/validate-modules.sh
find luci-app-<module-name> -name "*.json" -exec python3 -m json.tool {} \; > /dev/null
shellcheck luci-app-<module-name>/root/usr/libexec/rpcd/*
git add luci-app-<module-name>
git commit -m "feat: implement <module-name> module
- Add RPCD backend with methods: status, get_*, set_*
- Create views for overview, settings, etc.
- Configure ACL permissions
- Add menu entries
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>"
git push
✗ ERROR: luci-app-cdn-cache: RPCD script 'cdn-cache' does NOT match ubus object 'luci.cdn-cache'
Fix:
cd luci-app-cdn-cache/root/usr/libexec/rpcd
mv cdn-cache luci.cdn-cache
✗ ERROR: luci-app-netifyd: Menu path 'netifyd/overview' → file NOT FOUND
Expected: htdocs/luci-static/resources/view/netifyd/overview.js
Fix Option 1: Update menu path to match file:
# Edit root/usr/share/luci/menu.d/luci-app-netifyd-dashboard.json
# Change: "path": "netifyd/overview"
# To: "path": "netifyd-dashboard/overview"
Fix Option 2: Move view file to match menu:
mv htdocs/luci-static/resources/view/netifyd-dashboard \
htdocs/luci-static/resources/view/netifyd
✗ ERROR: luci-app-cdn-cache: luci.cdn-cache is NOT executable
Fix:
chmod +x luci-app-cdn-cache/root/usr/libexec/rpcd/luci.cdn-cache
⚠ WARNING: luci-app-cdn-cache: Method 'get_stats' from RPCD not in ACL
Fix:
# Edit root/usr/share/rpcd/acl.d/luci-app-cdn-cache.json
# Add 'get_stats' to the read.ubus array:
{
"luci-app-cdn-cache": {
"read": {
"ubus": {
"luci.cdn-cache": ["status", "get_config", "get_stats"]
↑ Add here
}
}
}
}
✗ ERROR: luci-app-cdn-cache: acl.d JSON is INVALID - syntax error
Fix:
# Validate JSON:
python3 -m json.tool root/usr/share/rpcd/acl.d/luci-app-cdn-cache.json
# Common issues:
# - Missing comma between array elements
# - Trailing comma after last element
# - Unescaped quotes in strings
In rare cases, you may need to bypass validation:
# Skip pre-push validation:
git push --no-verify
# Skip module generation validation:
# (can't bypass - it's informational only)
⚠️ WARNING: Bypassing validation can lead to broken modules in production!
Add validation to your workflow:
name: Validate Modules
on: [push, pull_request]
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y python3 shellcheck
- name: Run module validation
run: |
chmod +x secubox-tools/validate-modules.sh
./secubox-tools/validate-modules.sh
- name: Run pre-push validation
run: |
chmod +x secubox-tools/pre-push-validation.sh
./secubox-tools/pre-push-validation.sh
./secubox-tools/validate-module-generation.sh luci-app-<module>
./secubox-tools/install-git-hooks.sh
Fix errors immediately - Don’t accumulate validation debt
Review warnings - They often indicate real issues
scp bin/packages/*/base/luci-app-*.ipk root@192.168.1.1:/tmp/
ssh root@192.168.1.1
opkg install /tmp/luci-app-*.ipk
/etc/init.d/rpcd restart
/etc/init.d/uhttpd restart
# Make sure scripts are executable:
chmod +x secubox-tools/*.sh
# Check dependencies:
which python3 # For JSON validation
which shellcheck # For shell script validation
# Check hook is installed:
ls -la .git/hooks/pre-push
# Reinstall hooks:
./secubox-tools/install-git-hooks.sh
If validation incorrectly reports an error, please report it:
If you encounter validation issues: