Skip to content

Fix import command/only update if same folder#2176

Open
lthievenaz-keeper wants to merge 3 commits into
Keeper-Security:releasefrom
lthievenaz-keeper:fix-import-command/only-update-if-same-folder
Open

Fix import command/only update if same folder#2176
lthievenaz-keeper wants to merge 3 commits into
Keeper-Security:releasefrom
lthievenaz-keeper:fix-import-command/only-update-if-same-folder

Conversation

@lthievenaz-keeper

Copy link
Copy Markdown
Contributor

Consider this CSV:
,Administrator,administrator,pass123,,,INFRA
Which imports this content:

INFRA/
  └ Administrator
        ├ login: administrator
        └ password: pass123

I wish to run an import that updates this record + adds another administrator login in a different path:

DEV/
  └ Administrator
        ├ login: administrator
        └ password: pass789

,Administrator,administrator,pass456,,,INFRA
,Administrator,administrator,pass789,,,DEV
So I run:
import --format csv --update my_csv.csv
However this causes the following problems:

  • Because the DEV admin has the same hash as the INFRA admin, we don't create a new record but instead a shortcut from INFRA to DEV
  • This leads to the INFRA admin and DEV admin records having the same record (pass789)

This commit introduces change to the import process so that:

  • If the --update flag is used, the record will only be updated if it's in the same folder
  • If it's in a different folder and doesn't match, a new record is created
  • If it's in a different folder and is the same, a shortcut is still created.

Added folder match logic to --update flag to avoid undesirable updates / shortcuts.
The partial hash map we used to create would merge similar records:
preexisting_partial_record_hash = {
  hash : uid <-- but this could be multiple overlapping records
}
Changed it so that it takes into account different matching records by location:
preexisting_partial_record_hash = {
  hash : [
     { uid: uid, folders: [folders] }
  ]
}
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.

1 participant