481 Commits

Author SHA1 Message Date
Puskar Basu
3f4eaae1a8 Fix db client deadlocks with non-blocking cleanup and RW locks (#4918) 2025-12-16 21:19:27 +05:30
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
Nathan Wallace
46809b7982 Fix #4708: Thread-safe AddCommands/ResetCommands with mutex (#4904)
* Add test demonstrating race condition in AddCommands/ResetCommands

Added TestAddCommands_Concurrent which exposes data races when
AddCommands() and ResetCommands() are called concurrently.
Running with -race flag shows multiple race condition warnings.

This test demonstrates bug #4708 where these functions are not
thread-safe. While not a practical issue (only called during
single-threaded CLI initialization), proper synchronization
should be added.

Related to #4708

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

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

* Fix race condition in AddCommands/ResetCommands with mutex

Added thread-safe synchronization to AddCommands() and created a
new thread-safe ResetCommands() wrapper using a shared mutex.

The underlying cobra.Command methods are not thread-safe, causing
data races when called concurrently. While these functions are
typically only called during single-threaded CLI initialization,
adding proper synchronization ensures correctness and allows for
safe concurrent usage in tests.

Changes:
- Added commandMutex to protect concurrent access to rootCmd
- Updated AddCommands() with mutex lock/unlock
- Created ResetCommands() wrapper with mutex protection
- Updated test to use the new thread-safe ResetCommands()

Test now passes with -race flag with no warnings.

Fixes #4708

🤖 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:04:22 -05:00
Nathan Wallace
b80aaa1727 Fix #4704: Preserve newlines in getPipedStdinData (#4878)
* Add test for #4704: getPipedStdinData should preserve newlines

* Fix #4704: Preserve newlines in getPipedStdinData
2025-11-16 14:11:56 -05:00
Nathan Wallace
79ab1c9b69 Fix #4707: Add nil check in hideRootFlags (#4880)
* Add test for #4707: hideRootFlags should handle non-existent flags

* Fix #4707: Add nil check in hideRootFlags
2025-11-15 11:16:53 -05:00
Priyanka Chatterjee
8af0f0af88 Update plugin installation logic to skip configuration during plugin updates (#4630) 2025-08-18 13:09:32 +05:30
Puskar Basu
e19d35c457 chore: update module to v2 and bump Go version to 1.24 (#4597) 2025-07-07 16:03:56 +05:30
Puskar Basu
1c9f3ac9fc Merge branch 'v2.0.x' into develop 2025-07-07 13:06:15 +05:30
Puskar Basu
ae106141a7 Fix 'unused' linting errors 2025-06-17 12:20:12 +05:30
frek818
d1136c3c5d exit 1 when a command does not exist (#4564) 2025-06-11 14:59:41 +05:30
Puskar Basu
da2f3ecc03 Upgrade to pipe-fittings v2, go-kit v1 (#4485) 2025-03-06 16:34:18 +05:30
kaidaguerre
8a5aca8f77 Rename CloudMetadata to PipesMetadata, move to pipe-fittings pipes package 2024-10-16 15:48:14 +01:00
kai
112647bae0 tidy 2024-10-15 11:44:13 +01:00
Puskar Basu
2f10d3a566 Remove args 2024-10-08 14:19:38 +05:30
Puskar Basu
ea39c685de removed watch arg from query 2024-10-03 20:08:53 +05:30
Puskar Basu
db57d991bc removed mod-location arg and all references 2024-10-03 20:05:54 +05:30
Puskar Basu
758a100215 finally working 2024-09-27 18:14:28 +05:30
Puskar Basu
0a836584e9 snapshot output and export working 2024-09-27 18:14:28 +05:30
Puskar Basu
9e713885e9 building 2024-09-27 18:14:28 +05:30
kai
1804741bbd tidy 2024-09-27 18:14:28 +05:30
kai
6efd1fd6b2 query display and query result moved to pipe fittings 2024-09-27 18:14:28 +05:30
kai
5fd5ae0740 timing broken 2024-09-27 18:14:28 +05:30
Puskar Basu
08b210797a fix plugin list 2024-09-27 18:14:28 +05:30
Puskar Basu
f72f0165db remove list subcommand 2024-09-27 18:14:28 +05:30
kai
e5b1927a63 tidy imports 2024-09-27 18:14:28 +05:30
kai
33c32756f6 tidy 2024-09-27 18:14:28 +05:30
kai
cb681c67cc compiles but needs testing 2024-09-27 18:14:28 +05:30
kai
7a0e54447c compile fixes, move more utils to pipe-fittings 2024-09-27 18:14:28 +05:30
kai
ef21f1452e steampipe compiles 2024-09-27 18:14:28 +05:30
kai
c5cc5a3e7a compiles and seems to work
connection state not populating
2024-09-27 18:14:28 +05:30
kai
80ad514e1d steampipe compiles 2024-09-27 18:14:28 +05:30
kai
f16cf35a85 working on it 2024-09-27 18:14:28 +05:30
kai
fd94b2e2ec working on it 2024-09-27 18:14:25 +05:30
kai
cd07bf20f1 working on it 2024-09-27 18:13:12 +05:30
kai
faead86d26 move stuff to pipe-fittings 2024-09-27 18:13:12 +05:30
Puskar Basu
394963a520 Revert "initial snapshot refactoring"
This reverts commit 924682ac8c.
2024-09-27 18:13:12 +05:30
Puskar Basu
14299b2c5d Revert "remove use of snapshotRequired"
This reverts commit a5ee02b5cd.
2024-09-27 18:13:12 +05:30
kai
d20cae491c remove use of snapshotRequired
comment out non compiling code for now
2024-09-27 18:13:12 +05:30
Puskar Basu
2049a66719 initial snapshot refactoring 2024-09-27 18:13:12 +05:30
Puskar Basu
e7e1184e95 dashboardexecute -> snapshot 2024-09-27 18:13:12 +05:30
Puskar Basu
6db67846e9 remove dashboard service from service cmd 2024-09-27 18:13:12 +05:30
Puskar Basu
e1b4fad4ff remove mod cmd 2024-09-27 18:13:12 +05:30
Puskar Basu
e958afafaf remove dashboard cmd 2024-09-27 18:13:12 +05:30
Puskar Basu
ce87e26ba7 remove check cmd 2024-09-27 18:13:12 +05:30
Puskar Basu
8619e463f0 remove variable cmd 2024-09-27 18:13:12 +05:30
Puskar Basu
663f4031ea Fix issue where steampipe returned 0 exit code even if failed to export snapshot. Closes #4276 2024-05-21 14:15:40 +01:00
kaidaguerre
07782a2b13 Adds support for verbose timing information. Closes #4237. Closes #4244
- JSON output format has changed to move the rows to under a `rows` property, with timing information under the `metadata` property
- Update timing display to show rows returned and rows fetched, as well as adding verbose mode which lists all scans
- Use enums for output mode and timing mode - timing is now either `on`, `off` or `verbose`
- Bugfix: ensure error is returned from ExecuteSystemClientCall. Closes #4246
2024-04-17 10:12:17 +01:00
Graza
ecefbcc00c Migrate from GCP to GHCR as CR for Plugins. Closes #4232 2024-04-08 15:15:18 +01:00
kaidaguerre
e6e9714e4c Update all ErrorAndWarnings function returns to pass by value, removing possibility of nil ErrorAndWarnings. Closes #3974 (#4212) 2024-03-21 11:46:10 +00:00
Puskar Basu
410fe9ef6f Add deprecation warnings for Mod commands
* print errors and warnings to stderr
* fix tests
* Update description
* update sample workspace profile content
* Changelog for v0.22.0
2024-03-06 11:13:17 +00:00