mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[GH-ISSUE #5926] vscode: cannot access USB debugger #3133
Labels
No labels
LTS merge
LTS merge
bug
bug
converted-to-discussion
doc-todo
documentation
duplicate
enhancement
file-transfer
firecfg
firejail-in-firejail
firetools
graphics
help wanted
information_old
installation
invalid
modif
moved
needinfo
networking
notabug
notourbug
old-version
overlayfs
packaging
profile-request
pull-request
question
question_old
removal
runtime-permissions
sandbox-ipc
security
stale
wiki
wiki
wontfix
wordpress
workaround
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/firejail#3133
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @ghost on GitHub (Jul 27, 2023).
Original GitHub issue: https://github.com/netblue30/firejail/issues/5926
Hi all,
I am using Visual Studio Code to develop software, and would like to use the hardware debugger (ST-Link V2).
Unfortunately, the firejail locks the access of the software to the USB devices (message from the debug terminal):
This happens when I am starting VSCode from the desktop shortcut, but also when running
When starting with
Everything works as it should. I tried removing line by line the default config (since something clearly locks the software access to the USB ports), but could not get it to work. Can you share some guidelines on what to check to fix the profile?
Is this considered a bug or should the final fix for the issue be placed in the code.local config?
@ghost commented on GitHub (Jul 27, 2023):
Great, that confirms the problem is in the code.profile and fixable.
First option that popped up as the culprit was
private-dev. But I assume you've already tried removing that. The rather complexinclude logicfor our VSCode profile sure doesn't make tasks like this any easier. And that affects your final question on where to place a fix or workaround. Let's put that aside for now and try to get a working code.profile. Based on your info that--noprofiledoes that, I've put together the below for you to test. Remember that using the --noprofile flag means that thedefault.profileoptions are used. Adding comments where these options stem from under /etc/firejail will hopefully help you solve the 'where do I place the fix' puzzle.Does that offer you a working baseline profile for VSCode as you use it - including any plugins etcetera? If so, you can try hardening it. If not, we'll have to redo :)
@rusty-snake commented on GitHub (Jul 27, 2023):
How do you test? Is the hardware plugged-in when you start code or do you need hotplug support?
noinputblocks /dev/usb IIRC. Or was itnou2f?@ghost commented on GitHub (Jul 27, 2023):
Hi, thank you for the responses.
@glitsj16 your config indeed works, however is very different to what is included in the default profile shipped in Fedora (it seems like it is the same profile as included in the repo).
@rusty-snake I run the cortex-debug command from code, with the st-link connected to the PC beforehand. I don't strictly need the hotplug, since code remembers the workspace's state. IDK if this is an issue with noinput or nou2f, since both are included in the config by @glitsj16. Or maybe my understanding of the config is wrong - I always thought that you include the parts you want to dissallow - so that when you don't have nou2f you can use them, but when you add them you can't. However, even if I comment out
nou2fin the above config the debugger still works.@rusty-snake commented on GitHub (Jul 27, 2023):
So if you use the profile from above, it works no matter if
nou2fis set or not?@ghost commented on GitHub (Jul 27, 2023):
Correct, my above config reflects the current git state of VSCode-related profiles. If you're on 0.9.72 you don't have any of the changes introduced in
47e3c82ab5. IIRC the refactoring didn't flip, drop or add anything, just reshuffled existing options into different files. I'll have a look at 0.9.72 and post something you can integrate with that. Before doing so I wanted to know if my guess-work above could be confirmed to work :)UPDATE:
Looks like you only need to
ignore private-dev. You can do so on0.9.72either incode.local(only affecting VSCode) or inelectron.local(affecting all electron-based software you use via firejail). The potential hardenings I referred to in the above example config can be added/tested byinclude electron-hardened.inc.profile, also in either one of the aforementioned files.@ghost commented on GitHub (Jul 28, 2023):
Yes, I tried both and it worked regardless.
@glitsj16 I added ignore private-dev in my code.local, and indeed it works fine. I also tried to include the hardened electron, but no luck, in fedora the
chrome-common-hardened.inc.profileis not present, so I followed the commit you mentioned and added the hardening fromblink-common-hardened.inc.profileto my local, keeping the originalcode.profileas the stock version from fedora. So this is my finalcode.local:With this configuration all my extensions work, code has no access to ssh keys etc, and the hardware debugging works correctly.
From my perspective this issue is fixed, thank you very much for your support, I appreciate it. If you would like me to test something else or help in other way please let me know.
@ghost commented on GitHub (Jul 29, 2023):
That's actually a known bug, which was fixed by the earlier mentioned
47e3c82ab5. On 0.9.72 you can safely exchange (the non-existing)chrome-common-hardened.inc.profile with (the existing)chromium-common-hardened.inc.profile in /etc/firejail/electron-hardened-inc.profile. After doing so you can include the hardened electron. That would be the more future-proof way to go here IMO.Thanks for the appreciation :)
Come to think of it, there actually is a quite important potential
hardeningto be made for the code.profile that you might want to test. You probably noticed that we've disabled it to be a fully whitelisting profile (which is the most hardened sandbox you can get with firejail):bf8229dde7/etc/profile-a-l/code.profile (L8-L23)If you're interested to help, that would be awesome. It's been untested for a while a now, so take your time, test VSCode for a while with a fully whitelisting profile and drop your observations in a new issue or discussion report when ready.
@rusty-snake commented on GitHub (Jul 29, 2023):
If you use it for more than just editing, these can be kept without discussion.
@ghost commented on GitHub (Jul 31, 2023):
Yes, from what I quickly tested enabling these options breaks some stuff, such as code compilation.
I included some options from the list of disabled ones in
code.profile, found a few that probably can be safely included in the default configuration, will test them for a bit longer and give you back my feedback in the mentioned new issue.Anyway I think that this one can be safely closed.
@kmk3 commented on GitHub (Jul 31, 2023):
(Re-closing as "not planned" since nothing was changed in firejail)