microcks / microcks/microcks-cli

bug: `import-url` doesn't validate URL scheme, fails with misleading error instead

Aperta Adatta ai principianti
#534 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

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

Image

### 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

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. 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

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.