mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[GH-ISSUE #5683] One-shot copy single file into Firejail and let me run a parser against it #3062
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#3062
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 @bf on GitHub (Feb 25, 2023).
Original GitHub issue: https://github.com/netblue30/firejail/issues/5683
Is your feature request related to a problem? Please describe.
When parsing unknown third-party PDF files, I'd like to run a PDF parser via firejail on a certain file so that:
Describe the solution you'd like
Something like
firejail --noprofile --private --net=none --blacklist=/ --whitelist=/home/foo/data/files/X.pdf --read-only=/home/foo/data/files/X.pdf pdftotext /home/foo/data/files/X.pdf.Currently this command fails because --private doesn't allow mounting
/home/foo/datawithin the container.Describe alternatives you've considered
I have tried using
--put=/home/foo/data/files/X.pdf /home/foo/data/files/X.pdfbut it seems it cannot be used with--noprofilebecause it always asks for pid or name to be given.Additional context
I have chosen the pdftotext example because there is already a firejail profile for it:
8983cff10a/etc/profile-m-z/pdftotext.profileFrom the profile it seems there is no possibility to limit access to only the file supplied via command line. In my case I know beforehand which exact file pdftotext should run on. I want make sure pdftotext does not see any other file in the filesystem.
Thank you
@bf commented on GitHub (Feb 25, 2023):
I've settled on something like this now. But its much too verbose to just make sure exactly one file is mounted as read-only for the program.
firejail --noprofile --caps.drop=all --nonewprivs --seccomp --net=none --nodbus --noinput --nogroups --noroot --private-dev --blacklist=/ --whitelist=/home/foo/data/asd.pdf --read-only=/home/foo/data/asd.pdf --private-cwd=/home/foo/data/ pdftotext asd.pdf -@smitsohu commented on GitHub (Feb 25, 2023):
Are you aware of the
private-homeoption? It will not mount the file but copy it (as per the issue title), so there is no need to worry aboutread-only.@ghost commented on GitHub (Feb 25, 2023):
What exactly do you mean by
parsingunknown third-party PDF files? Read them with a PDF viewer? Convert them to text like in your example with pdftotext? Inspect them with an app like qpdf (which can remove metadata too)?IMO it would be much easier to create a custom profile that has all the Firejail options to create a very tight sandbox and shell-script in whatever PDF you want to 'parse'. Right now your solution misses important options like disable-mnt, nonewprivs, memory-deny-write-execute, private-bin, private-cache, private-dev, private-etc, private-opt, private-srv, private-tmp, restrict-namespaces, ... Adding all those on CLI quickly becomes a pain too.