mirror of
https://github.com/bitwarden/browser.git
synced 2024-12-22 16:29:09 +01:00
[PS 1579]kee pass2 import fails on cli (#4452)
* Fixing queryselector since the existing is failing * Add the unit test for the keepass fix * Adding additional test for the query.selector fix * Fixing a lint error message
This commit is contained in:
parent
f4dc7ca8b4
commit
fd346ba65a
533
libs/common/spec/importers/keepass2-xml-importer-testdata.ts
Normal file
533
libs/common/spec/importers/keepass2-xml-importer-testdata.ts
Normal file
@ -0,0 +1,533 @@
|
||||
export const TestData = `<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||
<KeePassFile>
|
||||
<Meta>
|
||||
<Generator>KeePass</Generator>
|
||||
<DatabaseName />
|
||||
<DatabaseNameChanged>2016-12-31T21:33:52Z</DatabaseNameChanged>
|
||||
<DatabaseDescription />
|
||||
<DatabaseDescriptionChanged>2016-12-31T21:33:52Z</DatabaseDescriptionChanged>
|
||||
<DefaultUserName />
|
||||
<DefaultUserNameChanged>2016-12-31T21:33:52Z</DefaultUserNameChanged>
|
||||
<MaintenanceHistoryDays>365</MaintenanceHistoryDays>
|
||||
<Color />
|
||||
<MasterKeyChanged>2016-12-31T21:33:59Z</MasterKeyChanged>
|
||||
<MasterKeyChangeRec>-1</MasterKeyChangeRec>
|
||||
<MasterKeyChangeForce>-1</MasterKeyChangeForce>
|
||||
<MemoryProtection>
|
||||
<ProtectTitle>False</ProtectTitle>
|
||||
<ProtectUserName>False</ProtectUserName>
|
||||
<ProtectPassword>True</ProtectPassword>
|
||||
<ProtectURL>False</ProtectURL>
|
||||
<ProtectNotes>False</ProtectNotes>
|
||||
</MemoryProtection>
|
||||
<RecycleBinEnabled>True</RecycleBinEnabled>
|
||||
<RecycleBinUUID>AAAAAAAAAAAAAAAAAAAAAA==</RecycleBinUUID>
|
||||
<RecycleBinChanged>2016-12-31T21:33:52Z</RecycleBinChanged>
|
||||
<EntryTemplatesGroup>AAAAAAAAAAAAAAAAAAAAAA==</EntryTemplatesGroup>
|
||||
<EntryTemplatesGroupChanged>2016-12-31T21:33:52Z</EntryTemplatesGroupChanged>
|
||||
<HistoryMaxItems>10</HistoryMaxItems>
|
||||
<HistoryMaxSize>6291456</HistoryMaxSize>
|
||||
<LastSelectedGroup>AAAAAAAAAAAAAAAAAAAAAA==</LastSelectedGroup>
|
||||
<LastTopVisibleGroup>AAAAAAAAAAAAAAAAAAAAAA==</LastTopVisibleGroup>
|
||||
<Binaries />
|
||||
<CustomData />
|
||||
</Meta>
|
||||
<Root>
|
||||
<Group>
|
||||
<UUID>KvS57lVwl13AfGFLwkvq4Q==</UUID>
|
||||
<Name>Root</Name>
|
||||
<Notes />
|
||||
<IconID>48</IconID>
|
||||
<Times>
|
||||
<CreationTime>2016-12-31T21:33:52Z</CreationTime>
|
||||
<LastModificationTime>2016-12-31T21:33:52Z</LastModificationTime>
|
||||
<LastAccessTime>2017-01-01T22:58:00Z</LastAccessTime>
|
||||
<ExpiryTime>2016-12-31T21:33:52Z</ExpiryTime>
|
||||
<Expires>False</Expires>
|
||||
<UsageCount>1</UsageCount>
|
||||
<LocationChanged>2016-12-31T21:33:52Z</LocationChanged>
|
||||
</Times>
|
||||
<IsExpanded>True</IsExpanded>
|
||||
<DefaultAutoTypeSequence />
|
||||
<EnableAutoType>null</EnableAutoType>
|
||||
<EnableSearching>null</EnableSearching>
|
||||
<LastTopVisibleEntry>AAAAAAAAAAAAAAAAAAAAAA==</LastTopVisibleEntry>
|
||||
<Group>
|
||||
<UUID>P0ParXgGMBW6caOL2YrhqQ==</UUID>
|
||||
<Name>Folder2</Name>
|
||||
<Notes>a note about the folder</Notes>
|
||||
<IconID>48</IconID>
|
||||
<Times>
|
||||
<CreationTime>2016-12-31T21:43:30Z</CreationTime>
|
||||
<LastModificationTime>2016-12-31T21:43:43Z</LastModificationTime>
|
||||
<LastAccessTime>2017-01-01T22:58:00Z</LastAccessTime>
|
||||
<ExpiryTime>2016-12-31T21:43:30Z</ExpiryTime>
|
||||
<Expires>False</Expires>
|
||||
<UsageCount>1</UsageCount>
|
||||
<LocationChanged>2016-12-31T21:43:43Z</LocationChanged>
|
||||
</Times>
|
||||
<IsExpanded>True</IsExpanded>
|
||||
<DefaultAutoTypeSequence />
|
||||
<EnableAutoType>null</EnableAutoType>
|
||||
<EnableSearching>null</EnableSearching>
|
||||
<LastTopVisibleEntry>AAAAAAAAAAAAAAAAAAAAAA==</LastTopVisibleEntry>
|
||||
<Entry>
|
||||
<UUID>fAa543oYlgnJKkhKag5HLw==</UUID>
|
||||
<IconID>1</IconID>
|
||||
<ForegroundColor />
|
||||
<BackgroundColor />
|
||||
<OverrideURL />
|
||||
<Tags />
|
||||
<Times>
|
||||
<CreationTime>2016-12-31T21:34:13Z</CreationTime>
|
||||
<LastModificationTime>2016-12-31T21:40:23Z</LastModificationTime>
|
||||
<LastAccessTime>2016-12-31T21:40:23Z</LastAccessTime>
|
||||
<ExpiryTime>2016-12-31T21:34:13Z</ExpiryTime>
|
||||
<Expires>False</Expires>
|
||||
<UsageCount>0</UsageCount>
|
||||
<LocationChanged>2016-12-31T21:43:48Z</LocationChanged>
|
||||
</Times>
|
||||
<String>
|
||||
<Key>att2</Key>
|
||||
<Value>att2value</Value>
|
||||
</String>
|
||||
<String>
|
||||
<Key>attr1</Key>
|
||||
<Value>att1value
|
||||
|
||||
line1
|
||||
line2</Value>
|
||||
</String>
|
||||
<String>
|
||||
<Key>Notes</Key>
|
||||
<Value>This is a note!!!
|
||||
|
||||
line1
|
||||
line2</Value>
|
||||
</String>
|
||||
<String>
|
||||
<Key>Password</Key>
|
||||
<Value ProtectInMemory="True">googpass</Value>
|
||||
</String>
|
||||
<String>
|
||||
<Key>Title</Key>
|
||||
<Value>Google</Value>
|
||||
</String>
|
||||
<String>
|
||||
<Key>URL</Key>
|
||||
<Value>google.com</Value>
|
||||
</String>
|
||||
<String>
|
||||
<Key>UserName</Key>
|
||||
<Value>googleuser</Value>
|
||||
</String>
|
||||
<AutoType>
|
||||
<Enabled>True</Enabled>
|
||||
<DataTransferObfuscation>0</DataTransferObfuscation>
|
||||
</AutoType>
|
||||
<History>
|
||||
<Entry>
|
||||
<UUID>fAa543oYlgnJKkhKag5HLw==</UUID>
|
||||
<IconID>0</IconID>
|
||||
<ForegroundColor />
|
||||
<BackgroundColor />
|
||||
<OverrideURL />
|
||||
<Tags />
|
||||
<Times>
|
||||
<CreationTime>2016-12-31T21:34:13Z</CreationTime>
|
||||
<LastModificationTime>2016-12-31T21:34:40Z</LastModificationTime>
|
||||
<LastAccessTime>2016-12-31T21:34:40Z</LastAccessTime>
|
||||
<ExpiryTime>2016-12-31T21:34:13Z</ExpiryTime>
|
||||
<Expires>False</Expires>
|
||||
<UsageCount>0</UsageCount>
|
||||
<LocationChanged>2016-12-31T21:34:40Z</LocationChanged>
|
||||
</Times>
|
||||
<String>
|
||||
<Key>Notes</Key>
|
||||
<Value>This is a note!!!
|
||||
|
||||
line1
|
||||
line2</Value>
|
||||
</String>
|
||||
<String>
|
||||
<Key>Password</Key>
|
||||
<Value ProtectInMemory="True">googpass</Value>
|
||||
</String>
|
||||
<String>
|
||||
<Key>Title</Key>
|
||||
<Value>Google</Value>
|
||||
</String>
|
||||
<String>
|
||||
<Key>URL</Key>
|
||||
<Value>google.com</Value>
|
||||
</String>
|
||||
<String>
|
||||
<Key>UserName</Key>
|
||||
<Value>googleuser</Value>
|
||||
</String>
|
||||
<AutoType>
|
||||
<Enabled>True</Enabled>
|
||||
<DataTransferObfuscation>0</DataTransferObfuscation>
|
||||
</AutoType>
|
||||
</Entry>
|
||||
</History>
|
||||
</Entry>
|
||||
</Group>
|
||||
</Group>
|
||||
<DeletedObjects />
|
||||
</Root>
|
||||
</KeePassFile>`;
|
||||
export const TestData1 = `<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||
<KeePassFile>
|
||||
<Meta>
|
||||
<Generator>KeePass</Generator>
|
||||
<DatabaseName />
|
||||
<DatabaseNameChanged>2016-12-31T21:33:52Z</DatabaseNameChanged>
|
||||
<DatabaseDescription />
|
||||
<DatabaseDescriptionChanged>2016-12-31T21:33:52Z</DatabaseDescriptionChanged>
|
||||
<DefaultUserName />
|
||||
<DefaultUserNameChanged>2016-12-31T21:33:52Z</DefaultUserNameChanged>
|
||||
<MaintenanceHistoryDays>365</MaintenanceHistoryDays>
|
||||
<Color />
|
||||
<MasterKeyChanged>2016-12-31T21:33:59Z</MasterKeyChanged>
|
||||
<MasterKeyChangeRec>-1</MasterKeyChangeRec>
|
||||
<MasterKeyChangeForce>-1</MasterKeyChangeForce>
|
||||
<MemoryProtection>
|
||||
<ProtectTitle>False</ProtectTitle>
|
||||
<ProtectUserName>False</ProtectUserName>
|
||||
<ProtectPassword>True</ProtectPassword>
|
||||
<ProtectURL>False</ProtectURL>
|
||||
<ProtectNotes>False</ProtectNotes>
|
||||
</MemoryProtection>
|
||||
<RecycleBinEnabled>True</RecycleBinEnabled>
|
||||
<RecycleBinUUID>AAAAAAAAAAAAAAAAAAAAAA==</RecycleBinUUID>
|
||||
<RecycleBinChanged>2016-12-31T21:33:52Z</RecycleBinChanged>
|
||||
<EntryTemplatesGroup>AAAAAAAAAAAAAAAAAAAAAA==</EntryTemplatesGroup>
|
||||
<EntryTemplatesGroupChanged>2016-12-31T21:33:52Z</EntryTemplatesGroupChanged>
|
||||
<HistoryMaxItems>10</HistoryMaxItems>
|
||||
<HistoryMaxSize>6291456</HistoryMaxSize>
|
||||
<LastSelectedGroup>AAAAAAAAAAAAAAAAAAAAAA==</LastSelectedGroup>
|
||||
<LastTopVisibleGroup>AAAAAAAAAAAAAAAAAAAAAA==</LastTopVisibleGroup>
|
||||
<Binaries />
|
||||
<CustomData />
|
||||
</Meta>
|
||||
<Group>
|
||||
<UUID>KvS57lVwl13AfGFLwkvq4Q==</UUID>
|
||||
<Name>Root</Name>
|
||||
<Notes />
|
||||
<IconID>48</IconID>
|
||||
<Times>
|
||||
<CreationTime>2016-12-31T21:33:52Z</CreationTime>
|
||||
<LastModificationTime>2016-12-31T21:33:52Z</LastModificationTime>
|
||||
<LastAccessTime>2017-01-01T22:58:00Z</LastAccessTime>
|
||||
<ExpiryTime>2016-12-31T21:33:52Z</ExpiryTime>
|
||||
<Expires>False</Expires>
|
||||
<UsageCount>1</UsageCount>
|
||||
<LocationChanged>2016-12-31T21:33:52Z</LocationChanged>
|
||||
</Times>
|
||||
<IsExpanded>True</IsExpanded>
|
||||
<DefaultAutoTypeSequence />
|
||||
<EnableAutoType>null</EnableAutoType>
|
||||
<EnableSearching>null</EnableSearching>
|
||||
<LastTopVisibleEntry>AAAAAAAAAAAAAAAAAAAAAA==</LastTopVisibleEntry>
|
||||
<Group>
|
||||
<UUID>P0ParXgGMBW6caOL2YrhqQ==</UUID>
|
||||
<Name>Folder2</Name>
|
||||
<Notes>a note about the folder</Notes>
|
||||
<IconID>48</IconID>
|
||||
<Times>
|
||||
<CreationTime>2016-12-31T21:43:30Z</CreationTime>
|
||||
<LastModificationTime>2016-12-31T21:43:43Z</LastModificationTime>
|
||||
<LastAccessTime>2017-01-01T22:58:00Z</LastAccessTime>
|
||||
<ExpiryTime>2016-12-31T21:43:30Z</ExpiryTime>
|
||||
<Expires>False</Expires>
|
||||
<UsageCount>1</UsageCount>
|
||||
<LocationChanged>2016-12-31T21:43:43Z</LocationChanged>
|
||||
</Times>
|
||||
<IsExpanded>True</IsExpanded>
|
||||
<DefaultAutoTypeSequence />
|
||||
<EnableAutoType>null</EnableAutoType>
|
||||
<EnableSearching>null</EnableSearching>
|
||||
<LastTopVisibleEntry>AAAAAAAAAAAAAAAAAAAAAA==</LastTopVisibleEntry>
|
||||
<Entry>
|
||||
<UUID>fAa543oYlgnJKkhKag5HLw==</UUID>
|
||||
<IconID>1</IconID>
|
||||
<ForegroundColor />
|
||||
<BackgroundColor />
|
||||
<OverrideURL />
|
||||
<Tags />
|
||||
<Times>
|
||||
<CreationTime>2016-12-31T21:34:13Z</CreationTime>
|
||||
<LastModificationTime>2016-12-31T21:40:23Z</LastModificationTime>
|
||||
<LastAccessTime>2016-12-31T21:40:23Z</LastAccessTime>
|
||||
<ExpiryTime>2016-12-31T21:34:13Z</ExpiryTime>
|
||||
<Expires>False</Expires>
|
||||
<UsageCount>0</UsageCount>
|
||||
<LocationChanged>2016-12-31T21:43:48Z</LocationChanged>
|
||||
</Times>
|
||||
<String>
|
||||
<Key>att2</Key>
|
||||
<Value>att2value</Value>
|
||||
</String>
|
||||
<String>
|
||||
<Key>attr1</Key>
|
||||
<Value>att1value
|
||||
|
||||
line1
|
||||
line2</Value>
|
||||
</String>
|
||||
<String>
|
||||
<Key>Notes</Key>
|
||||
<Value>This is a note!!!
|
||||
|
||||
line1
|
||||
line2</Value>
|
||||
</String>
|
||||
<String>
|
||||
<Key>Password</Key>
|
||||
<Value ProtectInMemory="True">googpass</Value>
|
||||
</String>
|
||||
<String>
|
||||
<Key>Title</Key>
|
||||
<Value>Google</Value>
|
||||
</String>
|
||||
<String>
|
||||
<Key>URL</Key>
|
||||
<Value>google.com</Value>
|
||||
</String>
|
||||
<String>
|
||||
<Key>UserName</Key>
|
||||
<Value>googleuser</Value>
|
||||
</String>
|
||||
<AutoType>
|
||||
<Enabled>True</Enabled>
|
||||
<DataTransferObfuscation>0</DataTransferObfuscation>
|
||||
</AutoType>
|
||||
<History>
|
||||
<Entry>
|
||||
<UUID>fAa543oYlgnJKkhKag5HLw==</UUID>
|
||||
<IconID>0</IconID>
|
||||
<ForegroundColor />
|
||||
<BackgroundColor />
|
||||
<OverrideURL />
|
||||
<Tags />
|
||||
<Times>
|
||||
<CreationTime>2016-12-31T21:34:13Z</CreationTime>
|
||||
<LastModificationTime>2016-12-31T21:34:40Z</LastModificationTime>
|
||||
<LastAccessTime>2016-12-31T21:34:40Z</LastAccessTime>
|
||||
<ExpiryTime>2016-12-31T21:34:13Z</ExpiryTime>
|
||||
<Expires>False</Expires>
|
||||
<UsageCount>0</UsageCount>
|
||||
<LocationChanged>2016-12-31T21:34:40Z</LocationChanged>
|
||||
</Times>
|
||||
<String>
|
||||
<Key>Notes</Key>
|
||||
<Value>This is a note!!!
|
||||
|
||||
line1
|
||||
line2</Value>
|
||||
</String>
|
||||
<String>
|
||||
<Key>Password</Key>
|
||||
<Value ProtectInMemory="True">googpass</Value>
|
||||
</String>
|
||||
<String>
|
||||
<Key>Title</Key>
|
||||
<Value>Google</Value>
|
||||
</String>
|
||||
<String>
|
||||
<Key>URL</Key>
|
||||
<Value>google.com</Value>
|
||||
</String>
|
||||
<String>
|
||||
<Key>UserName</Key>
|
||||
<Value>googleuser</Value>
|
||||
</String>
|
||||
<AutoType>
|
||||
<Enabled>True</Enabled>
|
||||
<DataTransferObfuscation>0</DataTransferObfuscation>
|
||||
</AutoType>
|
||||
</Entry>
|
||||
</History>
|
||||
</Entry>
|
||||
</Group>
|
||||
</Group>
|
||||
<DeletedObjects />
|
||||
</KeePassFile>`;
|
||||
export const TestData2 = `<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||
<Meta>
|
||||
<Generator>KeePass</Generator>
|
||||
<DatabaseName />
|
||||
<DatabaseNameChanged>2016-12-31T21:33:52Z</DatabaseNameChanged>
|
||||
<DatabaseDescription />
|
||||
<DatabaseDescriptionChanged>2016-12-31T21:33:52Z</DatabaseDescriptionChanged>
|
||||
<DefaultUserName />
|
||||
<DefaultUserNameChanged>2016-12-31T21:33:52Z</DefaultUserNameChanged>
|
||||
<MaintenanceHistoryDays>365</MaintenanceHistoryDays>
|
||||
<Color />
|
||||
<MasterKeyChanged>2016-12-31T21:33:59Z</MasterKeyChanged>
|
||||
<MasterKeyChangeRec>-1</MasterKeyChangeRec>
|
||||
<MasterKeyChangeForce>-1</MasterKeyChangeForce>
|
||||
<MemoryProtection>
|
||||
<ProtectTitle>False</ProtectTitle>
|
||||
<ProtectUserName>False</ProtectUserName>
|
||||
<ProtectPassword>True</ProtectPassword>
|
||||
<ProtectURL>False</ProtectURL>
|
||||
<ProtectNotes>False</ProtectNotes>
|
||||
</MemoryProtection>
|
||||
<RecycleBinEnabled>True</RecycleBinEnabled>
|
||||
<RecycleBinUUID>AAAAAAAAAAAAAAAAAAAAAA==</RecycleBinUUID>
|
||||
<RecycleBinChanged>2016-12-31T21:33:52Z</RecycleBinChanged>
|
||||
<EntryTemplatesGroup>AAAAAAAAAAAAAAAAAAAAAA==</EntryTemplatesGroup>
|
||||
<EntryTemplatesGroupChanged>2016-12-31T21:33:52Z</EntryTemplatesGroupChanged>
|
||||
<HistoryMaxItems>10</HistoryMaxItems>
|
||||
<HistoryMaxSize>6291456</HistoryMaxSize>
|
||||
<LastSelectedGroup>AAAAAAAAAAAAAAAAAAAAAA==</LastSelectedGroup>
|
||||
<LastTopVisibleGroup>AAAAAAAAAAAAAAAAAAAAAA==</LastTopVisibleGroup>
|
||||
<Binaries />
|
||||
<CustomData />
|
||||
</Meta>
|
||||
<Root>
|
||||
<Group>
|
||||
<UUID>KvS57lVwl13AfGFLwkvq4Q==</UUID>
|
||||
<Name>Root</Name>
|
||||
<Notes />
|
||||
<IconID>48</IconID>
|
||||
<Times>
|
||||
<CreationTime>2016-12-31T21:33:52Z</CreationTime>
|
||||
<LastModificationTime>2016-12-31T21:33:52Z</LastModificationTime>
|
||||
<LastAccessTime>2017-01-01T22:58:00Z</LastAccessTime>
|
||||
<ExpiryTime>2016-12-31T21:33:52Z</ExpiryTime>
|
||||
<Expires>False</Expires>
|
||||
<UsageCount>1</UsageCount>
|
||||
<LocationChanged>2016-12-31T21:33:52Z</LocationChanged>
|
||||
</Times>
|
||||
<IsExpanded>True</IsExpanded>
|
||||
<DefaultAutoTypeSequence />
|
||||
<EnableAutoType>null</EnableAutoType>
|
||||
<EnableSearching>null</EnableSearching>
|
||||
<LastTopVisibleEntry>AAAAAAAAAAAAAAAAAAAAAA==</LastTopVisibleEntry>
|
||||
<Group>
|
||||
<UUID>P0ParXgGMBW6caOL2YrhqQ==</UUID>
|
||||
<Name>Folder2</Name>
|
||||
<Notes>a note about the folder</Notes>
|
||||
<IconID>48</IconID>
|
||||
<Times>
|
||||
<CreationTime>2016-12-31T21:43:30Z</CreationTime>
|
||||
<LastModificationTime>2016-12-31T21:43:43Z</LastModificationTime>
|
||||
<LastAccessTime>2017-01-01T22:58:00Z</LastAccessTime>
|
||||
<ExpiryTime>2016-12-31T21:43:30Z</ExpiryTime>
|
||||
<Expires>False</Expires>
|
||||
<UsageCount>1</UsageCount>
|
||||
<LocationChanged>2016-12-31T21:43:43Z</LocationChanged>
|
||||
</Times>
|
||||
<IsExpanded>True</IsExpanded>
|
||||
<DefaultAutoTypeSequence />
|
||||
<EnableAutoType>null</EnableAutoType>
|
||||
<EnableSearching>null</EnableSearching>
|
||||
<LastTopVisibleEntry>AAAAAAAAAAAAAAAAAAAAAA==</LastTopVisibleEntry>
|
||||
<Entry>
|
||||
<UUID>fAa543oYlgnJKkhKag5HLw==</UUID>
|
||||
<IconID>1</IconID>
|
||||
<ForegroundColor />
|
||||
<BackgroundColor />
|
||||
<OverrideURL />
|
||||
<Tags />
|
||||
<Times>
|
||||
<CreationTime>2016-12-31T21:34:13Z</CreationTime>
|
||||
<LastModificationTime>2016-12-31T21:40:23Z</LastModificationTime>
|
||||
<LastAccessTime>2016-12-31T21:40:23Z</LastAccessTime>
|
||||
<ExpiryTime>2016-12-31T21:34:13Z</ExpiryTime>
|
||||
<Expires>False</Expires>
|
||||
<UsageCount>0</UsageCount>
|
||||
<LocationChanged>2016-12-31T21:43:48Z</LocationChanged>
|
||||
</Times>
|
||||
<String>
|
||||
<Key>att2</Key>
|
||||
<Value>att2value</Value>
|
||||
</String>
|
||||
<String>
|
||||
<Key>attr1</Key>
|
||||
<Value>att1value
|
||||
|
||||
line1
|
||||
line2</Value>
|
||||
</String>
|
||||
<String>
|
||||
<Key>Notes</Key>
|
||||
<Value>This is a note!!!
|
||||
|
||||
line1
|
||||
line2</Value>
|
||||
</String>
|
||||
<String>
|
||||
<Key>Password</Key>
|
||||
<Value ProtectInMemory="True">googpass</Value>
|
||||
</String>
|
||||
<String>
|
||||
<Key>Title</Key>
|
||||
<Value>Google</Value>
|
||||
</String>
|
||||
<String>
|
||||
<Key>URL</Key>
|
||||
<Value>google.com</Value>
|
||||
</String>
|
||||
<String>
|
||||
<Key>UserName</Key>
|
||||
<Value>googleuser</Value>
|
||||
</String>
|
||||
<AutoType>
|
||||
<Enabled>True</Enabled>
|
||||
<DataTransferObfuscation>0</DataTransferObfuscation>
|
||||
</AutoType>
|
||||
<History>
|
||||
<Entry>
|
||||
<UUID>fAa543oYlgnJKkhKag5HLw==</UUID>
|
||||
<IconID>0</IconID>
|
||||
<ForegroundColor />
|
||||
<BackgroundColor />
|
||||
<OverrideURL />
|
||||
<Tags />
|
||||
<Times>
|
||||
<CreationTime>2016-12-31T21:34:13Z</CreationTime>
|
||||
<LastModificationTime>2016-12-31T21:34:40Z</LastModificationTime>
|
||||
<LastAccessTime>2016-12-31T21:34:40Z</LastAccessTime>
|
||||
<ExpiryTime>2016-12-31T21:34:13Z</ExpiryTime>
|
||||
<Expires>False</Expires>
|
||||
<UsageCount>0</UsageCount>
|
||||
<LocationChanged>2016-12-31T21:34:40Z</LocationChanged>
|
||||
</Times>
|
||||
<String>
|
||||
<Key>Notes</Key>
|
||||
<Value>This is a note!!!
|
||||
|
||||
line1
|
||||
line2</Value>
|
||||
</String>
|
||||
<String>
|
||||
<Key>Password</Key>
|
||||
<Value ProtectInMemory="True">googpass</Value>
|
||||
</String>
|
||||
<String>
|
||||
<Key>Title</Key>
|
||||
<Value>Google</Value>
|
||||
</String>
|
||||
<String>
|
||||
<Key>URL</Key>
|
||||
<Value>google.com</Value>
|
||||
</String>
|
||||
<String>
|
||||
<Key>UserName</Key>
|
||||
<Value>googleuser</Value>
|
||||
</String>
|
||||
<AutoType>
|
||||
<Enabled>True</Enabled>
|
||||
<DataTransferObfuscation>0</DataTransferObfuscation>
|
||||
</AutoType>
|
||||
</Entry>
|
||||
</History>
|
||||
</Entry>
|
||||
</Group>
|
||||
</Group>
|
||||
<DeletedObjects />
|
||||
</Root>`;
|
@ -1,184 +1,7 @@
|
||||
import { KeePass2XmlImporter as Importer } from "@bitwarden/common/importers/keepass2-xml-importer";
|
||||
import { FolderView } from "@bitwarden/common/models/view/folder.view";
|
||||
|
||||
const TestData = `<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||
<KeePassFile>
|
||||
<Meta>
|
||||
<Generator>KeePass</Generator>
|
||||
<DatabaseName />
|
||||
<DatabaseNameChanged>2016-12-31T21:33:52Z</DatabaseNameChanged>
|
||||
<DatabaseDescription />
|
||||
<DatabaseDescriptionChanged>2016-12-31T21:33:52Z</DatabaseDescriptionChanged>
|
||||
<DefaultUserName />
|
||||
<DefaultUserNameChanged>2016-12-31T21:33:52Z</DefaultUserNameChanged>
|
||||
<MaintenanceHistoryDays>365</MaintenanceHistoryDays>
|
||||
<Color />
|
||||
<MasterKeyChanged>2016-12-31T21:33:59Z</MasterKeyChanged>
|
||||
<MasterKeyChangeRec>-1</MasterKeyChangeRec>
|
||||
<MasterKeyChangeForce>-1</MasterKeyChangeForce>
|
||||
<MemoryProtection>
|
||||
<ProtectTitle>False</ProtectTitle>
|
||||
<ProtectUserName>False</ProtectUserName>
|
||||
<ProtectPassword>True</ProtectPassword>
|
||||
<ProtectURL>False</ProtectURL>
|
||||
<ProtectNotes>False</ProtectNotes>
|
||||
</MemoryProtection>
|
||||
<RecycleBinEnabled>True</RecycleBinEnabled>
|
||||
<RecycleBinUUID>AAAAAAAAAAAAAAAAAAAAAA==</RecycleBinUUID>
|
||||
<RecycleBinChanged>2016-12-31T21:33:52Z</RecycleBinChanged>
|
||||
<EntryTemplatesGroup>AAAAAAAAAAAAAAAAAAAAAA==</EntryTemplatesGroup>
|
||||
<EntryTemplatesGroupChanged>2016-12-31T21:33:52Z</EntryTemplatesGroupChanged>
|
||||
<HistoryMaxItems>10</HistoryMaxItems>
|
||||
<HistoryMaxSize>6291456</HistoryMaxSize>
|
||||
<LastSelectedGroup>AAAAAAAAAAAAAAAAAAAAAA==</LastSelectedGroup>
|
||||
<LastTopVisibleGroup>AAAAAAAAAAAAAAAAAAAAAA==</LastTopVisibleGroup>
|
||||
<Binaries />
|
||||
<CustomData />
|
||||
</Meta>
|
||||
<Root>
|
||||
<Group>
|
||||
<UUID>KvS57lVwl13AfGFLwkvq4Q==</UUID>
|
||||
<Name>Root</Name>
|
||||
<Notes />
|
||||
<IconID>48</IconID>
|
||||
<Times>
|
||||
<CreationTime>2016-12-31T21:33:52Z</CreationTime>
|
||||
<LastModificationTime>2016-12-31T21:33:52Z</LastModificationTime>
|
||||
<LastAccessTime>2017-01-01T22:58:00Z</LastAccessTime>
|
||||
<ExpiryTime>2016-12-31T21:33:52Z</ExpiryTime>
|
||||
<Expires>False</Expires>
|
||||
<UsageCount>1</UsageCount>
|
||||
<LocationChanged>2016-12-31T21:33:52Z</LocationChanged>
|
||||
</Times>
|
||||
<IsExpanded>True</IsExpanded>
|
||||
<DefaultAutoTypeSequence />
|
||||
<EnableAutoType>null</EnableAutoType>
|
||||
<EnableSearching>null</EnableSearching>
|
||||
<LastTopVisibleEntry>AAAAAAAAAAAAAAAAAAAAAA==</LastTopVisibleEntry>
|
||||
<Group>
|
||||
<UUID>P0ParXgGMBW6caOL2YrhqQ==</UUID>
|
||||
<Name>Folder2</Name>
|
||||
<Notes>a note about the folder</Notes>
|
||||
<IconID>48</IconID>
|
||||
<Times>
|
||||
<CreationTime>2016-12-31T21:43:30Z</CreationTime>
|
||||
<LastModificationTime>2016-12-31T21:43:43Z</LastModificationTime>
|
||||
<LastAccessTime>2017-01-01T22:58:00Z</LastAccessTime>
|
||||
<ExpiryTime>2016-12-31T21:43:30Z</ExpiryTime>
|
||||
<Expires>False</Expires>
|
||||
<UsageCount>1</UsageCount>
|
||||
<LocationChanged>2016-12-31T21:43:43Z</LocationChanged>
|
||||
</Times>
|
||||
<IsExpanded>True</IsExpanded>
|
||||
<DefaultAutoTypeSequence />
|
||||
<EnableAutoType>null</EnableAutoType>
|
||||
<EnableSearching>null</EnableSearching>
|
||||
<LastTopVisibleEntry>AAAAAAAAAAAAAAAAAAAAAA==</LastTopVisibleEntry>
|
||||
<Entry>
|
||||
<UUID>fAa543oYlgnJKkhKag5HLw==</UUID>
|
||||
<IconID>1</IconID>
|
||||
<ForegroundColor />
|
||||
<BackgroundColor />
|
||||
<OverrideURL />
|
||||
<Tags />
|
||||
<Times>
|
||||
<CreationTime>2016-12-31T21:34:13Z</CreationTime>
|
||||
<LastModificationTime>2016-12-31T21:40:23Z</LastModificationTime>
|
||||
<LastAccessTime>2016-12-31T21:40:23Z</LastAccessTime>
|
||||
<ExpiryTime>2016-12-31T21:34:13Z</ExpiryTime>
|
||||
<Expires>False</Expires>
|
||||
<UsageCount>0</UsageCount>
|
||||
<LocationChanged>2016-12-31T21:43:48Z</LocationChanged>
|
||||
</Times>
|
||||
<String>
|
||||
<Key>att2</Key>
|
||||
<Value>att2value</Value>
|
||||
</String>
|
||||
<String>
|
||||
<Key>attr1</Key>
|
||||
<Value>att1value
|
||||
|
||||
line1
|
||||
line2</Value>
|
||||
</String>
|
||||
<String>
|
||||
<Key>Notes</Key>
|
||||
<Value>This is a note!!!
|
||||
|
||||
line1
|
||||
line2</Value>
|
||||
</String>
|
||||
<String>
|
||||
<Key>Password</Key>
|
||||
<Value ProtectInMemory="True">googpass</Value>
|
||||
</String>
|
||||
<String>
|
||||
<Key>Title</Key>
|
||||
<Value>Google</Value>
|
||||
</String>
|
||||
<String>
|
||||
<Key>URL</Key>
|
||||
<Value>google.com</Value>
|
||||
</String>
|
||||
<String>
|
||||
<Key>UserName</Key>
|
||||
<Value>googleuser</Value>
|
||||
</String>
|
||||
<AutoType>
|
||||
<Enabled>True</Enabled>
|
||||
<DataTransferObfuscation>0</DataTransferObfuscation>
|
||||
</AutoType>
|
||||
<History>
|
||||
<Entry>
|
||||
<UUID>fAa543oYlgnJKkhKag5HLw==</UUID>
|
||||
<IconID>0</IconID>
|
||||
<ForegroundColor />
|
||||
<BackgroundColor />
|
||||
<OverrideURL />
|
||||
<Tags />
|
||||
<Times>
|
||||
<CreationTime>2016-12-31T21:34:13Z</CreationTime>
|
||||
<LastModificationTime>2016-12-31T21:34:40Z</LastModificationTime>
|
||||
<LastAccessTime>2016-12-31T21:34:40Z</LastAccessTime>
|
||||
<ExpiryTime>2016-12-31T21:34:13Z</ExpiryTime>
|
||||
<Expires>False</Expires>
|
||||
<UsageCount>0</UsageCount>
|
||||
<LocationChanged>2016-12-31T21:34:40Z</LocationChanged>
|
||||
</Times>
|
||||
<String>
|
||||
<Key>Notes</Key>
|
||||
<Value>This is a note!!!
|
||||
|
||||
line1
|
||||
line2</Value>
|
||||
</String>
|
||||
<String>
|
||||
<Key>Password</Key>
|
||||
<Value ProtectInMemory="True">googpass</Value>
|
||||
</String>
|
||||
<String>
|
||||
<Key>Title</Key>
|
||||
<Value>Google</Value>
|
||||
</String>
|
||||
<String>
|
||||
<Key>URL</Key>
|
||||
<Value>google.com</Value>
|
||||
</String>
|
||||
<String>
|
||||
<Key>UserName</Key>
|
||||
<Value>googleuser</Value>
|
||||
</String>
|
||||
<AutoType>
|
||||
<Enabled>True</Enabled>
|
||||
<DataTransferObfuscation>0</DataTransferObfuscation>
|
||||
</AutoType>
|
||||
</Entry>
|
||||
</History>
|
||||
</Entry>
|
||||
</Group>
|
||||
</Group>
|
||||
<DeletedObjects />
|
||||
</Root>
|
||||
</KeePassFile>`;
|
||||
import { TestData, TestData1, TestData2 } from "./keepass2-xml-importer-testdata";
|
||||
|
||||
describe("KeePass2 Xml Importer", () => {
|
||||
it("should parse XML data", async () => {
|
||||
@ -186,4 +9,34 @@ describe("KeePass2 Xml Importer", () => {
|
||||
const result = await importer.parse(TestData);
|
||||
expect(result != null).toBe(true);
|
||||
});
|
||||
|
||||
it("parse XML should contains folders", async () => {
|
||||
const importer = new Importer();
|
||||
const folder = new FolderView();
|
||||
folder.name = "Folder2";
|
||||
const actual = [folder];
|
||||
|
||||
const result = await importer.parse(TestData);
|
||||
expect(result.folders).toEqual(actual);
|
||||
});
|
||||
|
||||
it("parse XML should contains login details", async () => {
|
||||
const importer = new Importer();
|
||||
const result = await importer.parse(TestData);
|
||||
expect(result.ciphers[0].login.uri != null).toBe(true);
|
||||
expect(result.ciphers[0].login.username != null).toBe(true);
|
||||
expect(result.ciphers[0].login.password != null).toBe(true);
|
||||
});
|
||||
|
||||
it("should return error with missing root tag", async () => {
|
||||
const importer = new Importer();
|
||||
const result = await importer.parse(TestData1);
|
||||
expect(result.errorMessage).toBe("Missing `KeePassFile > Root` node.");
|
||||
});
|
||||
|
||||
it("should return error with missing KeePassFile tag", async () => {
|
||||
const importer = new Importer();
|
||||
const result = await importer.parse(TestData2);
|
||||
expect(result.success).toBe(false);
|
||||
});
|
||||
});
|
||||
|
@ -15,7 +15,23 @@ export class KeePass2XmlImporter extends BaseImporter implements Importer {
|
||||
return Promise.resolve(this.result);
|
||||
}
|
||||
|
||||
const rootGroup = doc.querySelector("KeePassFile > Root > Group");
|
||||
//Note: The doc.querySelector("KeePassFile > Root > Group") no longers works on node and we have to breakdown the query by nodes
|
||||
const KeePassFileNode = doc.querySelector("KeePassFile");
|
||||
|
||||
if (KeePassFileNode == null) {
|
||||
this.result.errorMessage = "Missing `KeePassFile` node.";
|
||||
this.result.success = false;
|
||||
return Promise.resolve(this.result);
|
||||
}
|
||||
|
||||
const RootNode = KeePassFileNode.querySelector("Root");
|
||||
if (RootNode == null) {
|
||||
this.result.errorMessage = "Missing `KeePassFile > Root` node.";
|
||||
this.result.success = false;
|
||||
return Promise.resolve(this.result);
|
||||
}
|
||||
|
||||
const rootGroup = RootNode.querySelector("Group");
|
||||
if (rootGroup == null) {
|
||||
this.result.errorMessage = "Missing `KeePassFile > Root > Group` node.";
|
||||
this.result.success = false;
|
||||
|
Loading…
Reference in New Issue
Block a user