diff --git a/rust/src/openvasd/api_tests/mod.rs b/rust/src/openvasd/api_tests/mod.rs index 0f7ff9bc6..760acd769 100644 --- a/rust/src/openvasd/api_tests/mod.rs +++ b/rust/src/openvasd/api_tests/mod.rs @@ -287,6 +287,18 @@ async fn get_vts_test( .body::>() .snapshot_if(write_snapshots, "body"); + // Include files are retained as synthetic records for feed integrity, but + // the OID-only API must list only public VTs, including NASL and advisories. + assert!(body.iter().all(|oid| !oid.ends_with(".inc"))); + assert!( + body.iter() + .any(|oid| !oid.starts_with("1.3.6.1.4.1.25623.1.1.")) + ); + assert!( + body.iter() + .any(|oid| oid.starts_with("1.3.6.1.4.1.25623.1.1.")) + ); + check_head_endpoints(t, false).await; body } @@ -344,7 +356,8 @@ async fn get_vts_with_information() { .config("basic_feed") .await; - t.request(GET, "/vts?information=1") + let vts = t + .request(GET, "/vts?information=1") .wait_for( StatusCode::OK .with_timeout(Duration::from_millis(100)) @@ -354,6 +367,10 @@ async fn get_vts_with_information() { .assert_status(StatusCode::OK) .body::>() .snapshot("vts"); + + assert!(vts.iter().all(|vt| !vt.filename.ends_with(".inc"))); + assert!(vts.iter().any(|vt| vt.filename == "1.nasl")); + assert!(vts.iter().any(|vt| vt.filename == "test.notus")); } #[tokio::test] diff --git a/rust/src/openvasd/api_tests/snapshots/get_vts_with_information GET __vts?information=1_vts.snap b/rust/src/openvasd/api_tests/snapshots/get_vts_with_information GET __vts?information=1_vts.snap index 382509b3c..8dcbce63a 100644 --- a/rust/src/openvasd/api_tests/snapshots/get_vts_with_information GET __vts?information=1_vts.snap +++ b/rust/src/openvasd/api_tests/snapshots/get_vts_with_information GET __vts?information=1_vts.snap @@ -255,20 +255,4 @@ expression: inner category: gather_info, family: "Test Local Security Checks", ), - VTData( - oid: "plugin_feed_info.inc", - name: "", - filename: "plugin_feed_info.inc", - tag: {}, - dependencies: [], - required_keys: [], - mandatory_keys: [], - excluded_keys: [], - required_ports: [], - required_udp_ports: [], - references: "[redacted]", - preferences: [], - category: end, - family: "", - ), ] diff --git a/rust/src/openvasd/database/sqlite/vts.rs b/rust/src/openvasd/database/sqlite/vts.rs index b8fe2a62e..5a2d14976 100644 --- a/rust/src/openvasd/database/sqlite/vts.rs +++ b/rust/src/openvasd/database/sqlite/vts.rs @@ -65,7 +65,7 @@ impl PluginFetcher for SqlPluginStorage { } fn get_vts(&self) -> StreamResult { - let result = query("SELECT feed_type, json_blob FROM plugins") + let result = query("SELECT feed_type, json_blob FROM plugins WHERE oid NOT LIKE '%inc'") .fetch(&self.pool) .map(|row| { let r = row