Skip to content

Commit b66c00c

Browse files
committed
fix(install): validation for long inputs and empty skill names
1 parent 77281ca commit b66c00c

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1919
- **Panic on Single-Word Install**: Fixed critical panic when using `ask install <name>` with a single word argument.
2020
- **Uninstall Alias**: Added missing top-level `ask uninstall` alias (previously only `ask skill uninstall` worked).
2121
- **Documentation**: Removed invalid `skillhub/skills` repository example and clarified `mcp-builder` installation.
22+
- **Input Validation**: Added input length limits and stricter validation to prevent empty skill name installations from malformed inputs.
23+
- **Robustness**: Improved re-installation check safety.
2224

2325
### Changed
2426
- **Repository Naming**: Local cache directories now use the user-configured repository name (e.g. `anthropics`).

cmd/install.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ If no agent is specified, skills are installed to .agent/skills/ by default.`,
5959
Run: runInstall,
6060
}
6161

62+
const maxInputLength = 255
63+
6264
func runInstall(cmd *cobra.Command, args []string) {
6365
// Check for offline mode
6466
if offline, _ := cmd.Flags().GetBool("offline"); offline || github.OfflineMode {
@@ -103,6 +105,12 @@ func runInstall(cmd *cobra.Command, args []string) {
103105

104106
var expandedArgs []string
105107
for _, input := range args {
108+
if len(input) > maxInputLength {
109+
fmt.Printf("Error: Input '%s...' is too long (max %d chars)\n", input[:20], maxInputLength)
110+
failed = append(failed, input)
111+
continue
112+
}
113+
106114
// Check if input matches a configured repository name
107115
var targetRepo *config.Repo
108116
for i := range cfg.Repos {
@@ -576,6 +584,10 @@ func installSingleSkill(input string, global bool, agents []string, cfg *config.
576584
}
577585
}
578586

587+
if skillName == "" || strings.TrimSpace(skillName) == "" {
588+
return fmt.Errorf("could not determine skill name from input '%s'", input)
589+
}
590+
579591
fmt.Printf("Installing %s to %s...\n", skillName, scopeLabel)
580592

581593
// Check if already installed in all targets

0 commit comments

Comments
 (0)