Files
steampipe/cmd
Nathan Wallace 0d72a57684 Fix #4706: validateQueryArgs thread-safety with config struct (#4905)
* Add test demonstrating validateQueryArgs race condition

Add concurrent test that demonstrates the thread-safety issue with
validateQueryArgs() using global viper state. The test fails with
data races when run with -race flag.

Issue #4706

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Fix validateQueryArgs thread-safety by passing config struct

Replace global viper state access with a queryConfig struct parameter
in validateQueryArgs(). This eliminates race conditions by reading
configuration once in the caller and passing immutable values.

Changes:
- Add queryConfig struct to hold validation parameters
- Update validateQueryArgs to accept config parameter
- Modify runQueryCmd to read viper once and create config
- Update all tests to pass config struct instead of using viper

This makes validateQueryArgs thread-safe and easier to test.

Fixes #4706

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-11-17 04:48:44 -05:00
..