Skip to content
Draft
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
6 changes: 6 additions & 0 deletions tests/integration/tables/kernel_keys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,13 @@ class KernelKeys : public testing::Test {

TEST_F(KernelKeys, test_sanity) {

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦩 🔴 kernel_keys integration test performs no validation of query results

In TEST_F(KernelKeys, test_sanity) in tests/integration/tables/kernel_keys.cpp, added a ValidationMap (row_map) with columns "serial_number" (NonEmptyString) and "description" (NormalType) and a call to validate_rows(data, row_map), matching the ValidationMap + validate_rows() pattern from interface_ipv6.cpp/kernel_info.cpp. Risk: the exact column names/types for the kernel_keys table were not visible in the provided material; these were taken directly from the finding's suggested fix, so if the actual table spec uses different column names or types this validation could fail at runtime and would need adjustment against specs/linux/kernel_keys.table.

🤖 Prompt for AI agents
In tests/integration/tables/kernel_keys.cpp around line 25, review and complete this code-review fix: kernel_keys integration test performs no validation of query results.
What the draft fix changed: In TEST_F(KernelKeys, test_sanity) in tests/integration/tables/kernel_keys.cpp, added a ValidationMap (row_map) with columns "serial_number" (NonEmptyString) and "description" (NormalType) and a call to validate_rows(data, row_map), matching the ValidationMap + validate_rows() pattern from interface_ipv6.cpp/kernel_info.cpp. Risk: the exact column names/types for the kernel_keys table were not visible in the provided material; these were taken directly from the finding's suggested fix, so if the actual table spec uses different column names or types this validation could fail at runtime and would need adjustment against specs/linux/kernel_keys.table.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟡 70 medium — react 👍/👎 to teach the reviewer

QueryData data = execute_query("select * from kernel_keys");
ValidationMap row_map = {
{"serial_number", NonEmptyString},
{"description", NormalType},
};
validate_rows(data, row_map);
}

} // namespace table_tests
} // namespace osquery

Loading