Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-11331

auth error with createRole command

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.5.4
    • Affects Version/s: 2.5.3
    • Component/s: Security
    • Labels:
    • Environment:
      mac
    • ALL

      createRole (for empty user-defined roles) can be run by any user, and can also be run when not logged in at all.

      > db.runCommand(

      { createRole: "sam", privileges: [], roles: [] }

      )

      { "ok" : 1 }

      When the role we are trying to create contains any linked roles or privileges, the command fails with an auth error:

      > db.runCommand(

      { createRole: "dave", privileges: [], roles: [ "sam" ] }

      )
      {
      "ok" : 0,
      "errmsg" : "not authorized on test to execute command

      { createRole: \"dave\", privileges: [], roles: [ \"sam\" ] }

      ",
      "code" : 13
      }

      > db.runCommand(

      { createRole: "amalia", privileges: [], roles: [ "read" ] }

      )
      {
      "ok" : 0,
      "errmsg" : "not authorized on test to execute command

      { createRole: \"amalia\", privileges: [], roles: [ \"read\" ] }

      ",
      "code" : 13
      }

      > var priv = { resource:

      { db: "test", collection: "" }

      , actions: [ "find" ] }
      > db.runCommand(

      { createRole: "jeremy", privileges: [ priv ], roles: [] }

      )
      {
      "ok" : 0,
      "errmsg" : "not authorized on test to execute command { createRole: \"jeremy\", privileges: [ { resource:

      { db: \"test\", collection: \"\" }

      , actions: [ \"find\" ] } ], roles: [] }",
      "code" : 13
      }

            Assignee:
            spencer@mongodb.com Spencer Brody (Inactive)
            Reporter:
            samantha.ritter@mongodb.com Samantha Ritter (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: