Skip to content

Validate extension name in phylum extension new#529

Merged
cd-work merged 3 commits intomainfrom
new_validation
Jul 7, 2022
Merged

Validate extension name in phylum extension new#529
cd-work merged 3 commits intomainfrom
new_validation

Conversation

@cd-work
Copy link
Contributor

@cd-work cd-work commented Jul 7, 2022

Since phylum extension new is likely the most common way users will
create new extensions, it should not be possible to creat invalid
extensions with it.

This patch validates the extension name during creation, refusing to
create one with an invalid name.

Closes #515.

cd-work added 2 commits July 7, 2022 14:41
Since both `Extension::install` and `Extension::load` already validate
the extension regex through `Extension::try_from`, it's not necessary to
check against the regex there.

The only other location, `Extension::uninstall`, requires installing the
extension first, making it unnecessary to add a dedicated check there.
Since `phylum extension new` is likely the most common way users will
create new extensions, it should not be possible to creat invalid
extensions with it.

This patch validates the extension name during creation, refusing to
create one with an invalid name.

Closes #515.
@cd-work cd-work requested a review from a team as a code owner July 7, 2022 14:53
@cd-work cd-work requested a review from andreaphylum July 7, 2022 14:53
andreaphylum
andreaphylum previously approved these changes Jul 7, 2022
@cd-work cd-work merged commit d476e39 into main Jul 7, 2022
@cd-work cd-work deleted the new_validation branch July 7, 2022 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Validate extension name in phylum extension new

2 participants