Skip to content

Conversation

@onur-ozkan
Copy link
Collaborator

There is a potential risk that if users make a typo in the passphrase field of the KDF config and then run the get_private_keys RPC, the returned private key will be incorrect because an empty string will be used as the passphrase. A typo in passphrase means the field is not defined, which causes the KDF to assume the user wants to operate in no-login mode (this is exactly what happens in #2458).

This PR disables coin activation and get_private_keys in no-login mode to prevent any risk on no-login mode, so users do not risk their funds and private keys due to a simple typo.

Resolves: #2458

Signed-off-by: Onur Özkan <[email protected]>
@mariocynicys
Copy link
Collaborator

p.s. some tests in rpc_command::offline_keys are failing.

Signed-off-by: Onur Özkan <[email protected]>
@shamardy shamardy self-requested a review September 11, 2025 03:32
@shamardy
Copy link
Collaborator

I don't think #2458 is related to no-login mode only, but will review this as a fix to the no-login mode problem and not as a complete fix to #2458

Copy link
Collaborator

@shamardy shamardy left a comment

Choose a reason for hiding this comment

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

My review according to this #2615 (comment)

Comment on lines 5139 to +5142
pub async fn lp_coininit(ctx: &MmArc, ticker: &str, req: &Json) -> Result<MmCoinEnum, String> {
if ctx.is_no_login_mode() {
return ERR!("Cannot enable coins in no-login mode.");
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

do we need something similar in v2 activation methods?

Comment on lines +447 to +449
if ctx.is_no_login_mode() {
return MmError::err(EnablePlatformCoinWithTokensError::CannotEnableInNoLoginMode);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I see that you did add the check for some of the v2 activation methods, but I think that we need it in the utxo v2 activation methods as well.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Isn't this a main gateway for all the v2 activations?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Isn't this a main gateway for all the v2 activations?

Apparently it's not, what the hell..? They live under the same module but not implement the activation traits...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Any activation or private-key related logic that isn't explicitly handled will eventually be covered by this check so we don't need to add ifs all over the codebase.

@onur-ozkan
Copy link
Collaborator Author

I don't think #2458 is related to no-login mode only, but will review this as a fix to the no-login mode problem and not as a complete fix to #2458

The root problem of that issue is related to no-login mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants