Rule Definition
				MongoDB does not require authentication by default. Protect your database against unauthorized access by enabling database access control. 
        Enabling access control also allows you to limit actions that particular users can perform on the database.				
								
				
				Remediation
				Activate authentication to access the MongoDB database.				
												
				 Violation Code Sample
				
				var client = new MongoClient("mongodb://localhost")
        or
        var client = new MongoClient("mongodb://localhost:27017"
        or
        var client = new MongoClient("")
				 
												 Fixed Code Sample
				
				var credential = MongoCredential.CreateMongoCRCredential("mongoDB", "USER", "PWD");
            var settings = new MongoClientSettings
            {
                Credentials = new[] { credential }
            };
            var mongoClient = new MongoClient(settings);
            
            or
            MongoClient constr_OK = new MongoClient("mongodb://USER:PWD@localhost/mongoDB");
            or
            var connectionString = "mongodb://USER:PWD@localhost/mongoDB";
            MongoClient constr_KO = new MongoClient(connectionString);
				 
												
				 Related Technologies
								
				
				
				
				Technical Criterion
				Secure Coding - Encapsulation
				
				
				
				
				
					
				
				
				
About CAST Appmarq
					
CAST Appmarq is by far the biggest repository of data about real IT systems. It's built on thousands of analyzed applications, made of 35 different technologies, by over 300 business organizations across major verticals. It provides IT Leaders with factual key analytics to let them know if their applications are on track.