Skip to content

Make the file reader utility aware of BOMs#1045

Merged
hslatman merged 5 commits intomasterfrom
herman/ignore-bom
Oct 25, 2023
Merged

Make the file reader utility aware of BOMs#1045
hslatman merged 5 commits intomasterfrom
herman/ignore-bom

Conversation

@hslatman
Copy link
Copy Markdown
Member

@hslatman hslatman commented Oct 23, 2023

Fixes #1042

Made the CLI file reader utility aware of the BOM, and skip it. The code was copied from https://github.com/dimchansky/utfbom.

It might be an option to move this to the https://github.com/smallstep/cli-utils repo and implement this in the fileutil package.

In addition to the BOM, this PR also improves the error messages returned a bit by escaping the file name, and prevents index out of range errors when no PEM blocks are detected in a file.

@github-actions github-actions bot added the needs triage Waiting for discussion / prioritization by team label Oct 23, 2023
@hslatman
Copy link
Copy Markdown
Member Author

@dopey know what's up with that action linter: https://github.com/smallstep/cli/actions/runs/6613903057/job/17962699907?pr=1045?

@hslatman hslatman requested a review from maraino October 23, 2023 13:25
@hslatman hslatman added this to the v0.25.1 milestone Oct 24, 2023
Copy link
Copy Markdown
Collaborator

@maraino maraino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, but let's move this to an internal package.

@hslatman hslatman requested a review from maraino October 24, 2023 22:08
@hslatman hslatman merged commit e397d84 into master Oct 25, 2023
@hslatman hslatman deleted the herman/ignore-bom branch October 25, 2023 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs triage Waiting for discussion / prioritization by team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Step CLI panics when inspecting improperly encoded certificate

2 participants