Skip to content

Commit 5f51827

Browse files
authored
Merge pull request #34 from ignorant05/feature/Add-cargo-audit-to-CI-for-security-checks
Enhacement: Added cargo audit to CI for security checks
2 parents 4885902 + f60c483 commit 5f51827

3 files changed

Lines changed: 15 additions & 8 deletions

File tree

.github/workflows/ci.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,14 @@ jobs:
3434
path: |
3535
~/.cargo/registry
3636
~/.cargo/git
37+
~/.cargo/bin
3738
target
3839
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
3940
restore-keys: ${{ runner.os }}-cargo-
4041

42+
- name: Install cargo-audit
43+
run: cargo install cargo-audit --locked
44+
4145
- name: fmt
4246
run: cargo fmt --all -- --check
4347

@@ -47,6 +51,9 @@ jobs:
4751
- name: tests
4852
run: cargo test --workspace -- --test-threads=1
4953

54+
- name: Security audit
55+
run: cargo audit
56+
5057
python:
5158
name: Python syntax check
5259
runs-on: ubuntu-latest
@@ -57,7 +64,7 @@ jobs:
5764
- name: Set up Python
5865
uses: actions/setup-python@v5
5966
with:
60-
python-version: '3.10'
67+
python-version: "3.10"
6168

6269
- name: Byte-compile nexum_ai
6370
run: python -m compileall nexum_ai

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ resolver = "2"
55
[workspace.dependencies]
66
sled = "0.34"
77
sqlparser = "0.39"
8-
pyo3 = { version = "0.22", features = ["auto-initialize"] }
8+
pyo3 = { version = "0.24", features = ["auto-initialize"] }
99
anyhow = "1.0"
1010
thiserror = "1.0"
1111
tokio = { version = "1.35", features = ["full"] }

nexum_core/src/bridge/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ impl PythonBridge {
1313

1414
pub fn initialize(&mut self) -> Result<()> {
1515
Python::with_gil(|py| {
16-
let sys = py.import_bound("sys")?;
16+
let sys = py.import("sys")?;
1717
let path_attr = sys.getattr("path")?;
1818
let path = path_attr.downcast::<PyList>()?;
1919

@@ -36,7 +36,7 @@ impl PythonBridge {
3636
}
3737

3838
Python::with_gil(|py| {
39-
let nexum_ai = PyModule::import_bound(py, "nexum_ai.optimizer")?;
39+
let nexum_ai = PyModule::import(py, "nexum_ai.optimizer")?;
4040
let semantic_cache = nexum_ai.getattr("SemanticCache")?;
4141
let cache_instance = semantic_cache.call0()?;
4242

@@ -51,7 +51,7 @@ impl PythonBridge {
5151

5252
pub fn test_integration(&self) -> Result<String> {
5353
Python::with_gil(|py| {
54-
let nexum_ai = PyModule::import_bound(py, "nexum_ai.optimizer")?;
54+
let nexum_ai = PyModule::import(py, "nexum_ai.optimizer")?;
5555
let test_func = nexum_ai.getattr("test_vectorization")?;
5656
let result = test_func.call0()?;
5757
let result_str: String = result.str()?.extract()?;
@@ -72,7 +72,7 @@ impl SemanticCache {
7272
bridge.initialize()?;
7373

7474
let cache = Python::with_gil(|py| {
75-
let nexum_ai = PyModule::import_bound(py, "nexum_ai.optimizer")?;
75+
let nexum_ai = PyModule::import(py, "nexum_ai.optimizer")?;
7676
let semantic_cache_class = nexum_ai.getattr("SemanticCache")?;
7777
let cache_instance = semantic_cache_class.call0()?;
7878
Ok::<PyObject, PyErr>(cache_instance.unbind())
@@ -121,7 +121,7 @@ impl NLTranslator {
121121
bridge.initialize()?;
122122

123123
let translator = Python::with_gil(|py| {
124-
let nexum_ai = PyModule::import_bound(py, "nexum_ai.translator")?;
124+
let nexum_ai = PyModule::import(py, "nexum_ai.translator")?;
125125
let translator_class = nexum_ai.getattr("NLTranslator")?;
126126
let translator_instance = translator_class.call0()?;
127127
Ok::<PyObject, PyErr>(translator_instance.unbind())
@@ -152,7 +152,7 @@ mod tests {
152152
fn check_python_available() -> bool {
153153
let mut bridge = PythonBridge::new().unwrap();
154154
bridge.initialize().is_ok()
155-
&& Python::with_gil(|py| PyModule::import_bound(py, "nexum_ai.optimizer").is_ok())
155+
&& Python::with_gil(|py| PyModule::import(py, "nexum_ai.optimizer").is_ok())
156156
}
157157

158158
#[test]

0 commit comments

Comments
 (0)