You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[devbox add] --allow-insecure should handle multiple, user-specified packages (#1749)
## Summary
Changes
1. Modify `devbox add`'s `--allow-insecure` flag to take a `[]string`
instead of `bool`.
2. Save `allow_insecure` field in the package in the `devbox.json`
config
3. Set `NIXPKGS_ALLOW_INSECURE=1` in the `nix build` during `devbox add`
4. Set the packages specified in `allow_insecure` in the generated
flake's `permittedInsecurePackages`.
TODO:
- [x] Handle existing projects with `allow_insecure: true` in their
`devbox.lock` (#1754)
**Downside:**
If a user erroneously specifies the wrong package name or names in
`--allow-insecure=<packages>`, then a `devbox add <pkg>
--allow-insecure=<packages>` outside the `devbox shell` environment will
quietly work. However, the user will experience an error when running
`devbox shell` (or similar) next time, and need to fix the erroneous
`--allow-insecure` value.
- Fix: we could fix this by doing "recomputeState" when
installing-with-insecure in "ensureStateIsUpToDate", but I haven't to
avoid adding complexity for this unlikely scenario. I call it unlikely
because the error message (see below) specifically tells the user what
values to use with `--allow-insecure=<packages>`
Fixes#1337
## How was it tested?
`devbox add [email protected]` gives the following error now:
```
devbox add [email protected]
Info: Adding package "[email protected]" to devbox.json
[1/1] python2
[1/1] python2: Fail
Error: Nix: Package ‘python-2.7.18.7’ is insecure.
Known vulnerabilities:
Python 2.7 has reached its end of life after 2020-01-01. See https://www.python.org/doc/sunset-python-2/.
To override, use `devbox add <pkg> --allow-insecure=python-2.7.18.7`
```
Doing `devbox add [email protected] --allow-insecure=python-2.7.18.1` works
with the devbox.json now having:
```
+ "python": {
+ "version": "2.7",
+ "allow_insecure": ["python-2.7.18.7"],
+ },
```
Also for the package reported in #1337:
<img width="907" alt="Screenshot 2024-01-25 at 5 43 43 PM"
src="https://github.com/jetpack-io/devbox/assets/676452/8d922d43-0c1c-4e86-ae6e-12fe9bc9e82d">
0 commit comments