Commit Graph

689 Commits

Author SHA1 Message Date
4caf3c14bd feat: add module generation validation and pre-push hooks
Comprehensive validation tooling for SecuBox module generation and git workflow.

New Tools:
-----------

1. validate-module-generation.sh
   - Deep validation of single module during/after generation
   - Checks 9 categories: Makefile, RPCD, ACL, Menu, JS Views, UCI, Permissions, Security, Docs
   - Validates RPCD naming (luci.* prefix) vs JavaScript ubus objects
   - Validates menu paths vs actual view file locations
   - Cross-checks RPC methods between JavaScript and RPCD
   - Security scans for hardcoded credentials and dangerous commands
   - Exit codes: 0=pass, 1=critical errors

2. pre-push-validation.sh
   - Git pre-push hook that blocks push if critical errors found
   - Validates all modules before allowing remote push
   - Detects modified modules and runs comprehensive checks
   - Prevents deployment of broken modules
   - Can be bypassed with --no-verify (not recommended)

3. install-git-hooks.sh
   - One-command installation of git hooks
   - Creates symlink from .git/hooks/pre-push to pre-push-validation.sh
   - Enables automatic validation before every push

Documentation:
--------------

4. VALIDATION-GUIDE.md
   - Complete guide to validation workflow
   - Critical naming convention rules with examples
   - Module generation checklist (5 phases)
   - Common validation errors and fixes
   - Best practices and troubleshooting
   - CI/CD integration examples

Updated:
--------

5. secubox-tools/README.md
   - Added descriptions for new validation tools
   - Added recommended workflows for module generation and modification
   - Organized tools into categories (Validation, Maintenance)

Key Validation Rules Enforced:
-------------------------------

✓ RPCD script name MUST match ubus object name (exact match with luci. prefix)
  Example: object: 'luci.cdn-cache' → file: luci.cdn-cache

✓ Menu paths MUST match view file locations (prevent HTTP 404)
  Example: "path": "cdn-cache/overview" → view/cdn-cache/overview.js

✓ All ubus objects MUST use luci.* prefix
   'luci.cdn-cache'  'cdn-cache'

✓ ACL permissions MUST cover all RPCD methods

✓ JavaScript RPC method calls MUST exist in RPCD implementation

✓ RPCD scripts MUST be executable (chmod +x)

✓ All JSON files MUST have valid syntax

✓ Security: No hardcoded credentials or dangerous commands

Benefits:
---------

- Prevents RPC errors (-32000: Object not found)
- Prevents HTTP 404 errors (view files not found)
- Catches naming mismatches before deployment
- Ensures ACL permissions are complete
- Enforces consistent naming conventions
- Blocks broken modules from being pushed
- Provides detailed error messages with fix suggestions

Usage:
------

# Validate new/modified module:
./secubox-tools/validate-module-generation.sh luci-app-cdn-cache

# Install git hooks (one-time):
./secubox-tools/install-git-hooks.sh

# After installation, validation runs automatically:
git push  # Pre-push validation blocks if errors found

# Manual pre-push validation:
./secubox-tools/pre-push-validation.sh

See VALIDATION-GUIDE.md for complete documentation and workflows.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-24 10:06:20 +01:00
92f3318729 feat: add comprehensive module validation tooling
Add validate-modules.sh script that validates critical naming conventions
and module structure to prevent common RPC and HTTP 404 errors.

New validation checks:
- RPCD script names must match ubus object names (luci.* prefix)
- Menu paths must match view file locations
- View files must have corresponding menu entries
- RPCD scripts must be executable
- JSON files must have valid syntax
- ubus objects must follow naming convention

Updated CLAUDE.md documentation with:
- Critical naming conventions section with examples
- Common error patterns and solutions
- Updated development workflow to include validation
- Enhanced troubleshooting guide for RPC and 404 errors
- Updated package structure diagram with correct RPCD naming

Added secubox-tools/README.md:
- Detailed usage instructions for validation script
- Common fixes for naming issues
- CI/CD integration examples
- Quick reference for critical naming rules

This tooling prevents deployment of modules with naming mismatches that
cause runtime errors like:
- RPC call failed with error -32000: Object not found
- HTTP error 404 while loading view files

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-24 09:56:42 +01:00
16ad6d6a43 fix: rename all RPCD scripts to match ubus object names
All RPCD scripts must use the 'luci.' prefix to match their JavaScript
ubus object declarations. This fixes RPC errors like:
- "RPC call to luci.cdn-cache/status failed with error -32000: Object not found"

Renamed RPCD scripts:
- cdn-cache → luci.cdn-cache
- client-guardian → luci.client-guardian
- crowdsec → luci.crowdsec-dashboard
- netdata → luci.netdata-dashboard
- netifyd-dashboard → luci.netifyd-dashboard
- network-modes → luci.network-modes
- system-hub → luci.system-hub
- wireguard-dashboard → luci.wireguard-dashboard

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-24 09:51:45 +01:00
73e28cd806 fix: correct view paths in all dashboard module menus
Tous les modules dashboard pointaient vers des chemins incorrects:
- crowdsec/overview → crowdsec-dashboard/overview
- netdata/dashboard → netdata-dashboard/dashboard
- netifyd/overview → netifyd-dashboard/overview
- wireguard/overview → wireguard-dashboard/overview

Les fichiers JS sont dans {module}-dashboard/ mais les menus pointaient
vers {module}/, causant des erreurs HTTP 404.

Modules corrigés:
- luci-app-crowdsec-dashboard (5 vues)
- luci-app-netdata-dashboard (2 vues)
- luci-app-netifyd-dashboard (4 vues)
- luci-app-wireguard-dashboard (4 vues)

Fixes: NetworkError HTTP 404 pour tous les dashboards
2025-12-24 09:30:46 +01:00
f83203de60 fix: rename RPCD script to luci.secubox to match ubus object name
Le fichier RPCD 'secubox' a été renommé en 'luci.secubox' pour correspondre
au nom d'objet ubus utilisé par l'API JavaScript (object: 'luci.secubox').

Cela permet aux appels ubus comme 'ubus call luci.secubox get_dashboard_data'
de fonctionner correctement.

Fixes: Method not found error for all luci.secubox/* methods
2025-12-24 09:27:43 +01:00
4e23037a22 feat: implement network mode switcher with rollback protection
Implémente un switcher de mode réseau complet avec 4 modes:
- Router: NAT, DHCP server, firewall (default)
- Access Point: Bridge mode, no NAT, DHCP client
- Repeater: WiFi client + AP relay with optimizations
- Bridge: Pure L2 bridge, DHCP client

Nouvelles méthodes RPCD:
- get_current_mode: Détails du mode actif avec statut rollback
- get_available_modes: Liste des modes avec features
- set_mode: Préparer le changement de mode
- preview_changes: Prévisualiser les modifications
- apply_mode: Appliquer avec reconfiguration réseau complète
- confirm_mode: Confirmer et annuler le timer de rollback
- rollback: Restaurer la configuration précédente

Sécurité:
- Backup automatique avant changement
- Rollback automatique après 2 minutes sans confirmation
- Timer affiché en temps réel dans l'interface
- Restauration complète de network/wireless/firewall/dhcp

Vue wizard.js:
- Cards interactives pour chaque mode avec icônes
- Preview des changements avant application
- Progress bar et instructions post-switch
- Polling du timer de rollback
- Boutons de confirmation et rollback manuel

ACL mis à jour pour toutes les nouvelles méthodes.
2025-12-24 00:45:19 +01:00
5bd25d9b8e fix: improve feed update error handling and validation
Major improvements to feed management across all workflows:

1. **build-openwrt-packages.yml:**
   - Removed 'base' feed (not needed for SDK)
   - Added comprehensive error handling with retry logic
   - Verify feed directories exist after update
   - Fail fast if feeds don't update successfully
   - Log feed update/install output for debugging

2. **build-secubox-images.yml & test-validate.yml:**
   - Added feed verification after update/install
   - Capture logs for debugging feed issues
   - Exit with error if critical feeds missing
   - Show feed directory sizes for verification

Key changes:
- Feeds are now validated to exist before continuing
- Better error messages when feeds fail to update
- Logs captured for troubleshooting
- Workflow fails immediately if feeds missing

This should fix the 'find: feeds/packages: No such file or directory'
error by ensuring feeds are actually cloned successfully.
2025-12-24 00:37:12 +01:00
2432001fcd fix: improve firmware image collection and diagnostics
Enhanced the firmware build workflow with better diagnostics:

1. Added directory listing before artifact collection to show what was built
2. Changed collection strategy to copy all files from target dir (excluding
   metadata like .ipk, .manifest, .json, .buildinfo)
3. Added warnings when no firmware images are found
4. Added file listing after successful builds to verify output
5. Show file sizes during collection

This should help identify why firmware artifacts might be missing:
- Shows exactly what files were generated
- Provides clear warnings if target directory is empty
- Helps debug firmware build issues

The new approach copies all firmware image files regardless of extension,
which is more robust than pattern matching specific file types.
2025-12-24 00:23:02 +01:00
fde352369a docs: add LuCI menu structure section to secubox README
Added comprehensive documentation about the SecuBox menu hierarchy:
- Visual tree representation of the complete menu structure
- Explanation of category parent menus
- Troubleshooting guide for menu visibility issues

This helps users understand how modules are organized in LuCI
and how to resolve common menu-related issues.
2025-12-24 00:20:17 +01:00
dd1b848e19 fix: add category parent menus for SecuBox modules
Added missing category parent menu entries that other SecuBox modules
depend on:
- admin/secubox/security (Security & Monitoring)
- admin/secubox/network (Network Management)
- admin/secubox/system (System & Performance)

Without these parent menus, individual modules like crowdsec, network-modes,
and system-hub couldn't register their menu entries under admin/secubox/*/

This allows all SecuBox modules to appear in the LuCI menu hierarchy.

Fixes: luci-app-secubox menu structure
2025-12-24 00:19:15 +01:00
4401c66da9 fix: convert dashes to underscores in module ID detection
The RPCD backend was generating module IDs with dashes (network-modes,
client-guardian, etc.) but the UCI config uses underscores (network_modes,
client_guardian, etc.). This mismatch prevented modules from being loaded
and displayed in the dashboard.

Fixed by adding conversion of dashes to underscores when generating
module IDs from RPCD script names.

Fixes: luci-app-secubox/root/usr/libexec/rpcd/secubox:18
2025-12-24 00:15:12 +01:00
3cd072382a fix: also remove routing feed to prevent indexing errors
Extended the feed removal to also exclude the routing feed, which was
causing the same indexing error during make defconfig.

Now removing both telephony and routing feeds from feeds.conf.default
before updating feeds in all three workflows.

This ensures only base, packages, and luci feeds are used.
2025-12-23 22:53:35 +01:00
3aa8cbf27e fix: remove telephony feed BEFORE updating feeds
Moved telephony removal to occur BEFORE './scripts/feeds update' to prevent
the telephony feed from ever being cloned or indexed. The previous fix tried
to remove telephony after feeds were already updated, which was too late.

Key changes:
- Remove telephony from feeds.conf.default BEFORE feed updates
- Keep final cleanup before make defconfig as safety measure
- Applies to all three workflows

This should completely eliminate the 'Collecting package info: feeds/telephony'
error during make defconfig.
2025-12-23 22:50:13 +01:00
d562b64c49 fix: remove telephony feed from defconfig to prevent indexing errors
The telephony feed was causing 'Collecting package info' failures during
make defconfig. This fix removes the telephony feed directory and references
from feeds.conf.default before running defconfig in all workflows.

Fixes applied to:
- build-openwrt-packages.yml
- build-secubox-images.yml
- test-validate.yml
2025-12-23 22:19:29 +01:00
3c1aef6a39 fix: add contents write permission for release creation 2025-12-23 21:53:54 +01:00
a23cfb6dd1 sniffer mode 2025-12-23 21:10:33 +01:00
782675e5b3 enhence git action artifacts showing 2025-12-23 21:01:07 +01:00
1f6b5dc393 single ipk build capacity 2025-12-23 20:54:06 +01:00
eb72e12a72 crowdswc full 2025-12-23 20:38:36 +01:00
ff20666817 fix: hope modules refresh 2025-12-23 18:56:15 +01:00
b86a58887b fix: hope modules refresh 2025-12-23 18:55:22 +01:00
f08c14f1d7 fix: hope modules refresh 2025-12-23 18:53:18 +01:00
6971fda569 fix: improve artifact publishing and build diagnostics 2025-12-23 18:40:35 +01:00
60f2ffde67 fix: improve artifact publishing and build diagnostics 2025-12-23 18:29:51 +01:00
60d1637a5d github fix actions 2025-12-23 17:48:17 +01:00
f7c06d4d13 reset to v1 2025-12-23 09:32:28 +01:00
df74fade80 add claude instructions 2025-12-23 09:31:00 +01:00
2e1fd21d18 css ready 2025-12-23 09:16:28 +01:00
da6fab39d4 fix gitaction secubox luci 2025-12-23 08:56:08 +01:00
d020678c2f Mise à jour des références des submodules 2025-12-23 02:23:44 +01:00
c81788b9c3 fix: auto-repair all SecuBox modules 2025-12-23 01:30:26 +01:00
9bad706ec6 Initial commit: SecuBox v1.0.0 - fixed packages makefiles 2025-12-22 16:13:16 +01:00
ca90702f6f debug 2025-12-22 13:30:17 +01:00
ef240b650b Initial commit: SecuBox v1.0.0-try2 2025-12-22 10:43:52 +01:00
b05776c24a Initial commit: Add GitHub Action 2025-12-21 18:24:13 +01:00
da4c3c118f Initial commit: SecuBox v1.0.0 2025-12-21 13:45:08 +01:00
008a3a4c13 Initial commit: SecuBox v1.0.0 2025-12-21 10:04:25 +01:00
3df2cbf2f0 Initial commit: SecuBox v1.0.0 2025-12-21 09:57:05 +01:00
0981987c10 Initial commit: SecuBox v1.0.0 2025-12-21 09:46:33 +01:00