Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Secret service is not returning the secrets that've been put into it #216

Open
Zk2u opened this issue Sep 23, 2024 · 4 comments
Open

Secret service is not returning the secrets that've been put into it #216

Zk2u opened this issue Sep 23, 2024 · 4 comments
Labels

Comments

@Zk2u
Copy link

Zk2u commented Sep 23, 2024

Hiya, some of the checks in a CLI tool I'm working on are failing in the secret management side. We're storing a blob of 76 bytes in the keychain, but when we immediately read it back, I get 152 bytes. The fact that it's exactly 2x what we're putting in makes me think that an implicit conversion to hex is occurring somewhere, but where I'm not sure.

I also tried using the password API to see if that made a difference - it did, but the string that I got back was not the string that I put in. Something's going a bit wrong :))

Operating System: Nobara Linux 40
KDE Plasma Version: 6.1.4
KDE Frameworks Version: 6.5.0
Qt Version: 6.7.2
Kernel Version: 6.11.0-200.fsync.fc40.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 16 × 12th Gen Intel® Core™ i5-12600K
Memory: 31.1 GiB of RAM
Graphics Processor: AMD Radeon RX 7900 XTX
Manufacturer: Gigabyte Technology Co., Ltd.
Product Name: Z690I AORUS ULTRA DDR4
System Version: -CF
@brotskydotcom
Copy link
Collaborator

Hi @Zk2u, sorry for taking so long to get back to you. I'm afraid this isn't enough information for me to investigate. Can you reproduce this issue using the keyring-cli with the -v argument and attach the terminal output here? Something like this:

$ echo "----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+-" | base64
LS0tLSstLS0tMS0tLS0rLS0tLTItLS0tKy0tLS0zLS0tLSstLS0tNC0tLS0rLS0tLTUtLS0tKy0tLS02LS0tLSstLS0tNy0tLS0rLQo=
$ keyring-cli -v set --secret LS0tLSstLS0tMS0tLS0rLS0tLTItLS0tKy0tLS0zLS0tLSstLS0tNC0tLS0rLS0tLTUtLS0tKy0tLS02LS0tLSstLS0tNy0tLS0rLQo=
Set secret for 'dbrotsky@keyring-cli' to decode of 'LS0tLSstLS0tMS0tLS0rLS0tLTItLS0tKy0tLS0zLS0tLSstLS0tNC0tLS0rLS0tLTUtLS0tKy0tLS02LS0tLSstLS0tNy0tLS0rLQo='
21795$ keyring-cli -v secret
LS0tLSstLS0tMS0tLS0rLS0tLTItLS0tKy0tLS0zLS0tLSstLS0tNC0tLS0rLS0tLTUtLS0tKy0tLS02LS0tLSstLS0tNy0tLS0rLQo=
Secret for 'dbrotsky@keyring-cli' encodes as LS0tLSstLS0tMS0tLS0rLS0tLTItLS0tKy0tLS0zLS0tLSstLS0tNC0tLS0rLS0tLTUtLS0tKy0tLS02LS0tLSstLS0tNy0tLS0rLQo=
21796$ keyring-cli -v password
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+-

Password for 'dbrotsky@keyring-cli' is '----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+-
'

See if the output matches the input when you use your data.

@Zk2u
Copy link
Author

Zk2u commented Oct 15, 2024

Hiya no worries, let me get back to this later today.

@Zk2u
Copy link
Author

Zk2u commented Oct 15, 2024

Screenshot 2024-10-15 at 13 49 37

Not even saving for some reason :/

@brotskydotcom
Copy link
Collaborator

brotskydotcom commented Oct 15, 2024

In this run, it looks like you likely built the CLI without enabling the keystore features you want. This means that you get the mock keystore as the default, and the mock keystore has no persistence. Please try again with a full build and run so I can see the keystore you are using. Something like:

$ cargo run --features=sync-secret-service --example=keyring-cli -- -v set --secret LS0tLSstLS0tMS0tLS0rLS0tLTItLS0tKy0tLS0zLS0tLSstLS0tNC0tLS0rLS0tLTUtLS0tKy0tLS02LS0tLSstLS0tNy0tLS0rLQ==
   Compiling memchr v2.7.4
   Compiling regex-syntax v0.8.5
   Compiling aho-corasick v1.1.3
   Compiling regex-automata v0.4.8
   Compiling log v0.4.22
   Compiling humantime v2.1.0
   Compiling keyring v3.4.0 (/home/dbrotsky/src.vendor/keyring-rs)
   Compiling rprompt v2.1.1
   Compiling regex v1.11.0
   Compiling env_filter v0.1.2
   Compiling env_logger v0.11.5
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 4.03s
     Running `target/debug/examples/keyring-cli -v set --secret LS0tLSstLS0tMS0tLS0rLS0tLTItLS0tKy0tLS0zLS0tLSstLS0tNC0tLS0rLS0tLTUtLS0tKy0tLS02LS0tLSstLS0tNy0tLS0rLQ==`
Set secret for 'dbrotsky@keyring-cli' to decode of 'LS0tLSstLS0tMS0tLS0rLS0tLTItLS0tKy0tLS0zLS0tLSstLS0tNC0tLS0rLS0tLTUtLS0tKy0tLS02LS0tLSstLS0tNy0tLS0rLQ=='
$ cargo run --features=sync-secret-service --example=keyring-cli -- -v secret
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.03s
     Running `target/debug/examples/keyring-cli -v secret`
LS0tLSstLS0tMS0tLS0rLS0tLTItLS0tKy0tLS0zLS0tLSstLS0tNC0tLS0rLS0tLTUtLS0tKy0tLS02LS0tLSstLS0tNy0tLS0rLQ==
Secret for 'dbrotsky@keyring-cli' encodes as LS0tLSstLS0tMS0tLS0rLS0tLTItLS0tKy0tLS0zLS0tLSstLS0tNC0tLS0rLS0tLTUtLS0tKy0tLS02LS0tLSstLS0tNy0tLS0rLQ==
$ cargo run --features=sync-secret-service --example=keyring-cli -- -v password
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.03s
     Running `target/debug/examples/keyring-cli -v password`
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+-
Password for 'dbrotsky@keyring-cli' is '----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+-'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants