Skip to content

Scaffolded project/resource name isn't validated on the CLI-arg path #24

Description

@Jaro-c

I traced getNameFromArgsOrPrompt (commands/create_helpers.go:32-35) and noticed it returns args[0] without calling any validator when the name comes in as a CLI argument — the (weak, empty/space-only) validator in validateCreateName (create_helpers.go:20-29) only runs on the interactive huh prompt path. A name like ../../etc/foo would reach filepath.Join in create_resource.go:65, create_standalone.go:72, init.go:155,240, and templates/embed.go:302 unchecked.

I'd validate names with an allow-list regex (^[a-zA-Z0-9_-]+$) applied on every code path — including CLI-arg input — before any filepath.Join/os.Create.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions