Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Improve Portability Check #10760

Merged
merged 1 commit into from
May 27, 2024
Merged

Conversation

OnSlbWXt
Copy link

Screenshots

Fixes #10755
The check checked against keepassxc.ini being in the application directory, while the .portable file was actually being responsible for determining if the application was installed in portable mode.
In addition this fixes KeePassXCPortable on portableapps.com, as the check returned "not-portable" there, when it should have responsed "portable".
image

Testing strategy

No Test was conducted as it was only a filename change.

Type of change

  • ✅ Bug fix (non-breaking change that fixes an issue)

Comment on lines 211 to 212
// If portable settings file exists save the JSON scripts to the application folder
if (QFile::exists(QCoreApplication::applicationDirPath() + QStringLiteral("/keepassxc.ini"))) {
if (QFile::exists(QCoreApplication::applicationDirPath() + QStringLiteral("/.portable"))) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be best to move this to an isPortable() function, especially if that check is done in more than one place.
Also, the comment still says "portable settings file". Should probably say "portable marker", or just "In portable mode".

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turn this into a function of Config: https://github.com/keepassxreboot/keepassxc/blob/develop/src%2Fcore%2FConfig.cpp#L522

Then use it there and here.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would do that, but for that I am not versed enough in cpp to safely and securely code it. I don't even a way to compile keepassxc (or any cpp project), so testing is also out of the window.
Throw me a base C-Project (or Java, or PHP) and I could do more, but for cpp I am unfortunately only able to do small fixes like this, which don't really change the structure of the code

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to point out that changing the behaviour of this code may result in unexpected failures for people who rely on it.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would do that, but for that I am not versed enough in cpp to safely and securely code it. I don't even a way to compile keepassxc (or any cpp project), so testing is also out of the window. Throw me a base C-Project (or Java, or PHP) and I could do more, but for cpp I am unfortunately only able to do small fixes like this, which don't really change the structure of the code

I attempted it in a local repository, but:

  • Config: portablePath would need to become a member-attribute or method getDefaultConfigs() would need an additional parameter, or we would duplicate code, leaving us open for something similar to happen in the future
  • Config: alternatively: set m_isPortable (from isPortable) inside getDefaultConfigs(), but having to call the function in the parameterized Constructor aswell, even tough it serves no other purpose
  • Config: can't put it into init, as it is called after getDefaultConfigs(), which requires said configs.

I am absolutely not comfortable in making that change myself.

@OnSlbWXt
Copy link
Author

OnSlbWXt commented May 15, 2024

I pushed how I would solve #10760 (comment)
but can not test the changes myself.

and apprently I am mixing static and non static fields.

src/core/Config.h Outdated Show resolved Hide resolved
@droidmonkey droidmonkey added this to the v2.7.9 milestone May 22, 2024
@droidmonkey
Copy link
Member

I fixed everything

@droidmonkey droidmonkey changed the title Fix 10755 Portability Check Improve Portability Check May 27, 2024
@droidmonkey droidmonkey merged commit 1fd8923 into keepassxreboot:develop May 27, 2024
11 checks passed
libf-de pushed a commit to libf-de/keepassxc-secretservice-dbus that referenced this pull request Jun 20, 2024
Release 2.7.9

* Passkeys: Ability to easily remove a passkey from an entry [keepassxreboot#10777]
* Snap: Use new desktop portal for native messaging integration [keepassxreboot#10906]

* Improve entry placeholder/reference feature [keepassxreboot#10846]
* Improve CSV importing when title field isn't specified [keepassxreboot#10843]
* Improve encrypted Bitwarden importing [keepassxreboot#10800]
* Improve database settings UX [keepassxreboot#10821]
* Improve handling of clipboard actions from entry preview [keepassxreboot#10810]
* Improve group/entry view resize behavior and set sensible defaults [keepassxreboot#10641]
* Passkeys: Fix incorrect username fill [keepassxreboot#10874]
* Passkeys: Return additional data to the extension [keepassxreboot#10857]
* Fix password clear timer inconsistency on unlock view [keepassxreboot#10708]
* Fix portability check [keepassxreboot#10760]
* Fix page overflow on HTML exports [keepassxreboot#10735]
* Fix broken builds when using system provided zxcvbn [keepassxreboot#10717]
* Fix copy password button when text is selected [keepassxreboot#10853]
* Fix tab ordering on application settings pages [keepassxreboot#10907]
* SSH Agent: Fix broken decrypt button [keepassxreboot#10638]
* Windows: Fix ALT Auto-Type modifier [keepassxreboot#10795]
* Windows: Fix wrong DACL memory size allocation [keepassxreboot#10712]
* macOS: Fix monospace font sizing [keepassxreboot#10739]
* Flatpak: Fix configuration settings off-by-one error [keepassxreboot#10688]
* BSD: Fix compiling with libusb implementation [keepassxreboot#10736]

# -----BEGIN PGP SIGNATURE-----
#
# iQEzBAABCAAdFiEENIkEDB8MPuq41ValRA/GXy4MbgEFAmZzTogACgkQRA/GXy4M
# bgHahggAg+hzMTiM0uDaw5yfxhv6GEfQQBPHMhX3JDyHEC+i7Pq6OjlxQkdUrRdu
# f4w74od5jSul0Al/ehu9L2eZwNPMnU87FWDn16o1btYHsG9n24v5S0DuQoLXUjde
# Y9nJNKeRNoWAlVKWbUG2YGvy9hF9YbtrFaiBksaQ+g3w8Xz82PzLY0VaUu4Xa/LO
# RXAhryJC+8T3T479dXpHxJcUmEWkoY4bqj1i6R8tEK5Kz9y1c0kqzqwWysKMj+rD
# WxTb2V4y9s57pO35zt9yxMLg66xx9bdcQHbSULa2vZNMFd9qdqk8WJmWFle112yG
# UCBXv2ZIjd3lghPt0IrD+WKcuL85Aw==
# =rbfs
# -----END PGP SIGNATURE-----
# gpg: directory '/home/runner/.gnupg' created
# gpg: keybox '/home/runner/.gnupg/pubring.kbx' created
# gpg: Signature made Wed Jun 19 21:32:56 2024 UTC
# gpg:                using RSA key 3489040C1F0C3EEAB8D556A5440FC65F2E0C6E01
# gpg: Can't check signature: No public key
Perlover added a commit to Perlover/keepassxc that referenced this pull request Jul 24, 2024
Release 2.7.9

* Passkeys: Ability to easily remove a passkey from an entry [keepassxreboot#10777]
* Snap: Use new desktop portal for native messaging integration [keepassxreboot#10906]

* Improve entry placeholder/reference feature [keepassxreboot#10846]
* Improve CSV importing when title field isn't specified [keepassxreboot#10843]
* Improve encrypted Bitwarden importing [keepassxreboot#10800]
* Improve database settings UX [keepassxreboot#10821]
* Improve handling of clipboard actions from entry preview [keepassxreboot#10810]
* Improve group/entry view resize behavior and set sensible defaults [keepassxreboot#10641]
* Passkeys: Fix incorrect username fill [keepassxreboot#10874]
* Passkeys: Return additional data to the extension [keepassxreboot#10857]
* Fix password clear timer inconsistency on unlock view [keepassxreboot#10708]
* Fix portability check [keepassxreboot#10760]
* Fix page overflow on HTML exports [keepassxreboot#10735]
* Fix broken builds when using system provided zxcvbn [keepassxreboot#10717]
* Fix copy password button when text is selected [keepassxreboot#10853]
* Fix tab ordering on application settings pages [keepassxreboot#10907]
* SSH Agent: Fix broken decrypt button [keepassxreboot#10638]
* Windows: Fix ALT Auto-Type modifier [keepassxreboot#10795]
* Windows: Fix wrong DACL memory size allocation [keepassxreboot#10712]
* macOS: Fix monospace font sizing [keepassxreboot#10739]
* Flatpak: Fix configuration settings off-by-one error [keepassxreboot#10688]
* BSD: Fix compiling with libusb implementation [keepassxreboot#10736]
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't save native messaging script for Browser Plugin
4 participants