Dashlane / dashlane-cli

👩‍💻 Dashlane CLI - Access your secrets in your terminal, servers and CI/CD
https://cli.dashlane.com/
Apache License 2.0
189 stars 52 forks source link

Clipboard does not work on Wayland / Sway #210

Open zupd opened 9 months ago

zupd commented 9 months ago

Describe the bug When using Wayland / Sway passwords wont get copied to the clipboard.

To Reproduce Steps to reproduce the behavior:

  1. Use wayland / sway
  2. run dcli password </li> </ol> <p><strong>Expected behavior</strong> Password should get copied to clipboard</p> <p><strong>Screenshots</strong></p> <p><strong>Environment (please complete the following information):</strong></p> <ul> <li>OS: Linux Ubuntu 23.04</li> <li>display server protocol: Wayland</li> <li>compositor (window manager): Sway</li> </ul> <p><strong>Additional context</strong> The reason why this happens is because wayland dont use xsel / xcopy to copy to clipboard. it uses wl-copy instead. And there is currently no support for this in the clipboardy package that dashlane CLI uses.</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/Mikescops"><img src="https://avatars.githubusercontent.com/u/4266283?v=4" />Mikescops</a> commented <strong> 9 months ago</strong> </div> <div class="markdown-body"> <p>Hello, Thanks for reporting this, I'm surprised because we don't use "clipboardy" package but an implementation in Rust that should work with wayland. Can you confirm you're running the latest version of the CLI please?</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/Mikescops"><img src="https://avatars.githubusercontent.com/u/4266283?v=4" />Mikescops</a> commented <strong> 7 months ago</strong> </div> <div class="markdown-body"> <p>Hello, Just a reminder on this issue, if I get no answer this week I'll close it but you can feel free to comment anytime to reopen it of course. Thanks a lot!</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/zupd"><img src="https://avatars.githubusercontent.com/u/13159123?v=4" />zupd</a> commented <strong> 6 months ago</strong> </div> <div class="markdown-body"> <p>Sorry, I'll check this today</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/zupd"><img src="https://avatars.githubusercontent.com/u/13159123?v=4" />zupd</a> commented <strong> 4 months ago</strong> </div> <div class="markdown-body"> <p>@Mikescops Sorry for not responding in a while. When I tested this in february I was running version 1.15.0. Today I updated the client to 6.2424.2 and I can confirm the clipboard functionality is working as intended yes.</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/Mikescops"><img src="https://avatars.githubusercontent.com/u/4266283?v=4" />Mikescops</a> commented <strong> 4 months ago</strong> </div> <div class="markdown-body"> <p>@zupd awesome thanks!</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/JonahWeinbaum"><img src="https://avatars.githubusercontent.com/u/81923472?v=4" />JonahWeinbaum</a> commented <strong> 2 weeks ago</strong> </div> <div class="markdown-body"> <p>This issue is still present on current version.</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/zupd"><img src="https://avatars.githubusercontent.com/u/13159123?v=4" />zupd</a> commented <strong> 2 weeks ago</strong> </div> <div class="markdown-body"> <blockquote> <p>This issue is still present on current version.</p> </blockquote> <p>I can confirm this @Mikescops . It seems that when I tested this first, it was on Ubuntu 23.04, and when I tested it the second time I was on Debian 12 which also uses wayland. And I assumed it worked in the latest version now, since it worked on Debian 12, but when I now tried it on my Ubuntu again it won't copy to my clipboard. This is on the latest version of dcli.</p> <pre><code>~/Downloads$ wl-copy 'TEST123' ~/Downloads$ wl-paste TEST123 ~/Downloads$ dcli p github 🔓 password for "GitHub" copied to clipboard! ~/Downloads$ wl-paste No selection</code></pre> <p>It almost seems like dcli resets the clipboard and doesnt copy anything into it</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/JonahWeinbaum"><img src="https://avatars.githubusercontent.com/u/81923472?v=4" />JonahWeinbaum</a> commented <strong> 2 weeks ago</strong> </div> <div class="markdown-body"> <p>I will test a theory in the morning but it seems that the clipboard package being used will do an ANSI OSC52 sequence to copy if it detects it is being run from within ssh, which should work fine with sway. </p> <p>If anyone desires to test this, my working theory is that if you are running ssh inside of sway this would work fine. I'm not at my sway desktop currently but will examine further.</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/JonahWeinbaum"><img src="https://avatars.githubusercontent.com/u/81923472?v=4" />JonahWeinbaum</a> commented <strong> 2 weeks ago</strong> </div> <div class="markdown-body"> <p>Okay after further examination here are some notes. Your package uses napi-rs/clipboard which, under normal circumstances, uses arboard clipboard, which itself has a flag that can be used during compilation of <code>wayland-data-control</code>. I imagine this could aid in solving such problems since this uses <code>wl-copy</code> as a secondary copying method. </p> <p>As they note </p> <pre><code>There's also an optional wayland data control backend through the wl-clipboard-rs crate. This can be enabled using the wayland-data-control feature. When enabled this will be prioritized over the X11 backend, but if the initialization fails, the implementation falls back to using the X11 protocol automatically. Note that in my tests the wayland backend did not keep the clipboard contents after the process exited. </code></pre> <p>EDIT: I am wrong, further examination shows napi-rs/clipboard compiles arboard with <code>wayland-data-control</code>. A real head scrathcher. I will test each dependency when I am back at my main computer. Too many dependencies deep...</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/JonahWeinbaum"><img src="https://avatars.githubusercontent.com/u/81923472?v=4" />JonahWeinbaum</a> commented <strong> 2 weeks ago</strong> </div> <div class="markdown-body"> <p>Okay quick update. This problem goes all the way down to arboard. Arboard can successfully retrieve clipboard data in sway but cannot copy to the clipboard even with the <code>wayland-data-control</code> feature...</p> <pre><code>$ ./target/debug/copy Clipboard text was: test But now the clipboard text should be: "Hello, world!" $ wl-paste Nothing is copied</code></pre> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/zupd"><img src="https://avatars.githubusercontent.com/u/13159123?v=4" />zupd</a> commented <strong> 2 weeks ago</strong> </div> <div class="markdown-body"> <blockquote> <p>Okay quick update. This problem goes all the way down to arboard. Arboard can successfully retrieve clipboard data in sway but cannot copy to the clipboard even with the <code>wayland-data-control</code> feature...</p> <pre><code>$ ./target/debug/copy Clipboard text was: test But now the clipboard text should be: "Hello, world!" $ wl-paste Nothing is copied</code></pre> </blockquote> <p>This looks just like my test with dashlane when I had something in the clipboard, then ran dashlane and then clipboard was empty</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/Mikescops"><img src="https://avatars.githubusercontent.com/u/4266283?v=4" />Mikescops</a> commented <strong> 2 weeks ago</strong> </div> <div class="markdown-body"> <p>Hey guys, thanks for your nice investigation.</p> <p>As arboard author mentioned <code>Note that in my tests the wayland backend did not keep the clipboard contents after the process exited.</code> which seems to match the behaviour we have here, you copy something, the process exit, and the content disappear from clipboard. </p> <p>I think it will be hard to support every environments with the clipboard functionality, do you think it's acceptable to output the password directly so it can be piped into wl-copy? If so we can just suggest such command in our documentation.</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/zupd"><img src="https://avatars.githubusercontent.com/u/13159123?v=4" />zupd</a> commented <strong> 1 week ago</strong> </div> <div class="markdown-body"> <blockquote> <p>Hey guys, thanks for your nice investigation.</p> <p>As arboard author mentioned <code>Note that in my tests the wayland backend did not keep the clipboard contents after the process exited.</code> which seems to match the behaviour we have here, you copy something, the process exit, and the content disappear from clipboard.</p> <p>I think it will be hard to support every environments with the clipboard functionality, do you think it's acceptable to output the password directly so it can be piped into wl-copy? If so we can just suggest such command in our documentation.</p> </blockquote> <p>It already supports that, right? if you use <code>-o console</code>. though I noticed that it also includes the "password for .. copied to clipboard". Seems strange that it says that when you use console as output instead of clipboard</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/Mikescops"><img src="https://avatars.githubusercontent.com/u/4266283?v=4" />Mikescops</a> commented <strong> 1 week ago</strong> </div> <div class="markdown-body"> <p>@zupd definitely a bug, I'll take a look thanks</p> </div> </div> <div class="page-bar-simple"> </div> <div class="footer"> <ul class="body"> <li>© <script> document.write(new Date().getFullYear()) </script> Githubissues.</li> <li>Githubissues is a development platform for aggregating issues.</li> </ul> </div> <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js"></script> <script src="/githubissues/assets/js.js"></script> <script src="/githubissues/assets/markdown.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/highlight.min.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/languages/go.min.js"></script> <script> hljs.highlightAll(); </script> </body> </html>