Shiro
  1. Shiro
  2. SHIRO-302

DefaultHasher does not generate random salt

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.2.0
    • Component/s: Cryptography & Hashing
    • Labels:
      None

      Description

      Extract from DefaultHasher javadoc: When a salt is not specified in a request, this implementation generates secure random salts via its

      {@link #setRandomNumberGenerator(org.apache.shiro.crypto.RandomNumberGenerator) randomNumberGenerator}

      property.

      Random salt is generated, but never assigned (line 155):
      if (publicSaltBytes == null)

      { getRandomNumberGenerator().nextBytes().getBytes(); }

        Activity

        Hide
        Maria Jurcovicova added a comment -

        Attached patch assignes generated salt to the variable:
        if (publicSaltBytes == null)

        { publicSaltBytes = getRandomNumberGenerator().nextBytes().getBytes(); }

        It adds unit test too.

        Show
        Maria Jurcovicova added a comment - Attached patch assignes generated salt to the variable: if (publicSaltBytes == null) { publicSaltBytes = getRandomNumberGenerator().nextBytes().getBytes(); } It adds unit test too.
        Hide
        Kalle Korhonen added a comment -

        Applied, thanks!

        Show
        Kalle Korhonen added a comment - Applied, thanks!
        Hide
        Les Hazlewood added a comment -

        Closing with the 1.2.0 release.

        Show
        Les Hazlewood added a comment - Closing with the 1.2.0 release.

          People

          • Assignee:
            Kalle Korhonen
            Reporter:
            Maria Jurcovicova
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 1h
              1h
              Remaining:
              Remaining Estimate - 1h
              1h
              Logged:
              Time Spent - Not Specified
              Not Specified

                Development