Skip to content

fix(NODE-3760): Add regex check to 12 length string in isValid #473

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

Closed
wants to merge 1 commit into from

Conversation

MrEmanuel
Copy link

Issue with description filed here.
https://jira.mongodb.org/browse/DRIVERS-1989

Description

Check the validity of strings with length 12 in the same way as is done for 24 length strings.

What is changing?

Added regex check to 12 length strings in ObjectId.isValid()

Is there new documentation needed for these changes?

No.

What is the motivation for this change?

Object.isValid() returns true for strings that it shoudn't. For example the string: ´Value with é`

Double check the following

  • Ran npm run lint script
  • Self-review completed using the steps outlined here
  • PR title follows the correct format: <type>(NODE-xxxx)<!>: <description>
  • Changes are covered by tests
  • New TODOs have a related JIRA ticket

@dariakp
Copy link
Contributor

dariakp commented Nov 17, 2021

@MrEmanuel Hi there, thank you for reaching out about this issue. We moved the ticket you created to the NODE driver project, you can follow it here: https://jira.mongodb.org/browse/NODE-3760. It looks like we missed a validation case in our most recent ObjectId constructor validation improvement, so we'll look into adding it there as well as adding corresponding logic to isValid().

@dariakp dariakp added the tracked-in-jira There is a ticket in Mongo's Jira instance tracking this issue/PR label Nov 17, 2021
@dariakp dariakp changed the title Add regex check to 12 length string in isValid fix(NODE-3760): Add regex check to 12 length string in isValid Nov 17, 2021
@nbbeeken
Copy link
Contributor

Resolved in #475

@nbbeeken nbbeeken closed this Aug 18, 2022
@MrEmanuel MrEmanuel deleted the patch-1 branch August 19, 2022 07:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tracked-in-jira There is a ticket in Mongo's Jira instance tracking this issue/PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants