Add --token-file support to step ca certificate - #1686
Open
YuukiRitoTeng wants to merge 2 commits into
Open
Conversation
Signed-off-by: mea <215261208+YuukiRitoTeng@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Name of feature:
Add
--token-filesupport tostep ca certificate.Pain or issue this feature alleviates:
step ca tokencan already write a one-time token to disk with--output-file, butstep ca certificateonly accepted an externally generated token directly through--token.This change allows automation to pass the same token from a file without shell substitution or command-line token interpolation.
Why is this important to the project (if not answered above):
It makes token handoff more convenient for scripted workflows while preserving the existing certificate issuance flow and token semantics.
Is there documentation on how to use this feature? If so, where?
Yes. The command UsageText/help is updated, and the change is documented in
CHANGELOG.md.In what environments or workflows is this feature supported?
Online
step ca certificateflows that currently accept an externally supplied--token.The token file is read using the existing file-reading utility, surrounding whitespace is trimmed, and the resolved token continues through the existing certificate issuance flow.
Existing
--tokenbehavior remains unchanged.In what environments or workflows is this feature explicitly NOT supported (if any)?
--token-fileis mutually exclusive with--tokenand incompatible with--offline, matching the semantics of an externally supplied token.For JWK tokens, explicit
--token-fileinput follows the same--sanvalidation as explicit--tokeninput. Other supported external token types retain their existing SAN behavior.An empty or whitespace-only token file returns an error and does not fall back to automatic token generation.
The supplied token file is not deleted or modified; its lifecycle remains the caller's responsibility.
Supporting links/other PRs/issues:
Refs #1435
Related historical attempt: #1625.
This version specifically addresses the edge cases identified in the earlier attempt, including:
--tokenand--token-fileconflicts--offlineand--token-fileconflicts--sanbehavior--tokenbehaviorValidation:
go test ./command/camake test— 380 tests passedmake lint— 0 issuesmake build— passedgovulncheck ./...— no reachable vulnerabilitiesgit diff --check— clean💔Thank you!