Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-820

DBCollection Doesn't Check Keys Contained By Lists

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.11.2, 2.12.0
    • Affects Version/s: None
    • Component/s: None
    • None

      In DBCollection._checkKeys (pasted below), if the inner Object is an instance of List, it is not validated. It is possible, for instance, to have a List<BasicDBObject>> where the DBObjects in the list will not have their keys validated.

       private void _checkKeys( DBObject o ) {
              if ( o instanceof LazyDBObject || o instanceof LazyDBList )
                  return;
      
              for ( String s : o.keySet() ){
                  validateKey ( s );
                  Object inner = o.get( s );
                  if ( inner instanceof DBObject ) {
                      _checkKeys( (DBObject)inner );
                  } else if ( inner instanceof Map ) {
                      _checkKeys( (Map<String, Object>)inner );
                  }
              }
          }
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            djones@squarespace.com Doug Jones
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: