microcks / microcks/microcks-cli
bug: `import-url` doesn't validate URL scheme, fails with misleading error instead
Nessuno ha ancora preso questa issue.
- Lingua principale
- Go
- Stelle
- 52
- Fork
- 68
- Merge medio
- 6h 54m
- PR unite (30g)
- 10
Descrizione
### Describe the bug
`parseImportURLArg` in `cmd/import_url.go` only parses the `:mainArtifact:secret` suffix when the input starts with `http://` or `https://`. If it doesn't, there's no else, the string just passes through unchanged and gets sent straight to `mc.DownloadArtifact(...)`, which then fails with an unrelated, confusing error.
### How to Reproduce?
```
./microcks import-url "spec.yaml:true:mysecret"
```
### Actual behavior
### Expected behavior
Something like:
```
Error: invalid artifact URL 'spec.yaml:true:mysecret': must start with http:// or https://
```
### Microcks version or git rev
1.0.3
### Install method (`docker-compose`, `helm chart`, `operator`, `docker-desktop extension`,...)
_No response_
### Additional information
Fix for this would be to validate the scheme at the top of `parseImportURLArg `and return an error instead of silently falling through, then propagate it in RunE.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia in cmd/import_url.go, in parseImportURLArg e nell'handler RunE del comando. Riproduci il comando import-url con un valore non HTTP(S), quindi valida lo schema dell'URL e propaga l'errore restituito, in modo che il comando segnali che l'URL dell'artefatto deve iniziare con http:// o https://.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- go
- Ambito
- cli
- Tipo di issue
- Bug
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Stato di attività
- Attiva
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 86/100