goharbor / goharbor/harbor-cli
[bug]: Registry ID Validation (Proxy Cache)
- Dominant language
- Go
- Stars
- 163
- Forks
- 211
- Avg merge
- 1m
- Merged PRs (30d)
- 1
Description
## Description
When creating a Proxy Cache project, the CLI fails to validate the `--registry-id` flag. If a non-numeric value is provided, the error is ignored, and the project creation proceeds with a `registryID` of `0`, which can lead to incorrect project configurations or unexpected server errors.
## Steps to Reproduce
1. Run the command: `harbor project create my-proxy --proxy-cache --registry-id "my-registry"`
2. Observe the output: `"Project created successfully"` (even though the Registry ID was invalid).
## Expected Behavior
The CLI should validate that the `--registry-id` is a valid integer before making the API request and return an error if it is not.
## Actual Behavior
The parsing failure is ignored, and a value of `0` is sent to the Harbor API.
## Environment
- **OS:** Any
- **Tool version:** Latest main branch
- **Other relevant details:** Affects logic in `pkg/api/project_handler.go` line 34.
## Additional Context
proof:
as you can see it should've stopped at "abc"
Contributor guide
Assessment
This issue has not been assessed yet.