Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-9016

SolrIdentifierValidator accepts empty names

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.5.1, 6.0.1, 6.1
    • Component/s: Server
    • Labels:
      None

      Description

      SolrIdentifierValidator accepts shard, collection, cores and alias names following this pattern:

      ^(?!\\-)[\\._A-Za-z0-9\\-]*$
      

      This accepts an "empty" name. This is easily fixable by changing the * to +. However, it also accepts names such as .., ,__--- etc. Do we not want to require collection names to have a letter/digit identifier in them? Something like the following pattern:

      ^(\\.)?[a-zA-Z0-9]+[\\._\\-a-zA-Z0-9]*$
      

      That pattern requires the name to start with an optional . followed by a series of letters/digits followed by the rest of the allowed characters.

      What do you think?

        Activity

        Hide
        anshumg Anshum Gupta added a comment -

        I think this makes sense. It adds more restrictions to the regular expression that we currently have and so people who actually (for whatever reason) have been creating collections with names like the ones you mentioned above would run into issues but I think we shouldn't be worried about those use-cases.

        I think this could also go into 5.5.1 unless there's someone who thinks this wouldn't be the right time/release version. So, without any bike shedding, we should skip this change only if there are any strong objections.

        Show
        anshumg Anshum Gupta added a comment - I think this makes sense. It adds more restrictions to the regular expression that we currently have and so people who actually (for whatever reason) have been creating collections with names like the ones you mentioned above would run into issues but I think we shouldn't be worried about those use-cases. I think this could also go into 5.5.1 unless there's someone who thinks this wouldn't be the right time/release version. So, without any bike shedding, we should skip this change only if there are any strong objections.
        Hide
        shaie Shai Erera added a comment -

        Patch fixes the regex to not accept empty identifiers, however it does not modify the rule, i.e. someone could still use an identifier like __.-- if they want to. I'll be happy to change that, but since I didn't receive any feedback I think this fix is the least we can do (and also push into 5.5.1).

        The patch also modifies the exception message slightly.

        Show
        shaie Shai Erera added a comment - Patch fixes the regex to not accept empty identifiers, however it does not modify the rule, i.e. someone could still use an identifier like __.-- if they want to. I'll be happy to change that, but since I didn't receive any feedback I think this fix is the least we can do (and also push into 5.5.1). The patch also modifies the exception message slightly.
        Hide
        shaie Shai Erera added a comment -

        All tests pass, so if there are no objections, I'd like to push this change so that it even makes it into 5.5.1.

        Show
        shaie Shai Erera added a comment - All tests pass, so if there are no objections, I'd like to push this change so that it even makes it into 5.5.1.
        Hide
        anshumg Anshum Gupta added a comment -

        +1.
        Thanks Shai.

        Show
        anshumg Anshum Gupta added a comment - +1. Thanks Shai.
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 9166647918d26fd75ae48d993e9191ad8d943fe3 in lucene-solr's branch refs/heads/master from Shai Erera
        [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=9166647 ]

        SOLR-9016: Fix SolrIdentifierValidator to not accept empty identifiers

        Show
        jira-bot ASF subversion and git services added a comment - Commit 9166647918d26fd75ae48d993e9191ad8d943fe3 in lucene-solr's branch refs/heads/master from Shai Erera [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=9166647 ] SOLR-9016 : Fix SolrIdentifierValidator to not accept empty identifiers
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 95322605b80816792b66b81e91064d0014c920c0 in lucene-solr's branch refs/heads/branch_6x from Shai Erera
        [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=9532260 ]

        SOLR-9016: Fix SolrIdentifierValidator to not accept empty identifiers

        Show
        jira-bot ASF subversion and git services added a comment - Commit 95322605b80816792b66b81e91064d0014c920c0 in lucene-solr's branch refs/heads/branch_6x from Shai Erera [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=9532260 ] SOLR-9016 : Fix SolrIdentifierValidator to not accept empty identifiers
        Hide
        anshumg Anshum Gupta added a comment -

        Shai Erera I'm back porting this to 6x, 6.0, 5x, and 5.5 branches.

        Show
        anshumg Anshum Gupta added a comment - Shai Erera I'm back porting this to 6x, 6.0, 5x, and 5.5 branches.
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit b3cd1ff615ef0e2cf45bedbdf7d30362cc50dd1a in lucene-solr's branch refs/heads/branch_6_0 from Shai Erera
        [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=b3cd1ff ]

        SOLR-9016: Fix SolrIdentifierValidator to not accept empty identifiers

        Show
        jira-bot ASF subversion and git services added a comment - Commit b3cd1ff615ef0e2cf45bedbdf7d30362cc50dd1a in lucene-solr's branch refs/heads/branch_6_0 from Shai Erera [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=b3cd1ff ] SOLR-9016 : Fix SolrIdentifierValidator to not accept empty identifiers
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 724b9f37a4e721a858caaa9a41104bd0380360bb in lucene-solr's branch refs/heads/branch_5x from Anshum Gupta
        [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=724b9f3 ]

        SOLR-9016: Fix SolrIdentifierValidator to not accept empty identifiers (port to 5x)

        Show
        jira-bot ASF subversion and git services added a comment - Commit 724b9f37a4e721a858caaa9a41104bd0380360bb in lucene-solr's branch refs/heads/branch_5x from Anshum Gupta [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=724b9f3 ] SOLR-9016 : Fix SolrIdentifierValidator to not accept empty identifiers (port to 5x)
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 51895a76b82c9f0cd81d9147a2b6965c13dee713 in lucene-solr's branch refs/heads/branch_5_5 from Anshum Gupta
        [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=51895a7 ]

        SOLR-9016: Fix SolrIdentifierValidator to not accept empty identifiers (port to 5x)

        Show
        jira-bot ASF subversion and git services added a comment - Commit 51895a76b82c9f0cd81d9147a2b6965c13dee713 in lucene-solr's branch refs/heads/branch_5_5 from Anshum Gupta [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=51895a7 ] SOLR-9016 : Fix SolrIdentifierValidator to not accept empty identifiers (port to 5x)
        Hide
        shaie Shai Erera added a comment -

        Thanks Anshum Gupta for doing all the backports!

        Show
        shaie Shai Erera added a comment - Thanks Anshum Gupta for doing all the backports!
        Hide
        steve_rowe Steve Rowe added a comment -

        Bulk close issues included in the 6.0.1 release.

        Show
        steve_rowe Steve Rowe added a comment - Bulk close issues included in the 6.0.1 release.

          People

          • Assignee:
            Unassigned
            Reporter:
            shaie Shai Erera
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development