microcks / microcks/microcks-cli

bug: `import-url` drops secret and breaks URL if secret resembles a boolean

Open Beginner friendly
#524 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Go
Stars
52
Forks
68
Avg merge
6h 54m
Merged PRs (30d)
10

Description

### Describe the bug

When using the `import-url` command with a URL that includes a `primary` flag and a `secret`, the internal `parseImportURLArg` logic splits the string by `:` and searches backward for the boolean flag. If the provided secret is a string that parses as a boolean (e.g. `true`, `false`, `1`, `0`), the parser incorrectly consumes the secret as the `primary` flag.

### Expected behavior

The command should correctly parse the URL, the boolean `primary` flag, and the `secret` string, even if the secret text happens to resemble a boolean value.

### Actual behavior

The secret is dropped entirely, the boolean `primary` flag is ignored, and the parsed URL incorrectly retains the boolean string at the end, causing the import to fail.

### How to Reproduce?

Reproducer:
1. Run a dry run or import using a boolean-like secret:
`microcks import-url "http://example.com/api:true:false"`
2. Observe that the logic parses the URL as `http://example.com/api:true`, the primary flag as `false`, and the secret as empty.

### Microcks version or git rev

`main` (Latest)

### Install method (`docker-compose`, `helm chart`, `operator`, `docker-desktop extension`,...)

CLI

### Additional information

This is a great `good first issue` to refactor the `parseImportURLArg` function in `cmd/importURL.go` to safely separate the URL, flag, and secret without relying on backward boolean parsing.

Contributor guide

Open the contributing guide

Research direction

Start in cmd/importURL.go and inspect parseImportURLArg, then reproduce the issue with `microcks import-url "http://example.com/api:true:false"`. Ensure the parser preserves the URL, primary flag, and boolean-like secret, and verify the dry run or import no longer drops the secret or corrupts the URL.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
88/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.