Skip to content

Guard against missing name/query keys in scheduled query results - #2691

Open
directionless wants to merge 1 commit into
kolide:mainfrom
directionless:claude/fix-localserver-map-keys
Open

Guard against missing name/query keys in scheduled query results#2691
directionless wants to merge 1 commit into
kolide:mainfrom
directionless:claude/fix-localserver-map-keys

Conversation

@directionless

@directionless directionless commented Apr 12, 2026

Copy link
Copy Markdown
Contributor

osquery_schedule rows are map[string]string; accessing a missing key returns empty string rather than panicking, but passing an empty string as a SQL query to the querier would cause a confusing error. Add explicit presence and emptiness checks before using each value.

@directionless
directionless force-pushed the claude/fix-localserver-map-keys branch from 0322229 to 50dad86 Compare April 13, 2026 18:55
@directionless

Copy link
Copy Markdown
Contributor Author

This feels a little excessive, but I think, not wrong. Perhaps there's some narrow case it the []map[string]string comes back funny

@directionless
directionless marked this pull request as ready for review April 14, 2026 11:40
"scheduled query result missing name or query field",
"query_name", name,
)
results[i].Status = 1

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is there a const we can use for this? Maybe osquery-go's ExtensionCode_EXT_FAILED?

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.

2 participants