Skip to content

KC-1437: Fix NSF record fields reverting after pam tunnel/connection edit due to stale cache - #2335

Merged
sk-keeper merged 1 commit into
releasefrom
KC-1437
Aug 31, 2026
Merged

KC-1437: Fix NSF record fields reverting after pam tunnel/connection edit due to stale cache#2335
sk-keeper merged 1 commit into
releasefrom
KC-1437

Conversation

@sshrushanth-ks

Copy link
Copy Markdown
Contributor

Summary

NSF record fields were reverting to stale values after pam tunnel edit, pam connection edit, or pam rbi edit when run immediately after nsf-record-update. The initial sync_down_preserving_nsf_keys() refreshed the server cache, but in-memory TypedRecord instances remained stale with old field values. When these commands called update_pam_record(), they read from the stale objects and wrote old values back to the server, overwriting the updates.

Changes

  • keepercommander/commands/pam/vault_target.py: Modified reload_pam_record_if_nsf_updated() to raise CommandError if reload fails after NSF update, preventing field reversion via stale data
  • keepercommander/commands/tunnel_and_connections.py: Removed all try/except blocks wrapping sync_down_preserving_nsf_keys() calls; removed defensive hasattr checks that allowed silent degradation
  • keepercommander/commands/pam_import/record_loader.py: Restored classic-cache-first priority order in load_pam_record() (classic cache → NSF cache fallback)
  • keepercommander/nested_share_folder/record_api.py: Removed unnecessary json.loads(json.dumps()) round-trip, store raw data directly
  • unit-tests/pam/test_pam_rbi_edit.py: Added @mock_sync_decorator to test classes to properly mock sync and load operations
  • unit-tests/pam/test_pam_connection_edit_security.py & unit-tests/pam/test_pam_connection_edit_scrollback.py: Added @mock_sync_decorator to test classes; added return_value=False to update_pam_record mocks in EarlyReturn tests

…edit due to stale cache (#2329)

* KC-1408: Treat first-time share invitations as success in Service Mode (#2325)

* KC-1408: Treat first-time share invitations as success in Service Mode (#2303)

* Treat first-time share invitations as success in Service Mode

* Use ShareInviteSentError so NSF invite success does not mask real share failures

* Fix test imports for deleted pam_debug modules

Remove imports and tests for PAMDebugACLCommand and PAMDebugLinkCommand,
which were deleted in commit 2f1447a. Update test file to only include
tests for modules that still exist.

* added PathDelimiter (#2328)

* KC-1427: Add NSF folder support to list-sf --roe-eligible (#2323)

* Support NSF folders in list-sf --roe-eligible

Add search_nested_share_folders() helper and extend RecordListSfCommand to
include NSF folders with PAM User rotation in --roe-eligible results. Enables
integrations (Slack, Google Chat) to detect PAM eligibility on NSF folders.

* Add NSF folder support to list-sf --roe-eligible with folder_type column

Gate NSF search behind --roe-eligible flag; add folder_type column ('Classic'
or 'Nested') to enable integrations to distinguish classic vs NSF folder UIDs.
Includes test coverage.

* NSF: failed to load record for ls

* Fix NSF record fields reverting after pam tunnel/connection edit due to stale cache

* Fix NSF record fields reverting after pam tunnel edit

Load fresh record from raw cache after sync to avoid stale objects.

* Fix NSF record fields reverting after pam tunnel/connection edit. Reload fresh record from cache after sync to avoid stale TypedRecord instances.

* addressed review comments

* Fix unit test mocks: update_pam_record should return False, remove redundant decorator

---------

Co-authored-by: pvagare-ks <pvagare@keepersecurity.com>
Co-authored-by: Sergey Kolupaev <skolupaev@keepersecurity.com>
@sshrushanth-ks
sshrushanth-ks marked this pull request as ready for review August 31, 2026 11:36
@sshrushanth-ks sshrushanth-ks self-assigned this Aug 31, 2026
@sk-keeper
sk-keeper merged commit 3fe3ade into release Aug 31, 2026
4 checks passed
@sk-keeper
sk-keeper deleted the KC-1437 branch August 31, 2026 16:01
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.

3 participants