feat(security): dynamic role aliasing in setup_missions

This commit is contained in:
2025-12-28 15:39:38 +01:00
parent b0959a4de1
commit e0e922e9dc

View File

@@ -86,21 +86,23 @@ if ! grep -q "alias dumbo" "$HOME_DIR/.bashrc"; then
# 🎭 Role Aliases (Secure Wrapper) # 🎭 Role Aliases (Secure Wrapper)
WRAPPER="/opt/crumbforest/native_crumbcore_v1/scripts/role_wrapper.sh" WRAPPER="/opt/crumbforest/native_crumbcore_v1/scripts/role_wrapper.sh"
ROLES_DIR="/opt/crumbforest/app/crumbforest_roles"
# Helper to add alias if script exists # Dynamic Alias Generation
add_role_alias() { # Scans $ROLES_DIR for *_zero.sh files and creates aliases
local role_name=$1 # e.g. dumbo_zero.sh -> alias dumbo="..."
local script_path="/opt/crumbforest/app/crumbforest_roles/${role_name}_zero.sh" if [ -d "$ROLES_DIR" ]; then
if [ -f "$script_path" ]; then for script in "$ROLES_DIR"/*_zero.sh; do
echo "alias $role_name=\"$WRAPPER $script_path\"" >> "$HOME_DIR/.bashrc" if [ -f "$script" ]; then
fi # Extract basename without extension (dumbo_zero)
} filename=$(basename -- "$script")
role_base="${filename%_zero.sh}"
# Add known roles
add_role_alias "dumbo" # Create alias
add_role_alias "templatus" echo "alias $role_base=\"$WRAPPER $script\"" >> "$HOME_DIR/.bashrc"
add_role_alias "schnippsi" fi
add_role_alias "bugsy" # Bugsy might have a script too, or just the log tail alias above done
fi
EOF EOF
fi fi