Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion rust/src/openvasd/api_tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,18 @@ async fn get_vts_test(
.body::<Vec<String>>()
.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
}
Expand Down Expand Up @@ -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))
Expand All @@ -354,6 +367,10 @@ async fn get_vts_with_information() {
.assert_status(StatusCode::OK)
.body::<Vec<models::VTData>>()
.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]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: "",
),
]
2 changes: 1 addition & 1 deletion rust/src/openvasd/database/sqlite/vts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ impl PluginFetcher for SqlPluginStorage {
}

fn get_vts(&self) -> StreamResult<scannerlib::models::VTData, WorkerError> {
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
Expand Down
Loading