bson/testdata/uri-options/tls-options.json
2025-03-17 20:58:26 +01:00

650 lines
22 KiB
JSON

{
"tests": [
{
"description": "Valid required tls options are parsed correctly",
"uri": "mongodb://example.com/?tls=true&tlsCAFile=ca.pem&tlsCertificateKeyFile=cert.pem",
"valid": true,
"warning": false,
"hosts": null,
"auth": null,
"options": {
"tls": true,
"tlsCAFile": "ca.pem",
"tlsCertificateKeyFile": "cert.pem"
}
},
{
"description": "Valid tlsCertificateKeyFilePassword is parsed correctly",
"uri": "mongodb://example.com/?tlsCertificateKeyFilePassword=hunter2",
"valid": true,
"warning": false,
"hosts": null,
"auth": null,
"options": {
"tlsCertificateKeyFilePassword": "hunter2"
}
},
{
"description": "Invalid tlsAllowInvalidCertificates causes a warning",
"uri": "mongodb://example.com/?tlsAllowInvalidCertificates=invalid",
"valid": true,
"warning": true,
"hosts": null,
"auth": null,
"options": {}
},
{
"description": "tlsAllowInvalidCertificates is parsed correctly",
"uri": "mongodb://example.com/?tlsAllowInvalidCertificates=true",
"valid": true,
"warning": false,
"hosts": null,
"auth": null,
"options": {
"tlsAllowInvalidCertificates": true
}
},
{
"description": "Invalid tlsAllowInvalidCertificates causes a warning",
"uri": "mongodb://example.com/?tlsAllowInvalidCertificates=invalid",
"valid": true,
"warning": true,
"hosts": null,
"auth": null,
"options": {}
},
{
"description": "tlsAllowInvalidHostnames is parsed correctly",
"uri": "mongodb://example.com/?tlsAllowInvalidHostnames=true",
"valid": true,
"warning": false,
"hosts": null,
"auth": null,
"options": {
"tlsAllowInvalidHostnames": true
}
},
{
"description": "Invalid tlsAllowInvalidHostnames causes a warning",
"uri": "mongodb://example.com/?tlsAllowInvalidHostnames=invalid",
"valid": true,
"warning": true,
"hosts": null,
"auth": null,
"options": {}
},
{
"description": "tlsInsecure is parsed correctly",
"uri": "mongodb://example.com/?tlsInsecure=true",
"valid": true,
"warning": false,
"hosts": null,
"auth": null,
"options": {
"tlsInsecure": true
}
},
{
"description": "Invalid tlsInsecure causes a warning",
"uri": "mongodb://example.com/?tlsInsecure=invalid",
"valid": true,
"warning": true,
"hosts": null,
"auth": null,
"options": {}
},
{
"description": "tlsInsecure and tlsAllowInvalidCertificates both present (and true) raises an error",
"uri": "mongodb://example.com/?tlsInsecure=true&tlsAllowInvalidCertificates=true",
"valid": false,
"warning": false,
"hosts": null,
"auth": null,
"options": {}
},
{
"description": "tlsInsecure and tlsAllowInvalidCertificates both present (and false) raises an error",
"uri": "mongodb://example.com/?tlsInsecure=false&tlsAllowInvalidCertificates=false",
"valid": false,
"warning": false,
"hosts": null,
"auth": null,
"options": {}
},
{
"description": "tlsAllowInvalidCertificates and tlsInsecure both present (and true) raises an error",
"uri": "mongodb://example.com/?tlsAllowInvalidCertificates=true&tlsInsecure=true",
"valid": false,
"warning": false,
"hosts": null,
"auth": null,
"options": {}
},
{
"description": "tlsAllowInvalidCertificates and tlsInsecure both present (and false) raises an error",
"uri": "mongodb://example.com/?tlsAllowInvalidCertificates=false&tlsInsecure=false",
"valid": false,
"warning": false,
"hosts": null,
"auth": null,
"options": {}
},
{
"description": "tlsInsecure and tlsAllowInvalidHostnames both present (and true) raises an error",
"uri": "mongodb://example.com/?tlsInsecure=true&tlsAllowInvalidHostnames=true",
"valid": false,
"warning": false,
"hosts": null,
"auth": null,
"options": {}
},
{
"description": "tlsInsecure and tlsAllowInvalidHostnames both present (and false) raises an error",
"uri": "mongodb://example.com/?tlsInsecure=false&tlsAllowInvalidHostnames=false",
"valid": false,
"warning": false,
"hosts": null,
"auth": null,
"options": {}
},
{
"description": "tlsAllowInvalidHostnames and tlsInsecure both present (and true) raises an error",
"uri": "mongodb://example.com/?tlsAllowInvalidHostnames=true&tlsInsecure=true",
"valid": false,
"warning": false,
"hosts": null,
"auth": null,
"options": {}
},
{
"description": "tlsAllowInvalidHostnames and tlsInsecure both present (and false) raises an error",
"uri": "mongodb://example.com/?tlsAllowInvalidHostnames=false&tlsInsecure=false",
"valid": false,
"warning": false,
"hosts": null,
"auth": null,
"options": {}
},
{
"description": "tls=true and ssl=true doesn't warn",
"uri": "mongodb://example.com/?tls=true&ssl=true",
"valid": true,
"warning": false,
"hosts": null,
"auth": null,
"options": {}
},
{
"description": "tls=false and ssl=false doesn't warn",
"uri": "mongodb://example.com/?tls=false&ssl=false",
"valid": true,
"warning": false,
"hosts": null,
"auth": null,
"options": {}
},
{
"description": "ssl=true and tls=true doesn't warn",
"uri": "mongodb://example.com/?ssl=true&tls=true",
"valid": true,
"warning": false,
"hosts": null,
"auth": null,
"options": {}
},
{
"description": "ssl=false and tls=false doesn't warn",
"uri": "mongodb://example.com/?ssl=false&tls=false",
"valid": true,
"warning": false,
"hosts": null,
"auth": null,
"options": {}
},
{
"description": "tls=false and ssl=true raises error",
"uri": "mongodb://example.com/?tls=false&ssl=true",
"valid": false,
"warning": false,
"hosts": null,
"auth": null,
"options": {}
},
{
"description": "tls=true and ssl=false raises error",
"uri": "mongodb://example.com/?tls=true&ssl=false",
"valid": false,
"warning": false,
"hosts": null,
"auth": null,
"options": {}
},
{
"description": "ssl=false and tls=true raises error",
"uri": "mongodb://example.com/?ssl=false&tls=true",
"valid": false,
"warning": false,
"hosts": null,
"auth": null,
"options": {}
},
{
"description": "ssl=true and tls=false raises error",
"uri": "mongodb://example.com/?ssl=true&tls=false",
"valid": false,
"warning": false,
"hosts": null,
"auth": null,
"options": {}
},
{
"description": "tlsDisableCertificateRevocationCheck can be set to true",
"uri": "mongodb://example.com/?tls=true&tlsDisableCertificateRevocationCheck=true",
"valid": true,
"warning": false,
"hosts": null,
"auth": null,
"options": {
"tls": true,
"tlsDisableCertificateRevocationCheck": true
}
},
{
"description": "tlsDisableCertificateRevocationCheck can be set to false",
"uri": "mongodb://example.com/?tls=true&tlsDisableCertificateRevocationCheck=false",
"valid": true,
"warning": false,
"hosts": null,
"auth": null,
"options": {
"tls": true,
"tlsDisableCertificateRevocationCheck": false
}
},
{
"description": "tlsAllowInvalidCertificates and tlsDisableCertificateRevocationCheck both present (and true) raises an error",
"uri": "mongodb://example.com/?tlsAllowInvalidCertificates=true&tlsDisableCertificateRevocationCheck=true",
"valid": false,
"warning": false,
"hosts": null,
"auth": null,
"options": {}
},
{
"description": "tlsAllowInvalidCertificates=true and tlsDisableCertificateRevocationCheck=false raises an error",
"uri": "mongodb://example.com/?tlsAllowInvalidCertificates=true&tlsDisableCertificateRevocationCheck=false",
"valid": false,
"warning": false,
"hosts": null,
"auth": null,
"options": {}
},
{
"description": "tlsAllowInvalidCertificates=false and tlsDisableCertificateRevocationCheck=true raises an error",
"uri": "mongodb://example.com/?tlsAllowInvalidCertificates=false&tlsDisableCertificateRevocationCheck=true",
"valid": false,
"warning": false,
"hosts": null,
"auth": null,
"options": {}
},
{
"description": "tlsAllowInvalidCertificates and tlsDisableCertificateRevocationCheck both present (and false) raises an error",
"uri": "mongodb://example.com/?tlsAllowInvalidCertificates=false&tlsDisableCertificateRevocationCheck=false",
"valid": false,
"warning": false,
"hosts": null,
"auth": null,
"options": {}
},
{
"description": "tlsDisableCertificateRevocationCheck and tlsAllowInvalidCertificates both present (and true) raises an error",
"uri": "mongodb://example.com/?tlsDisableCertificateRevocationCheck=true&tlsAllowInvalidCertificates=true",
"valid": false,
"warning": false,
"hosts": null,
"auth": null,
"options": {}
},
{
"description": "tlsDisableCertificateRevocationCheck=true and tlsAllowInvalidCertificates=false raises an error",
"uri": "mongodb://example.com/?tlsDisableCertificateRevocationCheck=true&tlsAllowInvalidCertificates=false",
"valid": false,
"warning": false,
"hosts": null,
"auth": null,
"options": {}
},
{
"description": "tlsDisableCertificateRevocationCheck=false and tlsAllowInvalidCertificates=true raises an error",
"uri": "mongodb://example.com/?tlsDisableCertificateRevocationCheck=false&tlsAllowInvalidCertificates=true",
"valid": false,
"warning": false,
"hosts": null,
"auth": null,
"options": {}
},
{
"description": "tlsDisableCertificateRevocationCheck and tlsAllowInvalidCertificates both present (and false) raises an error",
"uri": "mongodb://example.com/?tlsDisableCertificateRevocationCheck=false&tlsAllowInvalidCertificates=false",
"valid": false,
"warning": false,
"hosts": null,
"auth": null,
"options": {}
},
{
"description": "tlsInsecure and tlsDisableCertificateRevocationCheck both present (and true) raises an error",
"uri": "mongodb://example.com/?tlsInsecure=true&tlsDisableCertificateRevocationCheck=true",
"valid": false,
"warning": false,
"hosts": null,
"auth": null,
"options": {}
},
{
"description": "tlsInsecure=true and tlsDisableCertificateRevocationCheck=false raises an error",
"uri": "mongodb://example.com/?tlsInsecure=true&tlsDisableCertificateRevocationCheck=false",
"valid": false,
"warning": false,
"hosts": null,
"auth": null,
"options": {}
},
{
"description": "tlsInsecure=false and tlsDisableCertificateRevocationCheck=true raises an error",
"uri": "mongodb://example.com/?tlsInsecure=false&tlsDisableCertificateRevocationCheck=true",
"valid": false,
"warning": false,
"hosts": null,
"auth": null,
"options": {}
},
{
"description": "tlsInsecure and tlsDisableCertificateRevocationCheck both present (and false) raises an error",
"uri": "mongodb://example.com/?tlsInsecure=false&tlsDisableCertificateRevocationCheck=false",
"valid": false,
"warning": false,
"hosts": null,
"auth": null,
"options": {}
},
{
"description": "tlsDisableCertificateRevocationCheck and tlsInsecure both present (and true) raises an error",
"uri": "mongodb://example.com/?tlsDisableCertificateRevocationCheck=true&tlsInsecure=true",
"valid": false,
"warning": false,
"hosts": null,
"auth": null,
"options": {}
},
{
"description": "tlsDisableCertificateRevocationCheck=true and tlsInsecure=false raises an error",
"uri": "mongodb://example.com/?tlsDisableCertificateRevocationCheck=true&tlsInsecure=false",
"valid": false,
"warning": false,
"hosts": null,
"auth": null,
"options": {}
},
{
"description": "tlsDisableCertificateRevocationCheck=false and tlsInsecure=true raises an error",
"uri": "mongodb://example.com/?tlsDisableCertificateRevocationCheck=false&tlsInsecure=true",
"valid": false,
"warning": false,
"hosts": null,
"auth": null,
"options": {}
},
{
"description": "tlsDisableCertificateRevocationCheck and tlsInsecure both present (and false) raises an error",
"uri": "mongodb://example.com/?tlsDisableCertificateRevocationCheck=false&tlsInsecure=false",
"valid": false,
"warning": false,
"hosts": null,
"auth": null,
"options": {}
},
{
"description": "tlsDisableCertificateRevocationCheck and tlsDisableOCSPEndpointCheck both present (and true) raises an error",
"uri": "mongodb://example.com/?tlsDisableCertificateRevocationCheck=true&tlsDisableOCSPEndpointCheck=true",
"valid": false,
"warning": false,
"hosts": null,
"auth": null,
"options": {}
},
{
"description": "tlsDisableCertificateRevocationCheck=true and tlsDisableOCSPEndpointCheck=false raises an error",
"uri": "mongodb://example.com/?tlsDisableCertificateRevocationCheck=true&tlsDisableOCSPEndpointCheck=false",
"valid": false,
"warning": false,
"hosts": null,
"auth": null,
"options": {}
},
{
"description": "tlsDisableCertificateRevocationCheck=false and tlsDisableOCSPEndpointCheck=true raises an error",
"uri": "mongodb://example.com/?tlsDisableCertificateRevocationCheck=false&tlsDisableOCSPEndpointCheck=true",
"valid": false,
"warning": false,
"hosts": null,
"auth": null,
"options": {}
},
{
"description": "tlsDisableCertificateRevocationCheck and tlsDisableOCSPEndpointCheck both present (and false) raises an error",
"uri": "mongodb://example.com/?tlsDisableCertificateRevocationCheck=false&tlsDisableOCSPEndpointCheck=false",
"valid": false,
"warning": false,
"hosts": null,
"auth": null,
"options": {}
},
{
"description": "tlsDisableOCSPEndpointCheck and tlsDisableCertificateRevocationCheck both present (and true) raises an error",
"uri": "mongodb://example.com/?tlsDisableOCSPEndpointCheck=true&tlsDisableCertificateRevocationCheck=true",
"valid": false,
"warning": false,
"hosts": null,
"auth": null,
"options": {}
},
{
"description": "tlsDisableOCSPEndpointCheck=true and tlsDisableCertificateRevocationCheck=false raises an error",
"uri": "mongodb://example.com/?tlsDisableOCSPEndpointCheck=true&tlsDisableCertificateRevocationCheck=false",
"valid": false,
"warning": false,
"hosts": null,
"auth": null,
"options": {}
},
{
"description": "tlsDisableOCSPEndpointCheck=false and tlsDisableCertificateRevocationCheck=true raises an error",
"uri": "mongodb://example.com/?tlsDisableOCSPEndpointCheck=false&tlsDisableCertificateRevocationCheck=true",
"valid": false,
"warning": false,
"hosts": null,
"auth": null,
"options": {}
},
{
"description": "tlsDisableOCSPEndpointCheck and tlsDisableCertificateRevocationCheck both present (and false) raises an error",
"uri": "mongodb://example.com/?tlsDisableOCSPEndpointCheck=false&tlsDisableCertificateRevocationCheck=false",
"valid": false,
"warning": false,
"hosts": null,
"auth": null,
"options": {}
},
{
"description": "tlsDisableOCSPEndpointCheck can be set to true",
"uri": "mongodb://example.com/?tls=true&tlsDisableOCSPEndpointCheck=true",
"valid": true,
"warning": false,
"hosts": null,
"auth": null,
"options": {
"tls": true,
"tlsDisableOCSPEndpointCheck": true
}
},
{
"description": "tlsDisableOCSPEndpointCheck can be set to false",
"uri": "mongodb://example.com/?tls=true&tlsDisableOCSPEndpointCheck=false",
"valid": true,
"warning": false,
"hosts": null,
"auth": null,
"options": {
"tls": true,
"tlsDisableOCSPEndpointCheck": false
}
},
{
"description": "tlsInsecure and tlsDisableOCSPEndpointCheck both present (and true) raises an error",
"uri": "mongodb://example.com/?tlsInsecure=true&tlsDisableOCSPEndpointCheck=true",
"valid": false,
"warning": false,
"hosts": null,
"auth": null,
"options": {}
},
{
"description": "tlsInsecure=true and tlsDisableOCSPEndpointCheck=false raises an error",
"uri": "mongodb://example.com/?tlsInsecure=true&tlsDisableOCSPEndpointCheck=false",
"valid": false,
"warning": false,
"hosts": null,
"auth": null,
"options": {}
},
{
"description": "tlsInsecure=false and tlsDisableOCSPEndpointCheck=true raises an error",
"uri": "mongodb://example.com/?tlsInsecure=false&tlsDisableOCSPEndpointCheck=true",
"valid": false,
"warning": false,
"hosts": null,
"auth": null,
"options": {}
},
{
"description": "tlsInsecure and tlsDisableOCSPEndpointCheck both present (and false) raises an error",
"uri": "mongodb://example.com/?tlsInsecure=false&tlsDisableOCSPEndpointCheck=false",
"valid": false,
"warning": false,
"hosts": null,
"auth": null,
"options": {}
},
{
"description": "tlsDisableOCSPEndpointCheck and tlsInsecure both present (and true) raises an error",
"uri": "mongodb://example.com/?tlsDisableOCSPEndpointCheck=true&tlsInsecure=true",
"valid": false,
"warning": false,
"hosts": null,
"auth": null,
"options": {}
},
{
"description": "tlsDisableOCSPEndpointCheck=true and tlsInsecure=false raises an error",
"uri": "mongodb://example.com/?tlsDisableOCSPEndpointCheck=true&tlsInsecure=false",
"valid": false,
"warning": false,
"hosts": null,
"auth": null,
"options": {}
},
{
"description": "tlsDisableOCSPEndpointCheck=false and tlsInsecure=true raises an error",
"uri": "mongodb://example.com/?tlsDisableOCSPEndpointCheck=false&tlsInsecure=true",
"valid": false,
"warning": false,
"hosts": null,
"auth": null,
"options": {}
},
{
"description": "tlsDisableOCSPEndpointCheck and tlsInsecure both present (and false) raises an error",
"uri": "mongodb://example.com/?tlsDisableOCSPEndpointCheck=false&tlsInsecure=false",
"valid": false,
"warning": false,
"hosts": null,
"auth": null,
"options": {}
},
{
"description": "tlsAllowInvalidCertificates and tlsDisableOCSPEndpointCheck both present (and true) raises an error",
"uri": "mongodb://example.com/?tlsAllowInvalidCertificates=true&tlsDisableOCSPEndpointCheck=true",
"valid": false,
"warning": false,
"hosts": null,
"auth": null,
"options": {}
},
{
"description": "tlsAllowInvalidCertificates=true and tlsDisableOCSPEndpointCheck=false raises an error",
"uri": "mongodb://example.com/?tlsAllowInvalidCertificates=true&tlsDisableOCSPEndpointCheck=false",
"valid": false,
"warning": false,
"hosts": null,
"auth": null,
"options": {}
},
{
"description": "tlsAllowInvalidCertificates=false and tlsDisableOCSPEndpointCheck=true raises an error",
"uri": "mongodb://example.com/?tlsAllowInvalidCertificates=false&tlsDisableOCSPEndpointCheck=true",
"valid": false,
"warning": false,
"hosts": null,
"auth": null,
"options": {}
},
{
"description": "tlsAllowInvalidCertificates and tlsDisableOCSPEndpointCheck both present (and false) raises an error",
"uri": "mongodb://example.com/?tlsAllowInvalidCertificates=false&tlsDisableOCSPEndpointCheck=false",
"valid": false,
"warning": false,
"hosts": null,
"auth": null,
"options": {}
},
{
"description": "tlsDisableOCSPEndpointCheck and tlsAllowInvalidCertificates both present (and true) raises an error",
"uri": "mongodb://example.com/?tlsDisableOCSPEndpointCheck=true&tlsAllowInvalidCertificates=true",
"valid": false,
"warning": false,
"hosts": null,
"auth": null,
"options": {}
},
{
"description": "tlsDisableOCSPEndpointCheck=true and tlsAllowInvalidCertificates=false raises an error",
"uri": "mongodb://example.com/?tlsDisableOCSPEndpointCheck=true&tlsAllowInvalidCertificates=false",
"valid": false,
"warning": false,
"hosts": null,
"auth": null,
"options": {}
},
{
"description": "tlsDisableOCSPEndpointCheck=false and tlsAllowInvalidCertificates=true raises an error",
"uri": "mongodb://example.com/?tlsDisableOCSPEndpointCheck=false&tlsAllowInvalidCertificates=true",
"valid": false,
"warning": false,
"hosts": null,
"auth": null,
"options": {}
},
{
"description": "tlsDisableOCSPEndpointCheck and tlsAllowInvalidCertificates both present (and false) raises an error",
"uri": "mongodb://example.com/?tlsDisableOCSPEndpointCheck=false&tlsAllowInvalidCertificates=false",
"valid": false,
"warning": false,
"hosts": null,
"auth": null,
"options": {}
}
]
}