MCPcopy Create free account
hub / github.com/AI45Lab/Code / mtls_rejects_invalid_pem_blob

Function mtls_rejects_invalid_pem_blob

core/src/workspace/remote_git.rs:900–922  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

898
899 #[test]
900 fn mtls_rejects_invalid_pem_blob() {
901 let tmp = tempfile::tempdir().unwrap();
902 let cert = tmp.path().join("cert.pem");
903 let key = tmp.path().join("key.pem");
904 std::fs::write(&cert, b"not a pem").unwrap();
905 std::fs::write(&key, b"also not a pem").unwrap();
906
907 let cfg = RemoteGitBackendConfig::new("http://localhost", "r")
908 .client_cert_pem(&cert)
909 .client_key_pem(&key);
910 let err = RemoteGitBackend::new(cfg).unwrap_err();
911 let msg = err.to_string();
912 assert!(
913 msg.contains("PEM"),
914 "PEM-parse failure must surface clearly, got: {}",
915 msg
916 );
917 assert!(
918 msg.contains(cert.to_str().unwrap()),
919 "error must include the cert path for debugging, got: {}",
920 msg
921 );
922 }
923
924 #[test]
925 fn mtls_accepts_self_signed_pair_from_rcgen() {

Callers

nothing calls this directly

Calls 4

writeFunction · 0.85
pathMethod · 0.80
client_key_pemMethod · 0.80
client_cert_pemMethod · 0.80

Tested by

no test coverage detected