1
0
Commit Graph

18375 Commits

Author SHA1 Message Date
SomberNight
d7bc6cbb3c add harden_memory_linux: harder for other processes to read our memory
This module tries to restrict the ability of other processes to access the memory of our process.
Traditionally, on Linux, one process can access the memory of another arbitrary process
if both are running as the same user (uid). (Root can ofc access the memory of ~any process)
Programs can opt-out from this by setting `prctl(PR_SET_DUMPABLE, 0);`

also see https://man.archlinux.org/man/PR_SET_DUMPABLE.2const.en

-----

Also, from https://unix.stackexchange.com/a/518452 :

In a terminal window:
```
% echo $$  # show our pid
6744
% read -sp 'secret password: '; echo
secret password:
%
```
Then in another terminal window:
```
% grep heap /proc/6744/maps
01bb7000-01c3e000 rw-p 00000000 00:00 0                                  [heap]
% dd if=/proc/6744/mem bs=1 skip=$((0x01bb7000)) count=$((0x01c3e000-0x01bb7000)) status=none |
    strings | less
...
% dd if=/proc/6744/mem bs=1 skip=$((0x01bb7000)) count=$((0x01c3e000-0x01bb7000)) status=none |
    strings | grep obiwan
obiwan_kenobi  # "secret password"
```
2025-04-18 00:54:30 +00:00
SomberNight
5f83fffd2e swaps.py: (trivial) fix stale type-hint 2025-04-17 17:13:21 +00:00
ThomasV
3eac741947 Merge pull request #9739 from accumulator/psbt_nostr_fixes
plugins: psbt_nostr: start processing PSBTs after wallet is_up_to_date
2025-04-17 08:34:42 +02:00
ThomasV
5ee46b189c Merge pull request #9743 from f321x/fix_password_command
cmd: fix password command eval type
2025-04-17 08:26:22 +02:00
f321x
1e5187b9df fix password command eval type 2025-04-16 17:48:40 +02:00
ThomasV
c0ddce4586 plugins: rename plugin nostr cosigner, minor tweaks 2025-04-16 10:08:55 +02:00
Sander van Grieken
4e9ec5d2ea plugins: psbt_nostr: exclude 2FA wallets 2025-04-16 10:05:54 +02:00
Sander van Grieken
182accb9fb plugins: psbt_nostr: move can_send_psbt logic from GUI to backend, fix qml wallet switch bug 2025-04-16 09:47:41 +02:00
Sander van Grieken
eb52090fee plugins: psbt_nostr: start processing PSBTs after wallet is_up_to_date
also don't break the receive loop when an invalid tx is received.
2025-04-16 09:13:36 +02:00
ThomasV
9d42505eec psbt_nostr: add plugin icon to txdialog button 2025-04-15 18:23:58 +02:00
ThomasV
dff1d5b0c1 Merge pull request #9694 from accumulator/qml_psbt_over_nostr
psbt_nostr: split generic and UI parts, implement for qml
2025-04-15 18:12:17 +02:00
ThomasV
70ab4f2190 Fix password passed to daemon.load_wallet
The password should not be an empty string.

Traceback (most recent call last):
  File "/opt/electrum/electrum/gui/qt/__init__.py", line 377, in start_new_window
    wallet = self._start_wizard_to_select_or_create_wallet(path)
  File "/opt/electrum/electrum/gui/qt/__init__.py", line 446, in _start_wizard_to_select_or_create_wallet
    wallet = self.daemon.load_wallet(wallet_file, d['password'], upgrade=True)
  File "/opt/electrum/electrum/daemon.py", line 461, in func_wrapper
    return func(self, *args, **kwargs)
  File "/opt/electrum/electrum/daemon.py", line 474, in load_wallet
    wallet.unlock(password)
  File "/opt/electrum/electrum/wallet.py", line 3418, in unlock
    self.check_password(password)
  File "/opt/electrum/electrum/wallet.py", line 3069, in check_password
    raise InvalidPassword("password given but wallet has no password")
electrum.util.InvalidPassword: password given but wallet has no password
2025-04-15 18:01:25 +02:00
Sander van Grieken
3b97ab7407 plugins: psbt_nostr: qt: offer 3 choices for each PSBT; 'Open, Discard, Save to wallet' 2025-04-15 17:38:11 +02:00
ThomasV
34a8ec64f8 move audio_modem icons to plugin dir, so that the plugin is self-contained.
This requires changing the API of OverlayControlMixin.addButton
2025-04-15 15:34:01 +02:00
Sander van Grieken
60bd6327ce plugins: psbt_nostr: let GUI handle a received PSBTs one by one by pausing receiving additional PSBTs until PSBT dialog is closed.
Accepting a PSBT opens the Tx dialog and pauses receiving additional PSBTs until the Tx dialog is closed.
Rejecting a PSBT will start a cooldown and accept all pending PSBTs into the history for later inspection.
2025-04-15 14:06:57 +02:00
Sander van Grieken
3ff84f08a6 plugins: psbt_nostr: implement for qml 2025-04-15 14:06:29 +02:00
Sander van Grieken
13a4076f22 plugins: psbt_nostr: split generic and UI parts 2025-04-15 14:00:36 +02:00
ThomasV
147b3fae1b Merge pull request #9725 from accumulator/qt_seedwidget_copy_button
qt: SeedWidget: for xpubs, show copy button next to QR button.
2025-04-15 12:27:08 +02:00
ThomasV
1162f45bd5 plugins: minor tweaks
- add icon to PluginDialog
 - add icon to psbt_nosr
 - rename 'PSBT Nostr' as 'Nostr Multisig'
2025-04-15 12:23:03 +02:00
Sander van Grieken
24d03340da qt: SeedWidget: for xpubs, show copy button next to QR button.
This is only used when displaying wallet xpub in wizard for multisig setup.
2025-04-15 11:00:39 +02:00
ThomasV
a92e65c561 plugins: add plugin icon to menu in init_menubar 2025-04-15 10:33:14 +02:00
ThomasV
dcf632ed1e add icons for nwc and labels plugins 2025-04-15 10:23:05 +02:00
ThomasV
0831fc3b80 plugins: move wallet-related settings to the wallet menu
Plugins should use the init_menubar hook.
References are kept to the various menu objects.
2025-04-15 10:01:00 +02:00
ThomasV
8c028f7528 Add/remove plugins from GUI
- both internal and external plugins require GUI install
   (except internal HW plugins, which are 'auto-loaded' and hidden)
 - remove init_qt hook
 - in Qt, reload wallet windows if plugin enabled/disabled
 - add 'uninstall' button to PluginDialog
 - add 'add plugins' button to wizard hw screen
 - add icons to the plugin list
2025-04-15 08:35:10 +02:00
SomberNight
d1e1ca7fd2 ci: fix "locale: upload to crowdin" task
follow-up https://github.com/spesmilo/electrum/pull/9726
2025-04-14 18:08:31 +00:00
ghost43
02a005d533 Merge pull request #9733 from f321x/fix_too_large_onion_payload
lightning: stop including all invoice r_tags in legacy trampoline onion
2025-04-14 17:45:26 +00:00
ghost43
3d3933afdb Merge pull request #9726 from SomberNight/202504_locale
mv git submodule electrum-locale from contrib to electrum/locale
2025-04-14 17:20:41 +00:00
f321x
8d79c58c5e Stop including all invoice r_tags in legacy trampoline onion
This change modifies create_trampoline_onion to only include as many
available r_tags as there is space left in the trampoline onion payload.

Previously we tried to include all passed invoice r_tags of legacy
trampoline payments into the payload which caused an user facing
exception and payment failure as the onion can only store a max of 400
bytes.
A single, single hop r_tag is around 52 bytes and the payload
without r_tags is already at ~280 bytes. So usually there is enough
space for 2 r_tags.
The implementation shuffles the r_tags on each call
so the payment will try different route hints on the attempts (fee level
increase or user retry).

I have logged the following byte sizes of the trampoline onion with a 2
trampoline onion hop and changing amounts of r_tags:

3 rtags:
payload size [0]: 113 (hop size: 81)
payload size [1]: 440 (hop size: 295) ( 52 bytes/rtag )
payload size [2]: 550 (hop size: 78)

2 rtags:
payload size [0]: 113 (hop size: 81)
payload size [1]: 386 (hop size: 241) ( 52 bytes/rtag )
payload size [2]: 496 (hop size: 78)

1 rtag:
payload size [0]: 113 (hop size: 81)
payload size [1]: 334 (hop size: 189) ( 52 bytes/rtag )
payload size [2]: 444 (hop size: 78)

0 rtags:
payload size [0]: 113 (hop size: 81)
payload size [1]: 282 (hop size: 137)
payload size [2]: 392 (hop size: 78)

As can be seen in the data, using 2 trampoline hops there is not enough
space for even a single r_tag which is why this option is being removed
too.
2025-04-14 19:20:11 +02:00
SomberNight
950658183c contrib: push_locale.py: fix relative paths in messages_qml.pot
The Qt lupdate tool that extracts translatable strings from .qml files
writes paths relative to its output .ts file into the .ts file.
These paths are then retained as-is when converted to .pot format.

The last few commits moved around the working directory of the lupdate tool
(from electrum/locale to electrum/locale/build), which resulted in a change
of all relative paths in the final messages.pot we upload to crowdin.

E.g. from:
```
#: ../gui/qml/components/Addresses.qml:64
```
to:
```
#: ../../gui/qml/components/Addresses.qml:64
```

I think a change like this does not invalidate the translations. Still, it is annoying.

This commit adds an extra processing step to "fix" these strings to:
```
#: electrum/gui/qml/components/Addresses.qml:64
```
2025-04-14 17:18:40 +00:00
SomberNight
31b176169a contrib: mv locale-related scripts to contrib/locale/ 2025-04-14 17:18:37 +00:00
SomberNight
1144d9b8ea build: add script build_cleanlocale.sh 2025-04-14 17:18:34 +00:00
SomberNight
3567a4cfb0 mv git submodule electrum-locale from contrib to electrum/locale
- this merges `contrib/deterministic-build/locale` and `electrum/locale`
- it is now once again possible have translations when running from a local git clone
    - which was already possible in the past before crowdin removed their unauthenticated APIs
        - see https://github.com/spesmilo/electrum/issues/9531
    - however, the translations available are the often-old frozen strings from electrum-locale
        - while previously one could just download the latest strings from crowdin
2025-04-14 17:18:30 +00:00
ghost43
746076ba12 Merge pull request #9731 from f321x/remove_multi_hop_legacy_trampoline_option
lightning: remove LIGHTNING_LEGACY_ADD_TRAMPOLINE config option
2025-04-14 17:14:50 +00:00
ThomasV
c93b13f6d9 Make it possible to create zip plugins from internal plugins
specifically:
 - add 'name' field to manifest.json
 - make 'version' optional in contrib/make_plugin
 - fix import in jade plugin
2025-04-14 11:54:04 +02:00
f321x
e72de47ef0 Remove LIGHTNING_LEGACY_ADD_TRAMPOLINE config option to prevent too large onion payload
The option to add a 2nd trampoline hop to legacy trampoline payments requires too much space in the trampoline onion.
Because the trampoline onion has only limited space of 400b and the payload with 2nd t hop and no r_tags already requires 392b it is essentially unusable for payments that require routing hints to be included in the onion
(because the receiver has no direct channel to the 2nd trampoline node)
as there is no space left to include them (1r_tag == ~52b).
2025-04-14 09:35:41 +02:00
ThomasV
eff8b65355 Plugins: pass wallet to settings_dialog
Also, remove settings_widget method.
The widget should always be a button.

nwc: is_initialized -> initialized
2025-04-12 11:09:15 +02:00
ThomasV
3a18000f7a nwc plugin: settings_dialog is wallet agnostic.
instead, test wallet in start_plugin.
prevent plugin from using several wallets.
2025-04-11 20:16:59 +02:00
ThomasV
13024be4da nwc plugin: fix config key 2025-04-11 20:06:42 +02:00
ThomasV
bcb6df72a7 Merge pull request #9729 from spesmilo/recursive_config
recursive config file
2025-04-11 20:02:25 +02:00
SomberNight
bd0085e680 tests: commands: add test_setconfig_none 2025-04-11 17:17:53 +00:00
ThomasV
8f3490c87e recursive config file
move plugin variables into sub dictionaries of user config
2025-04-11 19:06:48 +02:00
ThomasV
58cd626463 Merge pull request #9723 from f321x/lightning_pay_assertion_error
lightning: prevent usage of unavailable channels for payment
2025-04-11 14:19:58 +02:00
f321x
f1900e493d Fix assertion error in ln payments when using same seed in multiple wallets.
Make path calculation check if channel is not in our sending channels but still uses our nodeID as starting node of the path.

I noticed an assertion error when trying to pay an invoice from a seed i have opened channels with in different wallet instances (same seed, different wallet).
Because the channel seemed suitable for sending the payment path finding included the channel for sending in the first position of the route but then
in pay_to_route the channel for route[0] could not be found as it is not included in our channel list, causing the assert and payment to fail.
2025-04-11 14:04:51 +02:00
ThomasV
875cb24665 Merge pull request #9707 from f321x/fix_receive_unknown_htlc_failed
lightning: trigger payment_failed only once in LNWallet.htlc_failed().
2025-04-11 12:39:25 +02:00
ThomasV
a500d5194d make plugins dialog available in tray
This makes it possible to install a third-party plugin from
the wizard, before creating a wallet, e.g. for a hardware wallet.
2025-04-11 10:27:34 +02:00
ThomasV
e084789577 minor fix (follow-up 737417fb80) 2025-04-11 10:05:58 +02:00
ThomasV
de047195a9 Allow zip plugins to register keystore
This makes it possible to create external plugins that add support
for hardware wallets.
2025-04-11 09:20:57 +02:00
ThomasV
737417fb80 Userspace plugins:
- Allow plugins saved as zipfiles in user data dir
 - plugins are authorized with a user chosen password
 - pubkey derived from password is saved with admin permissions
2025-04-11 08:45:28 +02:00
accumulator
bd5de52768 Merge pull request #9697 from accumulator/qml_buttons
qml: add ellipsis to buttons that are followed by another chance to bail
2025-04-10 19:52:56 +02:00
Sander van Grieken
ad4aafa2e4 qml: add ellipsis to buttons that are followed by another chance to bail 2025-04-10 19:52:44 +02:00