fix: prevent shell injection in action, suppress stdout in --json mode

- action.yml: pass inputs via env vars, whitelist allowed commands
- All --json commands: use no-op spinner to prevent stdout pollution
- remove: run AGENTS.md update before JSON output (was skipped)
- eval: gate spinner on json format, wrap in try/catch for cleanup
- scan: wrap spinner in try/catch for cleanup on failure
This commit is contained in:
Rohit Ghumare
2026-04-12 10:56:35 +01:00
parent 49fcc532d2
commit 9e50c8abe1
8 changed files with 66 additions and 30 deletions
+28 -7
View File
@@ -34,11 +34,32 @@ runs:
- name: Run SkillKit
shell: bash
env:
SK_COMMAND: ${{ inputs.command }}
SK_SOURCE: ${{ inputs.source }}
SK_AGENT: ${{ inputs.agent }}
SK_ARGS: ${{ inputs.args }}
run: |
if [ "${{ inputs.command }}" = "install" ] && [ -n "${{ inputs.source }}" ]; then
skillkit install "${{ inputs.source }}" --agent "${{ inputs.agent }}" --yes --json ${{ inputs.args }}
elif [ "${{ inputs.command }}" = "scan" ] && [ -n "${{ inputs.source }}" ]; then
skillkit scan "${{ inputs.source }}" --json ${{ inputs.args }}
else
skillkit ${{ inputs.command }} ${{ inputs.args }}
fi
case "${SK_COMMAND}" in
install)
if [ -n "${SK_SOURCE}" ]; then
skillkit install "${SK_SOURCE}" --agent "${SK_AGENT}" --yes --json ${SK_ARGS}
else
echo "Error: source is required for install" >&2; exit 1
fi
;;
scan)
if [ -n "${SK_SOURCE}" ]; then
skillkit scan "${SK_SOURCE}" --json ${SK_ARGS}
else
echo "Error: source is required for scan" >&2; exit 1
fi
;;
check|sync|list|update)
skillkit "${SK_COMMAND}" ${SK_ARGS}
;;
*)
echo "Error: unsupported command '${SK_COMMAND}'. Use: install, scan, check, sync, list, update" >&2
exit 1
;;
esac