hyperledger / hyperledger/fabric-x
bug(configtxlator): --original and --updated flags not marked as required, causing nil pointer panic
- Dominant language
- Go
- Stars
- 64
- Forks
- 80
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 15
Description
## Description
There is a missing validation check in the `configtxlator` CLI tool. Currently, the `--original` and `--updated` flags for the `compute_update` command are defined without the `.Required()` constraint.
If a user runs `configtxlator compute_update --channel_id foo` without providing these flags, the application attempts to close `nil` file pointers, leading to a panic.
### Steps to Reproduce
Run the following command without specifying `--original` or `--updated`:
`configtxlator compute_update --channel_id foo`
### Expected Behavior
The CLI should gracefully fail and output a helpful error message stating that the `--original` and `--updated` flags are required.
### Actual Behavior
The file pointers remain `nil`. When the application reaches the deferred `Close()` calls, it dereferences the `nil` pointers and crashes with a panic:
```go
// Panics here
defer (*computeUpdateOriginal).Close()
defer (*computeUpdateUpdated).Close()
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.