Skip to content

fix(OSQUERY-003): RegistryType::add() throws std::runtime_error instead of returning Status::failure() - #42

Draft
flamingo[bot] wants to merge 1 commit into
masterfrom
ai-fix/osquery-003-e06ce834-01e7aadc
Draft

fix(OSQUERY-003): RegistryType::add() throws std::runtime_error instead of returning Status::failure()#42
flamingo[bot] wants to merge 1 commit into
masterfrom
ai-fix/osquery-003-e06ce834-01e7aadc

Conversation

@flamingo

@flamingo flamingo Bot commented Aug 24, 2026

Copy link
Copy Markdown

Closes findings from rule OSQUERY-003 — RegistryType::add() throws std::runtime_error instead of returning Status::failure().

Draft — this is a starting point, not a finished change. The fix required judgment, so read it before trusting it.

# Fix confidence Finding Location
1 🟢 90 high RegistryType::add() throws std::runtime_error instead of returning Status::failure() osquery/registry/registry_interface.h:253

What changed — and what was deliberately left — is explained per finding as inline review comments on the lines each finding touched.


Run: https://product-hub.flamingo.so/admin/code-review
Run id: 01e7aadc-0204-47ef-b373-fc5dbadf3ab5

Merging this PR is recorded as acceptance of the rule that produced it;
closing it unmerged is recorded as rejection. Both feed rule health, so
closing a wrong suggestion is useful rather than merely tidy.

@flamingo flamingo Bot left a comment

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.

🦩 What this fix changed, finding by finding

1 finding(s) fixed in this draft — 1 explained inline on the diff.

Comment on lines 266 to 273
const PluginRef& plugin_item,
bool internal = false) override {
if (nullptr == std::dynamic_pointer_cast<PluginType>(plugin_item)) {
throw std::runtime_error("Cannot add foreign plugin type: " +
plugin_name);
return Status::failure("Cannot add foreign plugin type: " +
plugin_name);
}
return addPlugin(plugin_name, plugin_item, internal);
}

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.

🦩 🔴 RegistryType::add() throws std::runtime_error instead of returning Status::failure()

In RegistryType<PluginType>::add() (registry_interface.h), replaced throw std::runtime_error("Cannot add foreign plugin type: " + plugin_name); with return Status::failure("Cannot add foreign plugin type: " + plugin_name);, matching the surrounding Status-based error handling and the suggested fix exactly. No other lines were changed.

🤖 Prompt for AI agents
In osquery/registry/registry_interface.h around line 253, review and complete this code-review fix: RegistryType::add() throws std::runtime_error instead of returning Status::failure().
What the draft fix changed: In `RegistryType<PluginType>::add()` (registry_interface.h), replaced `throw std::runtime_error("Cannot add foreign plugin type: " + plugin_name);` with `return Status::failure("Cannot add foreign plugin type: " + plugin_name);`, matching the surrounding `Status`-based error handling and the suggested fix exactly. No other lines were changed.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟢 90 high — react 👍/👎 to teach the reviewer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants