Skip to content

Commit 95eceff

Browse files
authored
fix(deps): resolve Dependabot security alerts (pyo3 0.29, js-yaml) (#1324)
pyo3 0.22 -> 0.29 in rust/python clears the out-of-bounds read in PyList/PyTuple iterators (high), missing Sync bound on closures (medium), and PyString::from_object buffer overflow (low); bindings migrated to the 0.29 API. js-yaml 3.14.2 (CVE-2026-53550 merge-key DoS) removed by overriding read-yaml-file -> ^2.1.0 (js-yaml 4.x), the changesets-only consumer.
1 parent ca9f9ee commit 95eceff

5 files changed

Lines changed: 36 additions & 106 deletions

File tree

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@
100100
"picomatch@>=4": "^4.0.4",
101101
"uuid@<11.1.1": "^11.1.1",
102102
"@babel/core": "^7.29.6",
103-
"js-yaml@4": "^4.2.0"
103+
"js-yaml@4": "^4.2.0",
104+
"read-yaml-file": "^2.1.0"
104105
}
105106
}
106107
}

pnpm-lock.yaml

Lines changed: 12 additions & 47 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/python/Cargo.lock

Lines changed: 12 additions & 48 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/python/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ crate-type = ["cdylib"]
1717

1818
[dependencies]
1919
ifc-lite-processing = { path = "../processing" }
20-
pyo3 = { version = "0.22", features = ["extension-module", "abi3-py39"] }
20+
pyo3 = { version = "0.29", features = ["extension-module", "abi3-py39"] }

rust/python/src/lib.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,20 +53,20 @@ fn run_export(ifc_bytes: Vec<u8>) -> Result<GeometryDataExport, String> {
5353
/// elements: { step_id: { ifc_type, color:[r,g,b,a], vertices:bytes,
5454
/// faces:bytes } } }`. Vertices are welded, IFC Z-up, absolute-world metres.
5555
#[pyfunction]
56-
fn geometry_data_buffers(py: Python<'_>, ifc_bytes: Vec<u8>) -> PyResult<PyObject> {
56+
fn geometry_data_buffers(py: Python<'_>, ifc_bytes: Vec<u8>) -> PyResult<Py<PyAny>> {
5757
let export = py
58-
.allow_threads(|| run_export(ifc_bytes))
58+
.detach(|| run_export(ifc_bytes))
5959
.map_err(PyRuntimeError::new_err)?;
6060

61-
let out = PyDict::new_bound(py);
61+
let out = PyDict::new(py);
6262
out.set_item("up_axis", export.up_axis)?;
6363
out.set_item("units", export.units)?;
6464
out.set_item("rtc_offset", export.rtc_offset.to_vec())?;
6565
out.set_item("element_count", export.element_count)?;
6666

67-
let els = PyDict::new_bound(py);
67+
let els = PyDict::new(py);
6868
for (id, el) in &export.elements {
69-
let d = PyDict::new_bound(py);
69+
let d = PyDict::new(py);
7070
d.set_item("ifc_type", &el.ifc_type)?;
7171
d.set_item("color", el.color.to_vec())?;
7272
// Reinterpret the contiguous `[f64;3]` / `[u32;3]` vecs as little-endian
@@ -83,19 +83,19 @@ fn geometry_data_buffers(py: Python<'_>, ifc_bytes: Vec<u8>) -> PyResult<PyObjec
8383
std::mem::size_of_val(el.faces.as_slice()),
8484
)
8585
};
86-
d.set_item("vertices", PyBytes::new_bound(py, vbytes))?;
87-
d.set_item("faces", PyBytes::new_bound(py, fbytes))?;
86+
d.set_item("vertices", PyBytes::new(py, vbytes))?;
87+
d.set_item("faces", PyBytes::new(py, fbytes))?;
8888
els.set_item(*id, d)?;
8989
}
9090
out.set_item("elements", els)?;
91-
Ok(out.into())
91+
Ok(out.into_any().unbind())
9292
}
9393

9494
/// Tessellate IFC bytes; return the `ifc-lite-geometry-data` JSON document.
9595
#[pyfunction]
9696
fn geometry_data_json(py: Python<'_>, ifc_bytes: Vec<u8>) -> PyResult<String> {
9797
let export = py
98-
.allow_threads(|| run_export(ifc_bytes))
98+
.detach(|| run_export(ifc_bytes))
9999
.map_err(PyRuntimeError::new_err)?;
100100
export
101101
.to_json()

0 commit comments

Comments
 (0)