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

Update mongodb.json #1

Merged
merged 1 commit into from
Jan 23, 2019
Merged

Update mongodb.json #1

merged 1 commit into from
Jan 23, 2019

Conversation

iamrommel
Copy link
Contributor

--Update the regex validation for MongoDb version so valid numeric version (semver) is only acceptable (3.10 is ok but 3. is not)
--Update the regex for password so it can accept also special character, and make it stricter for password
--Update the password description to state more information about what password should it be

--Update the regex validation for MongoDb version so valid numeric version (semver) is only acceptable (3.10 is ok but 3. is not)
--Update the regex for password so it can accept also special character, and make it stricter for password
--Update the password description to state more information about what password should it be
"description": "Only use alphanumeric chars.",
"validRegex": "/^([a-zA-Z0-9])+$/"
"description": "Must contain at least 1 lowercase alphabetical character, at least 1 uppercase alphabetical character, at least 1 numeric character, contain at least one special character,the string must be eight characters or longer",
"validRegex": "/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#\$%\^&\*])(?=.{8,})"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Two problems with this:

  • This too rigid. You shouldn't dictate how the password should look like. Users might be free to choose any password. It was a warning, it would have been okay, but since this is forcing the users, it's not good.

  • You need to make sure that there is no backslash \ or double quote " present in the password. This JSON will be stringified and values will be replaced. Presence of these characters breaks the JSON. That's why I left it as simple as alphanumeric chars. Previously this was possible as one-click-apps in CaptainDuckDuck were completely written in javascript. Now they are simplified as a simple JSON. This will increase maintainability, but it has drawbacks like customized post processing of entered values.

Keep in mind that this is just an initialization password anyways. You can change it to a more complex one at any point by connecting to db.

@@ -28,7 +28,7 @@
"label": "MongoDB Version",
"defaultValue": "4",
"description": "Checkout their docker page for the valid tags https://hub.docker.com/r/library/mongo/tags/",
"validRegex": "/^([a-zA-Z0-9])+$/"
"validRegex": "/^(\d+\.)?(\d+\.)?(\*|\d+)$"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Good change. But again, this is too restrictive. It assumes a very specific format for docker tags. For example, it doesn't match 3.6.9-stretch which is currently a valid tag. In general, it should not be restrictive. There is no guideline in Docker that prevents a tag from being 3.0.. This regex does not need to prevent that. It simply passes the inline validation and the deploy will fail. It's not end of the world for a typo. Better that blocking the users.

Also, missing the slash in the end.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But the problem is the regexp, it does not allow me to input dots and dash.
My application is a machine that prevents the alien invasion that needs mongodb 3.4.10, but caprover does not allow me create that specific version because of regex issue. Here is the screenshoot,

image

If this is not fix immediately i guess your end of the world for typo is inevitable. :)

@iamrommel
Copy link
Contributor Author

iamrommel commented Jan 21, 2019 via email

@githubsaturn githubsaturn merged commit 949aa44 into caprover:master Jan 23, 2019
@githubsaturn
Copy link
Collaborator

I merged this to fix the mongodb version issue as it's a bug. But the password will be reverted.

@githubsaturn
Copy link
Collaborator

githubsaturn commented Jan 23, 2019

Just so you know, you don't need to update your CapRover to have the MongoDB fix. CapRover automatically fetches the one click apps from this repo.

@ckc ckc mentioned this pull request Mar 18, 2020
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.

2 participants