Uploaded image for project: 'MongoDB Shell'
  1. MongoDB Shell
  2. MONGOSH-1526

Mongosh' custom UUID constructor misses validation

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Bson
    • None
    • Environment:
      OS:
      node.js / npm versions:
      Additional info:
    • 2

      https://github.com/mongodb-js/mongosh/blob/05ad91b4dd40382a13f27abe1ae8c3f9f52a38f7/packages/shell-api/src/shell-bson.ts#L183-L196

      HELP-48051 points out that mongosh's UUID constructor does not validate at least some input:

      > new UUID('222222-2222-2222-9222-222222222222')
      Binary(Buffer.from("222222222222229222222222222222", "hex"), 4)
      

      vs

      > new bson.UUID('222222-2222-2222-9222-222222222222')
      BSONError: UUID string representation must be 32 hex digits or canonical hyphenated representation
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            leroux.bodenstein@mongodb.com Le Roux Bodenstein
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: