Investigate whitespace constraints for replica set seed list strings

    • Type: Improvement
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Replication
    • None
    • 3
    • TBD
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      The behavior around whitespace in replica set seed list strings is unclear. Currently, HostAndPort::parseThrowing allows whitespace and trimming was not originally implemented. When whitespace is present it is simply included as part of the hostname (e.g., " host0"), which may lead to inconsistent or unexpected downstream behavior.

      For example, the following test currently passes because the whitespace is treated as part of the hostname:

       

      TEST(parseReplSetSeedList, AllowWhitespaceInHostName) {    
          const auto [name, seeds] = parseReplSetSeedList("name/ host0:1000");    
          ASSERT(name == "name");    
          ASSERT(seeds.size() == 1);    
      }  

       
      It’s worth exploring how replica set seed strings are generated and used downstream to determine whether stricter validation or trimming should be applied. Formalizing whitespace handling would help ensure more consistent and predictable behavior across the board.

            Assignee:
            Unassigned
            Reporter:
            Kyra Ramesh Krishna
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: