mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-05-08 18:21:55 +00:00
**Problem**: writeConfigFileLocked() accessed c.tx field without synchronization - Function reads c.tx to check if transaction is active (line 109) - c.tx modified by begin/endTransaction under lock, but read without lock - Race condition: c.tx could change between check and use **Impact**: - Inconsistent transaction handling - File could be written directly when it should be staged - Or staged when it should be written directly - Data corruption risk during config imports **Fix** (lines 108-128): - Added documentation that caller MUST hold c.mu lock - Read c.tx into local variable tx while lock is held - Use local copy for transaction check - Safe because all callers hold c.mu when calling writeConfigFileLocked - Transaction field only modified while holding c.mu in begin/endTransaction This maintains the existing contract (callers hold lock) while making the transaction read safe and explicit. |
||
|---|---|---|
| .. | ||
| api_tokens.go | ||
| api_tokens_test.go | ||
| client_helpers.go | ||
| config.go | ||
| credentials.go | ||
| docker_metadata.go | ||
| export.go | ||
| guest_metadata.go | ||
| import_transaction.go | ||
| oidc.go | ||
| persistence.go | ||
| persistence_fail_test.go | ||
| persistence_test.go | ||
| registration.go | ||
| watcher.go | ||