Code graph and memory for your coding agents, in one Rust program. For Claude Code, Codex, Cursor and any MCP client.
Rust agent-memoryai-agentsclaude-codecode-analysiscode-graphcode-intelligencecode-searchcodexcoding-agentscontext-engineeringcursordeveloper-toolsgraphragknowledge-graphlocal-firstmcpmcp-servermodel-context-protocolrusttree-sitter
Graphicle 0.1.4: trust the system's root certificates for HTTPS (#7)
VikramLexeccc97ccb635
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex facd22d..9468deb 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -170,6 +170,20 @@ jobs:env:CRATE: ${{ matrix.crate }}run: echo "::warning title=Windows tests::$CRATE has failing tests on Windows (not gating yet); see the Tests step"+ # The HTTPS clients trust the Windows certificate store: the test adds+ # its own certificate authority to Cert:\LocalMachine\Root, connects+ # without SSL_CERT_FILE and removes the authority again. Not gating yet.+ - name: Windows certificate store+ id: root_store+ if: matrix.crate == 'graphicle-graph'+ continue-on-error: true+ working-directory: ${{ matrix.dir }}+ env:+ GRAPHICLE_TEST_ROOT_STORE: windows+ run: cargo test --locked --test tls_roots+ - name: Report the certificate store test (not gating)+ if: steps.root_store.outcome == 'failure'+ run: echo "::warning title=Windows certificate store::the tls_roots test failed; see the Windows certificate store step"licences:runs-on: ubuntu-latestdiff --git a/CHANGELOG.md b/CHANGELOG.mdindex f932a6c..748e148 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -3,6 +3,38 @@Notable changes to Graphicle: the graph engine (`graphicle-graph`), the memorylibrary (`graphicle-memory`) and the `graphicle` program.+## 0.1.4 - 2026-10-21++Every crate is at 0.1.4, and `graphicle --version` prints+`graphicle 0.1.4 (core)`.++### Connections++- HTTPS connections trust the certificate authorities of the operating+ system as well as the roots bundled with Graphicle: the Windows+ certificate store, the macOS keychains and the system bundle on Linux. A+ model provider whose certificate comes from a company's own certificate+ authority is now reached once that authority is in the system trust+ store, as curl and browsers reach it. Before, only the bundled roots were+ trusted, so such a provider could not be reached (#7, reported by+ @Mohammed-Tabiza). When `SSL_CERT_FILE` or `SSL_CERT_DIR` is set, its+ certificates are read instead of the system's. If the system's+ certificates cannot be used, Graphicle still connects with the bundled+ roots.+- A failed connection to a model provider now gives its cause, for example+ `invalid peer certificate: UnknownIssuer`. When the server's certificate+ is refused, the error also says what to do: install the certificate+ authority in the system trust store, or set `SSL_CERT_FILE` to a PEM file+ that holds it. `graphicle ask` reports that the provider's certificate is+ not trusted, instead of suggesting a network or proxy problem. The graph+ engine's model, pull request triage and URL fetch requests give the same+ causes and hint.++### Other changes++- The Python environments of the engine's comparison suite pin Pillow+ 13.0.0 and certifi 2026.10.19, which fix security advisories.+## 0.1.3 - 2026-10-21Every crate is at 0.1.3, and `graphicle --version` printsdiff --git a/crates/graphicle-graph/Cargo.lock b/crates/graphicle-graph/Cargo.lockindex 5f5fff3..3f611c9 100644--- a/crates/graphicle-graph/Cargo.lock+++ b/crates/graphicle-graph/Cargo.lock@@ -94,6 +94,45 @@ version = "0.7.8"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "d3fb67a6e08acf24fdeccbac2cb6ac4305825bd1f117462e0e6f2f193345ad56"+[[package]]+name = "asn1-rs"+version = "0.7.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b7f43a50ac4fdca5df8e885c21b835997f0a1cdee65494a6847694a98652d9d8"+dependencies = [+ "asn1-rs-derive",+ "asn1-rs-impl",+ "displaydoc",+ "nom 7.1.3",+ "num-traits",+ "rusticata-macros",+ "thiserror",+ "time",+]++[[package]]+name = "asn1-rs-derive"+version = "0.6.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3109e49b1e4909e9db6515a30c633684d68cdeaa252f215214cb4fa1a5bfee2c"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.119",+ "synstructure 0.13.2",+]++[[package]]+name = "asn1-rs-impl"+version = "0.2.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7b18050c2cd6fe86c3a76584ef5e0baf286d038cda203eb6223df2cc413565f7"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.119",+]+[[package]]name = "atoi_simd"version = "0.18.1"@@ -601,7 +640,7 @@ version = "0.8.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3"dependencies = [- "bit-vec",+ "bit-vec 0.8.0",][[package]]@@ -610,6 +649,15 @@ version = "0.8.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7"+[[package]]+name = "bit-vec"+version = "0.9.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b71798fca2c1fe1086445a7258a4bc81e6e49dcd24c8d0dd9a1e57395b603f51"+dependencies = [+ "serde",+]+[[package]]name = "bitflags"version = "2.13.2"@@ -995,6 +1043,12 @@ dependencies = ["parking_lot_core",]+[[package]]+name = "data-encoding"+version = "2.11.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4583a4551df46e2792f82ceeac45e850d2e2d5debba0b91f102385cda5b11f06"+[[package]]name = "deadpool"version = "0.12.3"@@ -1033,6 +1087,20 @@ dependencies = ["syn 2.0.119",]+[[package]]+name = "der-parser"+version = "10.0.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "07da5016415d5a3c4dd39b11ed26f915f52fc4e0dc197d87908bc916e51bc1a6"+dependencies = [+ "asn1-rs",+ "displaydoc",+ "nom 7.1.3",+ "num-bigint 0.4.8",+ "num-traits",+ "rusticata-macros",+]+[[package]]name = "deranged"version = "0.5.8"@@ -1403,7 +1471,7 @@ checksum = "e4eba85ea1d0a966a983acd07deee566e67395d2d96b6fb39e62b5a833f1eb0b"[[package]]name = "graphicle"-version = "0.1.3"+version = "0.1.4"dependencies = ["aws-config","aws-sdk-bedrockruntime",@@ -1451,11 +1519,13 @@ dependencies = ["pq-sys","rand 0.8.8","rand_xorshift",+ "rcgen","redis","regex","reqwest","roxmltree","rustc-hash 2.1.3",+ "rustls","rustpython-parser","serde","serde_json",@@ -1501,7 +1571,7 @@ dependencies = [[[package]]name = "graphicle-graph"-version = "0.1.3"+version = "0.1.4"dependencies = ["graphicle","libmimalloc-sys",@@ -2718,6 +2788,15 @@ dependencies = ["libc",]+[[package]]+name = "oid-registry"+version = "0.8.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "12f40cff3dde1b6087cc5d5f5d4d65712f34016a03ed60e9c08dcc392736b5b7"+dependencies = [+ "asn1-rs",+]+[[package]]name = "once_cell"version = "1.21.4"@@ -3462,6 +3541,19 @@ version = "0.2.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3"+[[package]]+name = "rcgen"+version = "0.14.10"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8774e05a7d0de114588e6a28fe7e71694b82614ed569d86d8b389dfbc98b8ad8"+dependencies = [+ "ring",+ "rustls-pki-types",+ "time",+ "x509-parser",+ "yasna",+]+[[package]]name = "redis"version = "0.32.7"@@ -3564,6 +3656,7 @@ dependencies = ["pin-project-lite","quinn","rustls",+ "rustls-native-certs","rustls-pki-types","serde","serde_json",@@ -3631,6 +3724,15 @@ dependencies = ["semver",]+[[package]]+name = "rusticata-macros"+version = "4.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "faf0c4a6ece9950b9abdb62b1cfcf2a68b3b67a10ba445b3bb85be2a293d0632"+dependencies = [+ "nom 7.1.3",+]+[[package]]name = "rustix"version = "1.1.5"@@ -4137,6 +4239,17 @@ dependencies = ["futures-core",]+[[package]]+name = "synstructure"+version = "0.13.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.119",+]+[[package]]name = "synstructure"version = "0.14.0"@@ -5401,6 +5514,24 @@ version = "0.6.4"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc"+[[package]]+name = "x509-parser"+version = "0.18.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d43b0f71ce057da06bc0851b23ee24f3f86190b07203dd8f567d0b706a185202"+dependencies = [+ "asn1-rs",+ "data-encoding",+ "der-parser",+ "lazy_static",+ "nom 7.1.3",+ "oid-registry",+ "ring",+ "rusticata-macros",+ "thiserror",+ "time",+]+[[package]]name = "xmlparser"version = "0.13.6"@@ -5418,6 +5549,16 @@ dependencies = ["hashlink",]+[[package]]+name = "yasna"+version = "0.6.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b5f6765e852b9b4dc8e2a76843e4d64d1cea8e79bcde0b6901aea8e7c7f08282"+dependencies = [+ "bit-vec 0.9.1",+ "time",+]+[[package]]name = "yoke"version = "0.8.3"@@ -5438,7 +5579,7 @@ dependencies = ["proc-macro2","quote","syn 3.0.6",- "synstructure",+ "synstructure 0.14.0",][[package]]@@ -5479,7 +5620,7 @@ dependencies = ["proc-macro2","quote","syn 3.0.6",- "synstructure",+ "synstructure 0.14.0",][[package]]diff --git a/crates/graphicle-graph/Cargo.toml b/crates/graphicle-graph/Cargo.tomlindex a0da138..01c33a7 100644--- a/crates/graphicle-graph/Cargo.toml+++ b/crates/graphicle-graph/Cargo.toml@@ -1,6 +1,6 @@[package]name = "graphicle"-version = "0.1.3"+version = "0.1.4"edition = "2024"rust-version = "1.94.1"publish = false@@ -58,7 +58,9 @@ glob = "0.3"regex = "1"# Fast hashing for lookup-only tables whose iteration never reaches the output.rustc-hash = "2"-reqwest = { version = "0.12", default-features = false, features = ["blocking", "rustls-tls"] }+# rustls-tls bundles the WebPKI roots; rustls-tls-native-roots adds the+# operating system's certificate authorities (src/net.rs).+reqwest = { version = "0.12", default-features = false, features = ["blocking", "rustls-tls", "rustls-tls-native-roots"] }toml = { version = "0.8", features = ["preserve_order"] }roxmltree = "=0.21.1"# The runtime's error recovery decides what is extracted from files the@@ -155,6 +157,11 @@ oxc_semantic = { version = "=0.139.0", optional = true }oxc_span = { version = "=0.139.0", optional = true }oxc_resolver = { version = "=11.23.0", optional = true }+[dev-dependencies]+# tests/tls_roots.rs: a test certificate authority and an HTTPS server.+rcgen = { version = "0.14", default-features = false, features = ["crypto", "ring"] }+rustls = { version = "0.23", default-features = false, features = ["ring", "std"] }+[target.'cfg(unix)'.dependencies]nix = { version = "0.30", default-features = false, features = ["user", "signal", "process"] }diff --git a/crates/graphicle-graph/cli/Cargo.toml b/crates/graphicle-graph/cli/Cargo.tomlindex 3d1d56e..4d36327 100644--- a/crates/graphicle-graph/cli/Cargo.toml+++ b/crates/graphicle-graph/cli/Cargo.toml@@ -1,6 +1,6 @@[package]name = "graphicle-graph"-version = "0.1.3"+version = "0.1.4"edition = "2024"rust-version = "1.94.1"publish = falsediff --git a/crates/graphicle-graph/licenses/THIRD_PARTY_LICENSES.html b/crates/graphicle-graph/licenses/THIRD_PARTY_LICENSES.htmlindex 0c95565..0520785 100644--- a/crates/graphicle-graph/licenses/THIRD_PARTY_LICENSES.html+++ b/crates/graphicle-graph/licenses/THIRD_PARTY_LICENSES.html@@ -6,7 +6,7 @@<p>This page lists the licenses of third-party crates linked into this package, grouped by license text.</p><h2>Overview</h2><ul>-<li><a href="#Apache-2.0">Apache License 2.0</a> — 346 crate(s)</li>+<li><a href="#Apache-2.0">Apache License 2.0</a> — 348 crate(s)</li><li><a href="#MIT">MIT License</a> — 166 crate(s)</li><li><a href="#Unicode-3.0">Unicode License v3</a> — 24 crate(s)</li><li><a href="#ISC">ISC License</a> — 23 crate(s)</li>@@ -7493,6 +7493,7 @@ limitations under the License.</pre><li><a href="https://github.com/wasm-bindgen/wasm-bindgen/tree/master/crates/web-sys">web-sys 0.3.105</a></li><li><a href="https://github.com/servo/html5ever">web_atoms 0.1.3</a></li><li><a href="https://github.com/RazrFalcon/xmlparser">xmlparser 0.13.6</a></li>+<li><a href="https://github.com/qnighy/yasna.rs">yasna 0.6.0</a></li></ul><pre> Apache LicenseVersion 2.0, January 2004@@ -9911,6 +9912,7 @@ limitations under the License.<li><a href="https://github.com/r-efi/r-efi">r-efi 6.0.0</a></li><li><a href="https://github.com/rust-random/rand">rand 0.10.3</a></li><li><a href="https://github.com/rust-random/rand">rand 0.8.8</a></li>+<li><a href="https://github.com/rustls/rcgen">rcgen 0.14.10</a></li><li><a href="https://github.com/dtolnay/ref-cast">ref-cast-impl 1.0.27</a></li><li><a href="https://github.com/dtolnay/ref-cast">ref-cast 1.0.27</a></li><li><a href="https://github.com/WanzenBug/rle-decode-helper">rle-decode-fast 1.0.3</a></li>diff --git a/crates/graphicle-graph/src/lib.rs b/crates/graphicle-graph/src/lib.rsindex 1738f99..988a1c7 100644--- a/crates/graphicle-graph/src/lib.rs+++ b/crates/graphicle-graph/src/lib.rs@@ -101,6 +101,7 @@ pub mod markdown_resolution;pub mod mcp_ingest;pub mod minhash;pub mod multigraph_compat;+pub mod net;pub mod par;pub mod pascal_resolution;mod path_syntax;diff --git a/crates/graphicle-graph/src/llm_transport.rs b/crates/graphicle-graph/src/llm_transport.rsindex b1840fc..01f0318 100644--- a/crates/graphicle-graph/src/llm_transport.rs+++ b/crates/graphicle-graph/src/llm_transport.rs@@ -531,11 +531,11 @@ impl NativeTransport {llm_parse::cli_envelope(&stdout).map_err(Error::runtime)}fn http(&self, r: &Request) -> Result<Value> {- let client = reqwest::blocking::Client::builder()- .timeout(duration(r.timeout)?)- .connect_timeout(duration(r.timeout)?)- .build()- .map_err(|e| Error::transport(e.to_string()))?;+ let timeout = duration(r.timeout)?;+ let client = crate::net::blocking_client(|builder| {+ builder.timeout(timeout).connect_timeout(timeout)+ })+ .map_err(|e| Error::transport(crate::net::describe(e)))?;let bytes = serde_json::to_vec(&r.body).map_err(|e| Error::value(e.to_string()))?;for attempt in 0..=r.retries {let mut request = client@@ -557,11 +557,7 @@ impl NativeTransport {self.sleep(retry_delay(&headers, attempt));continue;}- return Err(if e.is_timeout() {- Error::timeout(e.to_string())- } else {- Error::transport(e.to_string())- });+ return Err(transport_error(e));}};if status.is_success() {@@ -595,17 +591,22 @@ impl NativeTransport {));continue;}- return Err(if e.is_timeout() {- Error::timeout(e.to_string())- } else {- Error::transport(e.to_string())- });+ return Err(transport_error(e));}}}Err(Error::runtime("HTTP retry budget was invalid"))}}+/// A failed request as a timeout or a transport error, with its causes+/// ([`crate::net::describe`]).+fn transport_error(e: reqwest::Error) -> Error {+ if e.is_timeout() {+ Error::timeout(crate::net::describe(e))+ } else {+ Error::transport(crate::net::describe(e))+ }+}fn duration(s: f64) -> Result<Duration> {Duration::try_from_secs_f64(s).map_err(|_| Error::value("API timeout must be a finite positive duration"))diff --git a/crates/graphicle-graph/src/net.rs b/crates/graphicle-graph/src/net.rsnew file mode 100644index 0000000..6ec811e--- /dev/null+++ b/crates/graphicle-graph/src/net.rs@@ -0,0 +1,106 @@+//! HTTPS clients, and connection errors that say why they failed.+//!+//! Every client trusts the WebPKI roots bundled with the program and the+//! operating system's certificate authorities: the Windows certificate store,+//! the macOS keychains, or the system bundle on Linux and other Unix systems.+//! When `SSL_CERT_FILE` or `SSL_CERT_DIR` is set, the certificates there are+//! read instead of the system's. A certificate authority of a company network+//! that curl and browsers trust is therefore trusted here too.++/// A client from `configure`, which sets everything except the roots. When+/// the system's roots cannot be used (the store holds no certificate that+/// parses), the client is built again with the bundled roots alone, so it+/// still reaches servers with public certificates.+pub fn client(+ configure: impl Fn(reqwest::ClientBuilder) -> reqwest::ClientBuilder,+) -> reqwest::Result<reqwest::Client> {+ configure(reqwest::Client::builder())+ .build()+ .or_else(|_| configure(reqwest::Client::builder().tls_built_in_native_certs(false)).build())+}++/// [`client`] for the blocking API.+pub fn blocking_client(+ configure: impl Fn(reqwest::blocking::ClientBuilder) -> reqwest::blocking::ClientBuilder,+) -> reqwest::Result<reqwest::blocking::Client> {+ configure(reqwest::blocking::Client::builder())+ .build()+ .or_else(|_| {+ configure(reqwest::blocking::Client::builder().tls_built_in_native_certs(false)).build()+ })+}++/// What to do when a server's certificate is refused.+pub const CERTIFICATE_HINT: &str = "If a private certificate authority issued the server's certificate, install that CA in the system trust store, or set SSL_CERT_FILE to a PEM file that holds it.";++/// The causes under a failed request, joined by ": ", for example+/// `client error (Connect): invalid peer certificate: UnknownIssuer`; empty+/// when there is none. reqwest's own message, which names the URL, is left+/// out.+pub fn causes(error: &reqwest::Error) -> String {+ let mut parts: Vec<String> = Vec::new();+ let mut next = std::error::Error::source(error);+ while let Some(cause) = next {+ let text = cause.to_string();+ if !text.is_empty() && parts.last() != Some(&text) {+ parts.push(text);+ }+ next = cause.source();+ }+ parts.join(": ")+}++/// Whether an error's text says that the server's certificate was refused.+pub fn certificate_refused(text: &str) -> bool {+ text.contains("invalid peer certificate") || text.contains("UnknownIssuer")+}++/// `text`, followed by [`CERTIFICATE_HINT`] when the server's certificate+/// was refused.+pub fn with_hint(text: String) -> String {+ if certificate_refused(&text) {+ format!("{}. {CERTIFICATE_HINT}", text.trim_end_matches('.'))+ } else {+ text+ }+}++/// A failed request for people: reqwest's message, whose URL keeps no+/// credentials, query or fragment, then the [`causes`], with+/// [`CERTIFICATE_HINT`] when the server's certificate was refused.+pub fn describe(mut error: reqwest::Error) -> String {+ if let Some(url) = error.url_mut() {+ let _ = url.set_username("");+ let _ = url.set_password(None);+ url.set_query(None);+ url.set_fragment(None);+ }+ let mut text = error.to_string();+ let causes = causes(&error);+ if !causes.is_empty() {+ text = format!("{text}: {causes}");+ }+ with_hint(text)+}++#[cfg(test)]+mod tests {+ use super::*;++ #[test]+ fn the_hint_follows_a_refused_certificate_only() {+ let refused = with_hint(+ "error sending request: client error (Connect): invalid peer certificate: UnknownIssuer"+ .into(),+ );+ assert!(refused.ends_with(&format!("UnknownIssuer. {CERTIFICATE_HINT}")));+ let refused_connection = "error sending request: client error (Connect): tcp connect error: Connection refused (os error 111)";+ assert_eq!(with_hint(refused_connection.into()), refused_connection);+ }++ #[test]+ fn a_client_builds_with_the_system_roots_and_the_bundled_roots() {+ assert!(client(|builder| builder).is_ok());+ assert!(blocking_client(|builder| builder).is_ok());+ }+}diff --git a/crates/graphicle-graph/src/prs_triage.rs b/crates/graphicle-graph/src/prs_triage.rsindex e18b039..187a4d4 100644--- a/crates/graphicle-graph/src/prs_triage.rs+++ b/crates/graphicle-graph/src/prs_triage.rs@@ -241,10 +241,9 @@ impl Triage for NativeTriage {)};let body = json!({"model":model,"max_tokens":1024,"stream":true,"messages":[{"role":"user","content":prompt}]});- let client = reqwest::blocking::Client::builder()- .timeout(Duration::from_secs(600))- .build()- .map_err(crate::Error::from)?;+ let client =+ crate::net::blocking_client(|builder| builder.timeout(Duration::from_secs(600)))+ .map_err(crate::Error::from)?;for attempt in 0..3 {let mut request = client.post(&url)@@ -277,7 +276,7 @@ impl Triage for NativeTriage {.runtime.transport.sleep(Duration::from_millis(500u64 << attempt)),- Err(e) => return Err(e.into()),+ Err(e) => return Err(crate::Error::External(crate::net::describe(e))),}}unreachable!()diff --git a/crates/graphicle-graph/src/security.rs b/crates/graphicle-graph/src/security.rsindex 857c466..31ef20e 100644--- a/crates/graphicle-graph/src/security.rs+++ b/crates/graphicle-graph/src/security.rs@@ -234,19 +234,20 @@ fn http_error(error: reqwest::Error) -> String {details.push(error.to_string());cause = error.source();}- format!("URLError: {}", details.join(": "))+ crate::net::with_hint(format!("URLError: {}", details.join(": ")))}impl Transport for PinnedHttpTransport {fn get(&mut self, url: &Url, address: SocketAddr, timeout: Duration) -> Result<FetchResponse> {let host = url.host_str().ok_or("ValueError: URL has no hostname")?;- let client = reqwest::blocking::Client::builder()- .no_proxy()- .redirect(reqwest::redirect::Policy::none())- .timeout(timeout)- .resolve_to_addrs(host, &[address])- .user_agent(concat!("Mozilla/5.0 graphicle/", env!("CARGO_PKG_VERSION")))- .build()- .map_err(http_error)?;+ let client = crate::net::blocking_client(|builder| {+ builder+ .no_proxy()+ .redirect(reqwest::redirect::Policy::none())+ .timeout(timeout)+ .resolve_to_addrs(host, &[address])+ .user_agent(concat!("Mozilla/5.0 graphicle/", env!("CARGO_PKG_VERSION")))+ })+ .map_err(http_error)?;// The URL keeps the original hostname for Host, SNI and certificate checks.let response = client.get(url.clone()).send().map_err(http_error)?;let status = response.status().as_u16();diff --git a/crates/graphicle-graph/tests/tls_roots.rs b/crates/graphicle-graph/tests/tls_roots.rsnew file mode 100644index 0000000..9fb160e--- /dev/null+++ b/crates/graphicle-graph/tests/tls_roots.rs@@ -0,0 +1,249 @@+//! The HTTPS clients of `graphicle::net` trust the operating system's+//! certificate authorities, which `SSL_CERT_FILE` and `SSL_CERT_DIR` replace+//! when set, and a refused certificate fails with the causes and a hint.+//!+//! An HTTPS server on 127.0.0.1 presents a certificate from a certificate+//! authority made for this test, which neither the bundled roots nor the+//! system's hold. The test sets environment variables, so this file holds a+//! single test: its binary runs nothing else at the same time.+//!+//! On Windows with GRAPHICLE_TEST_ROOT_STORE=windows (the Windows CI job), the+//! test also adds its CA to the computer's Trusted Root store (certutil, which+//! needs an administrator), connects without SSL_CERT_FILE and removes the CA+//! again.+use std::io::{Read, Write};+use std::net::TcpListener;+use std::path::Path;+use std::sync::Arc;++use graphicle::net;++const BODY: &str = "{\"ok\":true}";++struct Authority {+ pem: String,+ der: Vec<u8>,+ server: rustls::ServerConfig,+}++fn authority() -> Authority {+ let mut params = rcgen::CertificateParams::new(Vec::<String>::new()).unwrap();+ params.is_ca = rcgen::IsCa::Ca(rcgen::BasicConstraints::Unconstrained);+ params+ .distinguished_name+ .push(rcgen::DnType::CommonName, "Graphicle test CA");+ params.key_usages = vec![+ rcgen::KeyUsagePurpose::KeyCertSign,+ rcgen::KeyUsagePurpose::CrlSign,+ ];+ let ca =+ rcgen::CertifiedIssuer::self_signed(params, rcgen::KeyPair::generate().unwrap()).unwrap();+ let key = rcgen::KeyPair::generate().unwrap();+ let mut params =+ rcgen::CertificateParams::new(vec!["127.0.0.1".to_string(), "localhost".to_string()])+ .unwrap();+ params+ .distinguished_name+ .push(rcgen::DnType::CommonName, "127.0.0.1");+ let certificate = params.signed_by(&key, &ca).unwrap();+ let server = rustls::ServerConfig::builder_with_provider(Arc::new(+ rustls::crypto::ring::default_provider(),+ ))+ .with_safe_default_protocol_versions()+ .unwrap()+ .with_no_client_auth()+ .with_single_cert(+ vec![certificate.der().clone()],+ rustls::pki_types::PrivateKeyDer::Pkcs8(key.serialize_der().into()),+ )+ .unwrap();+ Authority {+ pem: pem(ca.der()),+ der: ca.der().to_vec(),+ server,+ }+}++/// A certificate in PEM.+fn pem(der: &[u8]) -> String {+ use base64::Engine;+ let text = base64::engine::general_purpose::STANDARD.encode(der);+ let lines: Vec<&str> = text+ .as_bytes()+ .chunks(64)+ .map(|line| std::str::from_utf8(line).unwrap())+ .collect();+ format!(+ "-----BEGIN CERTIFICATE-----\n{}\n-----END CERTIFICATE-----\n",+ lines.join("\n")+ )+}++/// An HTTPS server on 127.0.0.1 that answers every request with [`BODY`];+/// its address.+fn serve(config: rustls::ServerConfig) -> String {+ let config = Arc::new(config);+ let listener = TcpListener::bind("127.0.0.1:0").unwrap();+ let port = listener.local_addr().unwrap().port();+ std::thread::spawn(move || {+ for stream in listener.incoming().flatten() {+ let config = config.clone();+ std::thread::spawn(move || {+ let Ok(connection) = rustls::ServerConnection::new(config) else {+ return;+ };+ let mut tls = rustls::StreamOwned::new(connection, stream);+ let mut request = Vec::new();+ let mut buffer = [0; 4096];+ while !request.windows(4).any(|window| window == b"\r\n\r\n") {+ match tls.read(&mut buffer) {+ Ok(0) | Err(_) => return,+ Ok(n) => request.extend_from_slice(&buffer[..n]),+ }+ }+ let reply = format!(+ "HTTP/1.1 200 OK\r\ncontent-type: application/json\r\ncontent-length: {}\r\nconnection: close\r\n\r\n{BODY}",+ BODY.len()+ );+ let _ = tls.write_all(reply.as_bytes());+ tls.conn.send_close_notify();+ let _ = tls.flush();+ });+ }+ });+ format!("https://127.0.0.1:{port}/v1/models")+}++/// Sets or removes SSL_CERT_FILE and SSL_CERT_DIR.+fn roots_from(file: Option<&Path>, dir: Option<&Path>) {+ // SAFETY: this test binary runs one test, and no other thread reads the+ // environment while it changes.+ unsafe {+ match file {+ Some(file) => std::env::set_var("SSL_CERT_FILE", file),+ None => std::env::remove_var("SSL_CERT_FILE"),+ }+ match dir {+ Some(dir) => std::env::set_var("SSL_CERT_DIR", dir),+ None => std::env::remove_var("SSL_CERT_DIR"),+ }+ }+}++/// The body from `url` with both clients, or the error text: the blocking+/// client's [`net::describe`], and the async client's causes with the hint.+fn fetch(url: &str) -> Result<String, String> {+ let blocking = net::blocking_client(|builder| builder.no_proxy())+ .expect("the blocking client builds")+ .get(url)+ .send()+ .and_then(|response| response.error_for_status()?.text())+ .map_err(net::describe);+ let runtime = tokio::runtime::Builder::new_current_thread()+ .enable_all()+ .build()+ .unwrap();+ let asynchronous = runtime.block_on(async {+ let client = net::client(|builder| builder.no_proxy()).expect("the async client builds");+ match client.get(url).send().await {+ Ok(response) => response.text().await.map_err(|error| error.to_string()),+ Err(error) => Err(net::with_hint(net::causes(&error))),+ }+ });+ match (blocking, asynchronous) {+ (Ok(a), Ok(b)) => {+ assert_eq!(a, b);+ Ok(a)+ }+ (Err(a), Err(b)) => {+ assert!(net::certificate_refused(&b), "async client: {b}");+ Err(a)+ }+ (a, b) => panic!("the clients disagree: blocking {a:?}, async {b:?}"),+ }+}++fn assert_refused(result: Result<String, String>, case: &str) {+ let error = result.expect_err(case);+ assert!(+ error.contains("invalid peer certificate: UnknownIssuer"),+ "{case}: {error}"+ );+ assert!(error.ends_with(net::CERTIFICATE_HINT), "{case}: {error}");+}++#[test]+fn https_clients_trust_the_system_roots_and_ssl_cert_file() {+ let authority = authority();+ let url = serve(authority.server);+ let folder = tempfile::tempdir().unwrap();+ let ca = folder.path().join("ca.pem");+ std::fs::write(&ca, &authority.pem).unwrap();+ let not_a_certificate = folder.path().join("broken.pem");+ std::fs::write(+ ¬_a_certificate,+ "-----BEGIN CERTIFICATE-----\nMAA=\n-----END CERTIFICATE-----\n",+ )+ .unwrap();+ let directory = folder.path().join("certs");+ std::fs::create_dir(&directory).unwrap();+ std::fs::write(directory.join("ca.pem"), &authority.pem).unwrap();++ // Neither the bundled roots nor the system's hold the test CA.+ roots_from(None, None);+ assert_refused(fetch(&url), "without SSL_CERT_FILE");++ // SSL_CERT_FILE or SSL_CERT_DIR naming the CA: trusted.+ roots_from(Some(&ca), None);+ assert_eq!(fetch(&url).as_deref(), Ok(BODY));+ roots_from(None, Some(&directory));+ assert_eq!(fetch(&url).as_deref(), Ok(BODY));++ // A file with no usable certificate, which reqwest refuses to build a+ // client with: the clients still build, with the bundled roots alone.+ roots_from(Some(¬_a_certificate), None);+ assert!(reqwest::blocking::Client::builder().build().is_err());+ assert_refused(fetch(&url), "with a broken SSL_CERT_FILE");+ roots_from(None, None);++ if cfg!(windows) && std::env::var("GRAPHICLE_TEST_ROOT_STORE").as_deref() == Ok("windows") {+ windows_root_store(&url, &authority.der, folder.path());+ }+}++/// The test CA in the computer's Trusted Root store: trusted without+/// SSL_CERT_FILE. The CA is removed again, also when the check fails.+fn windows_root_store(url: &str, der: &[u8], folder: &Path) {+ use sha1::Digest;+ let file = folder.join("ca.cer");+ std::fs::write(&file, der).unwrap();+ let thumbprint: String = sha1::Sha1::digest(der)+ .iter()+ .map(|byte| format!("{byte:02x}"))+ .collect();+ let certutil = |args: &[&std::ffi::OsStr]| {+ let status = std::process::Command::new("certutil")+ .args(args)+ .status()+ .expect("certutil runs");+ assert!(status.success(), "certutil {args:?}: {status}");+ };+ struct Remove<F: Fn()>(F);+ impl<F: Fn()> Drop for Remove<F> {+ fn drop(&mut self) {+ (self.0)();+ }+ }+ certutil(&[+ "-f".as_ref(),+ "-addstore".as_ref(),+ "Root".as_ref(),+ file.as_os_str(),+ ]);+ let _remove = Remove(|| {+ let _ = std::process::Command::new("certutil")+ .args(["-delstore", "Root", &thumbprint])+ .status();+ });+ assert_eq!(fetch(url).as_deref(), Ok(BODY));+}diff --git a/crates/graphicle-graph/tools/comparison-requirements.txt b/crates/graphicle-graph/tools/comparison-requirements.txtindex 182b40a..e635d75 100644--- a/crates/graphicle-graph/tools/comparison-requirements.txt+++ b/crates/graphicle-graph/tools/comparison-requirements.txt@@ -7,11 +7,12 @@## Rebuild: uv venv --python 3.12.13 crates/graphicle/.comparison-venv# uv pip install --python crates/graphicle/.comparison-venv/bin/python -r tools/comparison-requirements.txt+# certifi is 2026.10.19 (security advisory) instead of the recorded 2026.7.22.annotated-types==0.8.0anyio==4.15.1attrs==26.1.0backoff==2.2.1-certifi==2026.7.22+certifi==2026.10.19charset-normalizer==3.5.1distro==1.9.0graphiti-core==0.30.2diff --git a/crates/graphicle-graph/tools/reference-requirements.txt b/crates/graphicle-graph/tools/reference-requirements.txtindex c407930..f7800ff 100644--- a/crates/graphicle-graph/tools/reference-requirements.txt+++ b/crates/graphicle-graph/tools/reference-requirements.txt@@ -17,6 +17,7 @@# Rebuild: uv venv --python 3.12.13 .reference-venv# uv pip install --python .reference-venv/bin/python -r tools/reference-requirements.txt# then write the .pth file naming the comparison venv's site-packages.+# pillow is 13.0.0 (security advisories) instead of the recorded 12.3.0.annotated-types==0.8.0anthropic==1.8.0anyio==4.15.1@@ -39,7 +40,7 @@ lxml==6.1.3neo4j==6.3.1numpy==2.5.3openpyxl==3.1.5-pillow==12.3.0+pillow==13.0.0psycopg==3.3.6psycopg-binary==3.3.6pydantic==2.13.5diff --git a/crates/graphicle-memory/Cargo.lock b/crates/graphicle-memory/Cargo.lockindex 9dcd53c..11e4a10 100644--- a/crates/graphicle-memory/Cargo.lock+++ b/crates/graphicle-memory/Cargo.lock@@ -1453,7 +1453,7 @@ checksum = "e4eba85ea1d0a966a983acd07deee566e67395d2d96b6fb39e62b5a833f1eb0b"[[package]]name = "graphicle"-version = "0.1.3"+version = "0.1.4"dependencies = ["aws-config","aws-sdk-bedrockruntime",@@ -1551,7 +1551,7 @@ dependencies = [[[package]]name = "graphicle-memory"-version = "0.1.3"+version = "0.1.4"dependencies = ["chrono","graphicle",@@ -3670,6 +3670,7 @@ dependencies = ["pin-project-lite","quinn","rustls",+ "rustls-native-certs","rustls-pki-types","serde","serde_json",diff --git a/crates/graphicle-memory/Cargo.toml b/crates/graphicle-memory/Cargo.tomlindex 54287ee..022f717 100644--- a/crates/graphicle-memory/Cargo.toml+++ b/crates/graphicle-memory/Cargo.toml@@ -1,6 +1,6 @@[package]name = "graphicle-memory"-version = "0.1.3"+version = "0.1.4"edition = "2024"rust-version = "1.94.1"publish = falsediff --git a/crates/graphicle/Cargo.lock b/crates/graphicle/Cargo.lockindex 323eb56..8d6dc90 100644--- a/crates/graphicle/Cargo.lock+++ b/crates/graphicle/Cargo.lock@@ -1327,7 +1327,7 @@ dependencies = [[[package]]name = "graphicle"-version = "0.1.3"+version = "0.1.4"dependencies = ["base64 0.22.1","calamine",@@ -1421,7 +1421,7 @@ dependencies = [[[package]]name = "graphicle-memory"-version = "0.1.3"+version = "0.1.4"dependencies = ["chrono","graphicle",@@ -1439,7 +1439,7 @@ dependencies = [[[package]]name = "graphicle-runtime"-version = "0.1.3"+version = "0.1.4"dependencies = ["aes-gcm","axum",@@ -1739,6 +1739,7 @@ dependencies = ["hyper","hyper-util","rustls",+ "rustls-native-certs","tokio","tokio-rustls","tower-service",@@ -3809,6 +3810,7 @@ dependencies = ["pin-project-lite","quinn","rustls",+ "rustls-native-certs","rustls-pki-types","serde","serde_json",diff --git a/crates/graphicle/Cargo.toml b/crates/graphicle/Cargo.tomlindex c3d36a9..528cc02 100644--- a/crates/graphicle/Cargo.toml+++ b/crates/graphicle/Cargo.toml@@ -1,6 +1,6 @@[package]name = "graphicle-runtime"-version = "0.1.3"+version = "0.1.4"edition = "2024"rust-version = "1.94.1"publish = false@@ -28,7 +28,7 @@ graphicle = { path = "../graphicle-graph" }axum = "0.8"tokio = { version = "1", features = ["macros", "rt-multi-thread", "signal", "time", "sync", "fs", "io-util", "io-std"] }rusqlite = { version = "0.37", features = ["bundled", "backup"] }-reqwest = { version = "0.12", default-features = false, features = ["rustls-tls", "json", "gzip"] }+reqwest = { version = "0.12", default-features = false, features = ["rustls-tls", "rustls-tls-native-roots", "json", "gzip"] }serde = { version = "1", features = ["derive"] }serde_json = { version = "1", features = ["preserve_order"] }chrono = { version = "0.4", features = ["serde"] }diff --git a/crates/graphicle/README.md b/crates/graphicle/README.mdindex f80e288..71104ce 100644--- a/crates/graphicle/README.md+++ b/crates/graphicle/README.md@@ -55,7 +55,7 @@ operations through the extension registry (`src/extension.rs`).provider permission mode ("is not part of Graphicle Core"), while it still enforcesthe provider permissions an existing store holds.- `build.info` reports the edition and its capabilities, and- `graphicle --version` prints it (`graphicle 0.1.3 (core)`).+ `graphicle --version` prints it (`graphicle 0.1.4 (core)`).- A store keeps every table when either edition opens it, and Core keeps theother edition's guarantees on a store it has used (`src/store_compat.rs`).diff --git a/crates/graphicle/src/model.rs b/crates/graphicle/src/model.rsindex c2b7099..2d96055 100644--- a/crates/graphicle/src/model.rs+++ b/crates/graphicle/src/model.rs@@ -352,13 +352,27 @@ pub fn provider_url_with(value: &str, credential: bool, hosts: &[String]) -> Respub fn client() -> Result<reqwest::Client> {client_with_timeout(Duration::from_secs(180))}+/// An HTTP client for model providers and other services: it trusts the+/// operating system's certificate authorities as well as the bundled roots+/// (`graphicle::net::client`), and never follows a redirect.pub fn client_with_timeout(timeout: Duration) -> Result<reqwest::Client> {- reqwest::Client::builder()- .redirect(reqwest::redirect::Policy::none())- .connect_timeout(Duration::from_secs(15))- .timeout(timeout)- .build()- .map_err(|_| Error::bad("Cannot construct HTTP client"))+ graphicle::net::client(|builder| {+ builder+ .redirect(reqwest::redirect::Policy::none())+ .connect_timeout(Duration::from_secs(15))+ .timeout(timeout)+ })+ .map_err(|_| Error::bad("Cannot construct HTTP client"))+}+/// `what`, then the causes of `error` (`graphicle::net::causes`) and a hint+/// when the server's certificate was refused. The URL is left out.+fn request_failure(what: &str, error: &reqwest::Error) -> String {+ let causes = graphicle::net::causes(error);+ if causes.is_empty() {+ what.to_string()+ } else {+ graphicle::net::with_hint(format!("{what}: {causes}"))+ }}pub async fn bounded_json(mut response: reqwest::Response) -> Result<Value> {if !response.status().is_success() {@@ -689,7 +703,7 @@ pub async fn generate_with_credential(.send().await.map_err(|error| {- Error::bad(if error.is_timeout() && error.is_connect() {+ let what = if error.is_timeout() && error.is_connect() {"Provider connection timed out before a response"} else if error.is_timeout() {"Provider request timed out; usage may be unknown"@@ -697,7 +711,8 @@ pub async fn generate_with_credential("Could not establish the provider connection"} else {"Provider request failed before a response; usage may be unknown"- })+ };+ Error::bad(request_failure(what, &error))})?;let value = provider_json(response, credential).await?;reply(p, &value, estimated, start)@@ -1172,7 +1187,9 @@ pub async fn embed_role(.json(&body).send().await- .map_err(|_| Error::bad("Embedding provider request failed"))?,+ .map_err(|error| {+ Error::bad(request_failure("Embedding provider request failed", &error))+ })?,credential,).await?;diff --git a/crates/graphicle/src/terminal.rs b/crates/graphicle/src/terminal.rsindex 4c16c2f..3f0b9e1 100644--- a/crates/graphicle/src/terminal.rs+++ b/crates/graphicle/src/terminal.rs@@ -789,9 +789,11 @@ pub fn this_folders_server(directory: &Path, port: u16) -> bool {/// An HTTP client for this computer's own servers: never through a proxy/// (`HTTP_PROXY` would send a request, and its credentials, elsewhere),-/// never following a redirect.+/// never following a redirect. It speaks plain HTTP to 127.0.0.1 only, so it+/// does not read the system's certificate authorities.fn loopback_client() -> Result<reqwest::Client> {reqwest::Client::builder()+ .tls_built_in_native_certs(false).no_proxy().redirect(reqwest::redirect::Policy::none()).connect_timeout(Duration::from_secs(2))@@ -3547,6 +3549,8 @@ pub fn job_failure(job: &Value, model: Option<&ModelState>) -> String {"The provider is limiting requests for this key, or its credit ran out. Wait a minute and ask again, or check your plan.".into()} else if status.is_some_and(|code| code >= 500) {"The provider failed. Ask again in a minute.".into()+ } else if graphicle::net::certificate_refused(error) {+ format!("Could not reach {address}: its certificate is not trusted.")} else if error.contains("Could not establish the provider connection")|| error.contains("connection timed out"){@@ -5979,6 +5983,22 @@ args = ["-y", "thing"]).contains("ollama serve"));+ // A refused certificate names the provider and keeps the causes and the hint.+ let untrusted = job_failure(+ &failed(&graphicle::net::with_hint(+ "Could not establish the provider connection: client error (Connect): invalid peer certificate: UnknownIssuer".into(),+ )),+ Some(&model),+ );+ assert!(+ untrusted.starts_with(&format!(+ "Could not reach {}: its certificate is not trusted.",+ model.base_url+ )),+ "{untrusted}"+ );+ assert!(untrusted.contains("UnknownIssuer"), "{untrusted}");+ assert!(untrusted.contains("set SSL_CERT_FILE"), "{untrusted}");assert!(job_failure(&failed("Provider returned HTTP 404"), Some(&ollama)).contains("ollama pull qwen3:4b")diff --git a/docs/install.md b/docs/install.mdindex b82490f..54073ad 100644--- a/docs/install.md+++ b/docs/install.md@@ -16,7 +16,7 @@ step.```shbrew install graphicle-ai/tap/graphicle-graphicle --version # graphicle 0.1.3 (core)+graphicle --version # graphicle 0.1.4 (core)````brew upgrade graphicle` installs a new release. Afterwards, read@@ -149,7 +149,7 @@ folder with both programs, `LICENSE`, `NOTICE`, `NOTICE.md`, `README.md`,| Windows, x86-64 (preview) | `x86_64-pc-windows-msvc`, a `.zip` |```sh-version=0.1.3+version=0.1.4target=aarch64-apple-darwinbase=https://github.com/graphicle-ai/graphicle/releases/download/v$versioncurl -fLO "$base/graphicle-$version-$target.tar.gz"@@ -243,7 +243,7 @@ in them.## Check the installation```sh-graphicle --version # graphicle 0.1.3 (core)+graphicle --version # graphicle 0.1.4 (core)graphicle graph --help # the code-graph engine's commandsgraphicle doctor # checks the programs, the data folder and your agents```diff --git a/licenses/graphicle-graph/licenses/THIRD_PARTY_LICENSES.html b/licenses/graphicle-graph/licenses/THIRD_PARTY_LICENSES.htmlindex 0c95565..0520785 100644--- a/licenses/graphicle-graph/licenses/THIRD_PARTY_LICENSES.html+++ b/licenses/graphicle-graph/licenses/THIRD_PARTY_LICENSES.html@@ -6,7 +6,7 @@<p>This page lists the licenses of third-party crates linked into this package, grouped by license text.</p><h2>Overview</h2><ul>-<li><a href="#Apache-2.0">Apache License 2.0</a> — 346 crate(s)</li>+<li><a href="#Apache-2.0">Apache License 2.0</a> — 348 crate(s)</li><li><a href="#MIT">MIT License</a> — 166 crate(s)</li><li><a href="#Unicode-3.0">Unicode License v3</a> — 24 crate(s)</li><li><a href="#ISC">ISC License</a> — 23 crate(s)</li>@@ -7493,6 +7493,7 @@ limitations under the License.</pre><li><a href="https://github.com/wasm-bindgen/wasm-bindgen/tree/master/crates/web-sys">web-sys 0.3.105</a></li><li><a href="https://github.com/servo/html5ever">web_atoms 0.1.3</a></li><li><a href="https://github.com/RazrFalcon/xmlparser">xmlparser 0.13.6</a></li>+<li><a href="https://github.com/qnighy/yasna.rs">yasna 0.6.0</a></li></ul><pre> Apache LicenseVersion 2.0, January 2004@@ -9911,6 +9912,7 @@ limitations under the License.<li><a href="https://github.com/r-efi/r-efi">r-efi 6.0.0</a></li><li><a href="https://github.com/rust-random/rand">rand 0.10.3</a></li><li><a href="https://github.com/rust-random/rand">rand 0.8.8</a></li>+<li><a href="https://github.com/rustls/rcgen">rcgen 0.14.10</a></li><li><a href="https://github.com/dtolnay/ref-cast">ref-cast-impl 1.0.27</a></li><li><a href="https://github.com/dtolnay/ref-cast">ref-cast 1.0.27</a></li><li><a href="https://github.com/WanzenBug/rle-decode-helper">rle-decode-fast 1.0.3</a></li>