Binary cache lives inside the install dir, so sfw can't run from a read-only install
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 68/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- javascript, node.js
- Domain
- cli
Research direction
Start with dist/sfw.mjs, where the issue says the wrapper sets INSTALL_ROOT and creates .sfw-cache; check how it chooses and prepares the binary cache. The report proposes an SFW_CACHE_DIR override and a user cache directory fallback when the install directory is unwritable. Done when sfw can run from a read-only install without an existing cached binary; the issue names no test file or command.
Written by the indexing model from the issue text.
Description
The sfw npm wrapper downloads the firewall binary into .sfw-cache right next to the installed package (INSTALL_ROOT in dist/sfw.mjs). If that directory isn't writable, every invocation dies before doing anything:
$ sfw npx --version
[sfw] Failed to prepare firewall binary: ENOENT: no such file or directory, mkdir '/nix/store/...-sfw-2.0.6/lib/node_modules/sfw/.sfw-cache'
I hit this on NixOS, where the package lives in the read-only Nix store, so sfw is broken on first run, not just when it tries to self-update. But it's the same class of problem as SocketDev/sfw-free#12 (global install as root, then running as a normal user). That issue is closed now and the SFW_SKIP_UPDATE_CHECK=1 workaround doesn't help here, since there is no cached binary to fall back to.
Would you take a patch (or add support) for an override like SFW_CACHE_DIR, defaulting to something under the user's cache dir when the install dir isn't writable? On my end I patched the bundled sfw.mjs to check process.env.SFW_CACHE_DIR first and default the wrapper to $HOME/.cache/sfw, which fixes it, but it would be better coming from upstream so distro packagers don't each carry their own hack.
- Dominant language
- No language data
- Stars
- 271
- Forks
- 8
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from SocketDev/sfw-free
-
Difficulty 1/5 Under an hour Newbie friendliness 87/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
False positive?Open
Difficulty 3/5 1-2 days Newbie friendliness 42/100
All issues in SocketDev/sfw-free
Similar issues
-
manually bump balena-preload to ^19.0.6Possibly taken @shaunmulligan claimed this today. Open
Difficulty 1/5 1-3 hours Newbie friendliness 66/100
balena-io/balena-cli#3200 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
ranxianglei/billion-context#7858 ·
Maintainers usually reply within 1 day
-
Bash init calls `cygpath` unconditionally on Windows, which breaks non-Cygwin shells like `brush`Possibly taken @iliqiliev claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
ajeetdsouza/zoxide#1381 ·
Maintainers usually reply within 5 days
-
needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
MakazhanAlpamys/Soup#3415 ·
Maintainers usually reply within 1 day