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

Proper Validation of email pattern while creating a new user #7354

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

abhigna98
Copy link

Incorrect email pattern is being accepted while creating a new user.The email format is not strongly validated against defined schema patterns this can be considered as a vulnerability.

Fix #7352

Short description of what this resolves:

The vulnerability in this case involves improper validation of email addresses within the OpenEMR application. Specifically, the email address field for "Google Email for Login" allows submission of improperly formatted email addresses, such as 'user@'. This issue arises due to:
Lack of Server-side Validation: The email input is not validated on the server side to ensure it conforms to a proper email format. This can lead to potential security risks where invalid email formats are accepted, which could be exploited in various ways depending on other linked functionalities or integration points.
Potential for Inconsistent Data: Storing improperly validated emails can lead to data integrity issues. For example, communication mechanisms that rely on these emails may fail, leading to operational disruptions.
Compliance and Standard Practice Issues: Not validating input data such as email addresses according to a strict schema (which includes allowed characters, length, and pattern) violates best practices and specific compliance requirements

Changes proposed in this pull request:

Dual-layer Validation: By implementing both client-side and server-side validations, the application ensures that email address inputs are checked twice—once in the browser before the data is sent, and again on the server before it is processed. This mitigates the risk of malformed or malicious data slipping through due to client-side modifications (like disabling JavaScript).
Improved Data Integrity: Proper email validation ensures that only valid emails are stored in the database, which is crucial for the reliability of any features that use these emails, such as user notifications, password resets, etc.
User Feedback and Interaction: The JavaScript alert provides immediate feedback to the user, which can prevent confusion and ensure that users know their data must be corrected before proceeding. This improves usability and user experience.
Compliance and Best Practices: Implementing stringent input validation is in line with best practices for web development and specific security standards mentioned in the ASVS and CWE catalogs, thereby reducing potential compliance risks.

Incorrect email pattern.The email format is not strongly validated against defined schema patterns this can be considered as a vulnerability.
@abhigna98 abhigna98 changed the title Update usergroup_admin_add.php Proper Validation of email pattern while creating a new user Apr 15, 2024
Copy link
Sponsor Member

@adunsulag adunsulag left a comment

Choose a reason for hiding this comment

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

I'm confused on why you've removed a lot of the fields and validation checks in this script. Not going to review anymore until you explain why you are doing that.

@@ -7,7 +7,7 @@
* @link http://www.open-emr.org
* @author Brady Miller <brady.g.miller@gmail.com>
* @author Rod Roark <rod@sunsetsystems.com>
* @copyright Copyright (c) 2017-2018 Brady Miller <brady.g.miller@gmail.com>
* @copyright Copyright (c7) 2017-2018 Brady Miller
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

Why are you changing the copyright notice here? You should feel free to add your own copyright after this, but don't modify other people's copyright notices.

}

foreach ($result2 as $iter) {
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

Why did you remove all this code? It doesn't look like you moved it anywhere... you just removed it. That makes no sense to me. What are you doing here?

@adunsulag adunsulag added the WaitingForInfo This will put in queue for stale bot label Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WaitingForInfo This will put in queue for stale bot
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix for validating email address while adding a new user
2 participants