Skip to content

Commit 66af467

Browse files
committed
add sfw
1 parent 481f6df commit 66af467

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

README.md

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,8 @@ For `deno`, we can also set the following in a `deno.json` file:
149149

150150
> [!TIP]
151151
>
152-
> When dealing with merge conflicts in lockfiles, it is _not_ necessary to delete the lockfile. When dependencies (including transitive) are defined with version range operators (`^`, `~`, etc), re-building the lockfile from scratch can result in unexpected updates.
153-
>
152+
> When dealing with merge conflicts in lockfiles, it is _not_ necessary to delete the lockfile. When dependencies (including transitive) are defined with version range operators (`^`, `~`, etc), re-building the lockfile from scratch can result in unexpected updates.
153+
>
154154
> Modern package managers have built-in conflict resolutions[^18][^19], just [checkout main and re-run `install`](https://github.com/yarnpkg/yarn/issues/1776#issuecomment-269539948). `pnpm` also allows [Git Branch Lockfiles](https://pnpm.io/git_branch_lockfiles) where it creates a new lockfile based on branch name, and automatically merge it back into the main lockfile later.
155155
156156
### 3. Disable Lifecycle Scripts
@@ -168,7 +168,7 @@ For `bun`, `deno` and `pnpm`, they are disabled by default.
168168

169169
> [!NOTE]
170170
>
171-
> For `bun`, the [top 500 npm packages](https://github.com/oven-sh/bun/blob/main/src/install/default-trusted-dependencies.txt) with lifecycle scripts are allowed by default.
171+
> For `bun`, the [top 500 npm packages](https://github.com/oven-sh/bun/blob/main/src/install/default-trusted-dependencies.txt) with lifecycle scripts are allowed by default.
172172
173173
> [!TIP]
174174
> We can combine many of the flags above. For example, the following `npm` command would install only production dependencies as defined in the lockfile and ignore lifecycle scripts:
@@ -363,7 +363,7 @@ The `files` field in `package.json` is used to specify the files that should be
363363
> [!TIP]
364364
>
365365
> The `.npmignore` file can also be used to exclude files from the published package. It will not override the `"files"` field, but in subdirectories it will.
366-
>
366+
>
367367
> The `.npmignore` file works just like a `.gitignore`. If there is a `.gitignore` file, and `.npmignore` is missing, `.gitignore`'s contents will be used instead.
368368
369369
Run `npm pack --dry-run` or `npm publish --dry-run` to see what would happen when we run the pack or publish command.
@@ -410,7 +410,7 @@ Here are some private registries that you might find useful:
410410

411411
- GitHub Packages https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-npm-registry
412412
- Verdaccio https://github.com/verdaccio/verdaccio
413-
- See Verdaccio best practices: https://verdaccio.org/docs/best/
413+
- See Verdaccio best practices: https://verdaccio.org/docs/best/
414414
- Vlt https://www.vlt.sh/
415415
- JFrog Artifactory https://jfrog.com/integrations/npm-registry
416416
- Sonatype: https://help.sonatype.com/en/npm-registry.html
@@ -457,6 +457,18 @@ https://socket.dev
457457

458458
Socket.dev is a security platform that protects code from both vulnerable and malicious dependencies. It offers various tools such as a [GitHub App](https://socket.dev/features/github) scans pull requests, [CLI tool](https://socket.dev/features/cli), [web extension](https://socket.dev/features/web-extension), [VSCode extension](https://docs.socket.dev/docs/socket-for-vs-code) and more. Here's their talk on [AI powered malware hunting at scale, Jan 2025](https://youtu.be/cxJPiMwoIyY).
459459

460+
[Socket Firewall](https://socket.dev/blog/introducing-socket-firewall) is a free tool to block malicious packages at install time:
461+
462+
```sh
463+
npm i -g sfw
464+
465+
# works for `npm`, `yarn`, `pnpm`
466+
sfw npm install <package-name>
467+
468+
# example: alias `npm` to `sfw npm` in zsh
469+
# echo "alias npm='sfw npm'" >> ~/.zshrc
470+
```
471+
460472
#### Snyk
461473

462474
https://snyk.io

0 commit comments

Comments
 (0)