Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project name input is not being sanitized #103

Merged
merged 3 commits into from
Nov 14, 2023
Merged

Conversation

CamPen21
Copy link
Collaborator

@CamPen21 CamPen21 commented Nov 14, 2023

By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.

Problem/Feature

I can pass two or more spaces as a project name causing it to fail. In the same way I can pass special characters that can mess with the integrity of the target file tree.

Description of Changes:

  • Added function sanitizeInput. Leveraged bubbles input Validate field to use said function.
  • Added unit tests to the function.
  • Modified linting.yml file to do continuous integration (linting and testing)

Checklist

  • I have self-reviewed the changes being requested
  • I have updated the documentation (if applicable)

@CamPen21 CamPen21 added the bug Something isn't working label Nov 14, 2023
@CamPen21 CamPen21 added the enhancement New feature or request label Nov 14, 2023
// InitialTextInputModel initializes a textinput step
// with the given data
func InitialTextInputModel(output *Output, header string, program *program.Project) model {
ti := textinput.New()
ti.Focus()
ti.CharLimit = 156
ti.Width = 20
ti.Validate = sanitizeInput
Copy link
Owner

Choose a reason for hiding this comment

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

nit: format?


import "testing"


Copy link
Owner

Choose a reason for hiding this comment

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

nit: extra space?




func TestInputSanitization(t *testing.T) {
Copy link
Owner

Choose a reason for hiding this comment

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

this is really cool - first test LUl

Copy link
Owner

@Melkeydev Melkeydev left a comment

Choose a reason for hiding this comment

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

LGTHT foool

@Melkeydev Melkeydev merged commit 9b9966c into main Nov 14, 2023
10 checks passed
@CamPen21 CamPen21 deleted the fix/input-sanitization branch November 14, 2023 21:39
Ujstor added a commit to Ujstor/go-blueprint that referenced this pull request Nov 14, 2023
* Gives an error if a directory already exists. Colorized the errors when creating a new project if occurred (Melkeydev#72)

Co-authored-by: Omar <[email protected]>

* fix 🐛: added hotfix to taps on homebrew (Melkeydev#87)

* fix 🐛: completion in homebrew (Melkeydev#100)

* fix 🐛: completion in homebrew

* fix 🐛: added comment about the use of the GoBlueprintVersion variable

* feat ✨: added missing completion install in goreleaser config

* fix 🐛: misstyped completion file name

* fix 🐛: permissions on completion script

* fix 🐛: missing archived complition folder needed for completion in brew

* fix 🐛: fixed ldfs flag

* docs 📚(README.md): fixed the brew installation command

* Project name input is not being sanitized (Melkeydev#103)

* fix: No project name input sanitization

* feat: Starting continuous integration

* fix: nits

---------

Co-authored-by: Omar <[email protected]>
Co-authored-by: Omar <[email protected]>
Co-authored-by: Zine Moualhi <[email protected]>
Co-authored-by: Camilo <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants