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

Doesn't work due to clipboard entry parsing #447

Closed
sidt4 opened this issue Mar 30, 2024 · 10 comments · Fixed by #454
Closed

Doesn't work due to clipboard entry parsing #447

sidt4 opened this issue Mar 30, 2024 · 10 comments · Fixed by #454

Comments

@sidt4
Copy link

sidt4 commented Mar 30, 2024

Appears the extension is trying to do something with the clipboard entry. I moved dir /usr/share/devhelp/books/ and created a empty file /usr/share/devhelp/books, the extension loaded fine.

After clearing all clipboard entries, it loaded fine and all was ok.

I think clipboard clearing should work irrespective of other features.

journalctl log:

Mar 30 18:12:30 linux gnome-shell[24359]: JS ERROR: Gio.IOErrorEnum: Error opening file /usr/share/devhelp/books: Is a directory
                                          fromJSON/bytes</<@file:///home/sid/.local/share/gnome-shell/extensions/clipboard-indicator@tudmotu.com/registry.js:232:47
                                          @resource:///org/gnome/shell/ui/init.js:21:20
@sidt4 sidt4 mentioned this issue Mar 30, 2024
@Tudmotu
Copy link
Owner

Tudmotu commented Apr 4, 2024

Not sure why would the extension try to open a random file? Did you edit the registry.txt file?

@sidt4
Copy link
Author

sidt4 commented Apr 4, 2024

Did you edit the registry.txt file?

Don't know what that is.

Extension wasn't working as expected (refer #439 (comment)) for more than a week. I thought it was due to recent GNOME Shell 46 upgrade stuff. As the issue wasn't going away, I decided to look into journalctl logs to fix the issue, as I wanted to get the extension working.

@Tudmotu
Copy link
Owner

Tudmotu commented Apr 5, 2024

Hmm interesting. If that every happens to you again, I would appreciate if you could make a copy of ~/.cache/clipboard-indicator@tudmotu.com/registry.txt and send it to me privately (remember to remove any sensitive information from it before sending it to me).

Do I understand correctly that the extension is currently working for you?

@Edu4rdSHL
Copy link

I'm having the same issue, every time I copy a system's directory path, the app tries to open it for some reason, and fails with the message stated in the issue. The fix, is to mv the path so that it doesn't exist anymore and re-enable the extension, then delete the entry containing the path and move the path back again in the file system.

I can reproduce it at any time I want, so let me post the registry.txt file.

$ cat ~/.cache/clipboard-indicator@tudmotu.com/registry.txt
[{"favorite":false,"mimetype":"UTF8_STRING","contents":"/home/edu4rdshl/.local/share/applications"},{"favorite":false,"mimetype":"text/plain;charset=utf-8","contents":".local/share/applications/"},{"favorite":false,"mimetype":"text/plain;charset=utf-8","contents":"/var/lib/pacman/local"}]

After checking, the issue is when the mimetype is set to UTF8_STRING, I can reproduce it for each line if I change the mimetype to that one. And, changing it to text/plain;charset=utf-8 makes the issue disappear.

@Tudmotu
Copy link
Owner

Tudmotu commented Apr 6, 2024

Thanks! This sounds like a bug. Will try to reproduce.

@Tudmotu
Copy link
Owner

Tudmotu commented Apr 6, 2024

@Edu4rdSHL from what app are you copying the path?

@Edu4rdSHL
Copy link

@Tudmotu from Gnome Terminal.

@Edu4rdSHL
Copy link

Edu4rdSHL commented Apr 6, 2024

Out of curiosity, why is even the app trying to execute something? That looks terrible to me. So, if I copy rm -rf $HOME and it gets set to UTF8_STRING, it will possibly run that?

Edit: I confirm this behavior. We have a RCE vulnerability right here. I will open a new issue to track it.

andyholmes added a commit to andyholmes/gnome-shell-extension-clipboard-indicator that referenced this issue Apr 6, 2024
The clipboard content type may be a filename represented by a
variety of mime-types, so double-check it is supported type
before loading the contents.

closes Tudmotu#447
closes Tudmotu#453
andyholmes added a commit to andyholmes/gnome-shell-extension-clipboard-indicator that referenced this issue Apr 6, 2024
The clipboard content type may be a filename represented by a
variety of mime-types, so double-check it is supported type
before loading the contents.

closes Tudmotu#447
closes Tudmotu#453
@Tudmotu
Copy link
Owner

Tudmotu commented Apr 7, 2024

@Edu4rdSHL I honestly have no idea. I don't understand how that could happen.

@sidt4
Copy link
Author

sidt4 commented Apr 7, 2024

Ran into this issue again.

Steps to reproduce:

  1. Clear all entries
  2. Copy /tmp/ to clipboard.
  3. Disable and enable extension
  4. Below error should happen.
Apr 07 18:11:29 linux gnome-shell[140892]: JS ERROR: Gio.IOErrorEnum: Error opening file /tmp: Is a directory
                                           fromJSON/bytes</<@file:///home/sid/.local/share/gnome-shell/extensions/clipboard-indicator@tudmotu.com/registry.js:232:47
                                           @resource:///org/gnome/shell/ui/init.js:21:20

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