Summary
Parameter values that begin with - are rejected by the CLI's argument parser, and there is no file/stdin input mechanism for parameter values. Combined, this makes any API whose parameter is a PEM body — certificate/key upload actions such as alb UploadCertificate (--PublicKey / --PrivateKey) — impossible to call through the CLI. The only remaining path for these actions is the web console.
Reproduction
Tested on volcengine-cli 1.0.49 and 1.0.52 (macOS, arm64).
# throwaway self-signed pair
openssl req -x509 -newkey rsa:2048 -nodes -keyout t.key -out t.crt -days 1 -subj /CN=repro
ve alb UploadCertificate \
--CertificateName repro-test \
--CertificateType Server \
--PublicKey "$(cat t.crt)" \
--PrivateKey "$(cat t.key)"
Result — the parser rejects the value because PEM always starts with -----BEGIN:
-----BEGIN CERTIFICATE----- ... is not supported, supported fixed flags: ---profile, ---region, ---endpoint
The --Key=value form is not accepted either:
--CertificateName=x must set value
Why no quoting workaround exists
It is a two-layer catch-22:
- Any value starting with
- is rejected by the argv parser, and PEM bodies always start with -----BEGIN.
- Padding the value to get past the parser (e.g.
--PublicKey "$(printf '\n%s' "$(cat t.crt)")") makes the request reach the API, but the server then rejects it with InvalidPublicKey.Malformed (400) because the body must start exactly with -----BEGIN.
So there is no combination of shell quoting that can deliver a valid PEM through the CLI.
Suggested fixes (any one of these would resolve it)
- File input for parameter values (most useful): support
--PublicKey file://t.crt or --PublicKey @t.crt, reading the value from the file — similar to aws-cli's file:// convention. This also avoids putting private-key material into shell history / process argv.
- Accept
--Key=value syntax, so a leading-- value is unambiguous.
- Treat the token following a recognized
--ParameterName as its value even when it begins with - (only free-standing tokens need the leading-dash check).
Related quality-of-life notes for cert uploads
While validating with the console as a workaround, two server-side strictness behaviors also make CLI usage of these actions harder than necessary; if the CLI gains file input it may be worth normalizing these client-side (or at least documenting them):
- PEM lines with trailing whitespace are rejected as
Malformed (some CA downloads include a padded header line).
- PKCS#8 private keys (
-----BEGIN PRIVATE KEY-----) are rejected; only the traditional formats (BEGIN RSA PRIVATE KEY / BEGIN EC PRIVATE KEY) are accepted, so keys from most modern tooling need an openssl rsa -traditional conversion first.
Thanks for maintaining the CLI — happy to provide more detail or test a patch.
Summary
Parameter values that begin with
-are rejected by the CLI's argument parser, and there is no file/stdin input mechanism for parameter values. Combined, this makes any API whose parameter is a PEM body — certificate/key upload actions such asalb UploadCertificate(--PublicKey/--PrivateKey) — impossible to call through the CLI. The only remaining path for these actions is the web console.Reproduction
Tested on
volcengine-cli1.0.49 and 1.0.52 (macOS, arm64).Result — the parser rejects the value because PEM always starts with
-----BEGIN:The
--Key=valueform is not accepted either:Why no quoting workaround exists
It is a two-layer catch-22:
-is rejected by the argv parser, and PEM bodies always start with-----BEGIN.--PublicKey "$(printf '\n%s' "$(cat t.crt)")") makes the request reach the API, but the server then rejects it withInvalidPublicKey.Malformed(400) because the body must start exactly with-----BEGIN.So there is no combination of shell quoting that can deliver a valid PEM through the CLI.
Suggested fixes (any one of these would resolve it)
--PublicKey file://t.crtor--PublicKey @t.crt, reading the value from the file — similar toaws-cli'sfile://convention. This also avoids putting private-key material into shell history / process argv.--Key=valuesyntax, so a leading--value is unambiguous.--ParameterNameas its value even when it begins with-(only free-standing tokens need the leading-dash check).Related quality-of-life notes for cert uploads
While validating with the console as a workaround, two server-side strictness behaviors also make CLI usage of these actions harder than necessary; if the CLI gains file input it may be worth normalizing these client-side (or at least documenting them):
Malformed(some CA downloads include a padded header line).-----BEGIN PRIVATE KEY-----) are rejected; only the traditional formats (BEGIN RSA PRIVATE KEY/BEGIN EC PRIVATE KEY) are accepted, so keys from most modern tooling need anopenssl rsa -traditionalconversion first.Thanks for maintaining the CLI — happy to provide more detail or test a patch.