Skip to Content

CLI

Manage your firewall from the terminal. Run npm, pip, or uv through the firewall and see which rules fired.

bsfw is the command-line tool for the Bytesafe Dependency Firewall. Use it to list your firewalls, save and apply firewall settings, and look up past installs in the firewall log.

You can also use it to run tools like npm or pip through the firewall. For example, bsfw npm install runs your usual npm install and sends its package requests through the firewall. As soon as the command finishes, bsfw shows the firewall's logged decisions for that run, including which rules blocked a version.

To do thisUse
Run npm or pip through the firewall and see which rules blocked a versionbsfw exec
See which firewalls exist and how one is set upbsfw firewall list, bsfw firewall show
Look up the rule that blocked a past installbsfw logs
See whether an upstream is failingbsfw logs --status error
Check what the firewall knows about one package versionbsfw package
Keep policy in git and apply itbsfw firewall export, bsfw firewall import
See or export a past config versionbsfw firewall history, bsfw firewall export --version
See who changed a firewall, a token, or a teambsfw audit
List the packages your builds actually pulledbsfw observations
Authenticate a CI job without storing a tokenbsfw oidc exchange

Install

Homebrew

Homebrew supports macOS and Linux, including Linux running under Windows Subsystem for Linux (WSL) 2. The bsfw cask installs the binary, shell completions, and the bsfw man page.

brew install bytesafedev/tap/bsfw

Install script

The install script supports macOS and Linux on amd64 and arm64. It downloads the latest release archive, verifies it against the release's checksums.txt, and installs bsfw to /usr/local/bin when writable or ~/.local/bin otherwise.

curl -fsSL https://raw.githubusercontent.com/bytesafedev/bsfw/main/install.sh | sh
VariableDescription
BSFW_VERSIONInstall a specific release. Use its release tag, including the v prefix
BSFW_INSTALL_DIRInstall the binary in this directory
BSFW_BASE_URLDownload release files from an internal mirror. Requires BSFW_VERSION

Native Windows and manual installation

On native Windows, download the Windows archive from GitHub Releases, verify it against checksums.txt, and put bsfw on PATH. WSL 2 users can use the Homebrew command above. Releases provide macOS, Linux, and Windows archives for amd64 and arm64. Each archive also contains shell completions and man pages.

Verify any installation:

bsfw version

Initial setup

Create a Personal Access Token (PAT) in the dashboard. Log in with your endpoint and namespace.

bsfw auth login --endpoint https://eu-sov-1.bytesafecloud.eu --namespace "<namespace-id>"
bsfw whoami

auth login prompts for the token and verifies it. It saves endpoint and namespace values supplied as flags to the selected profile. The token goes in the operating system keyring, with a fallback to ~/.config/bytesafe/credentials.json with file mode 0600 when no keyring is available.

In CI, set BYTESAFE_TOKEN instead of storing a token. For GitHub Actions without a long-lived token, use bsfw oidc exchange.

Configuration resolution

The CLI chooses the endpoint, namespace, access token, and firewall in this order.

  1. Command flag
  2. Environment variable
  3. Active profile
  4. Built-in default, where one exists

For example, BYTESAFE_NAMESPACE takes priority over the namespace saved in your profile. For the token, the CLI checks --token, then BYTESAFE_TOKEN, then the token saved by bsfw auth login.

Run bsfw auth status to see which values the CLI is using and where they came from. Add --no-verify to check the settings offline.

Profiles

A profile gives a name to the settings you reuse for a namespace or environment. It can also save a firewall choice for each ecosystem you wrap. Profiles live in ~/.config/bytesafe/config.toml. Set XDG_CONFIG_HOME to change the base directory or BYTESAFE_CONFIG to specify the full path.

CommandDescription
bsfw profile listList profiles; * marks the active profile
bsfw profile showShow resolved settings and the wrapper mappings that apply in the current directory
bsfw profile use <profile>Make a profile active
bsfw profile set <key> <value>Set endpoint, namespace, or firewall
bsfw profile remove <profile>Delete a profile; add --with-token to remove its stored token too

Use --profile <profile> or BYTESAFE_PROFILE for one command without changing the active profile.

bsfw auth login --profile production --endpoint https://eu-sov-1.bytesafecloud.eu --namespace "<namespace-id>"
bsfw profile show --profile production
bsfw logs --profile production --all-users

Environment variables

VariableDescription
BYTESAFE_ENDPOINTManagement API base URL
BYTESAFE_NAMESPACENamespace ID
BYTESAFE_TOKENAccess token
BYTESAFE_FIREWALLDefault firewall ID
BYTESAFE_PROFILEProfile to use
BYTESAFE_CONFIGFull path to the profile config file
BYTESAFE_CREDENTIAL_STOREStored-token backend: auto, keyring, or file
BYTESAFE_INTERACTIONInteraction ID appended to the token for firewall and audit-log correlation
BYTESAFE_TRUSTED_BUILDER_AUDIENCEDefault audience for bsfw oidc exchange
NO_COLORDisable colored output when set

Namespace and firewall values are IDs, not display names. Use bsfw namespaces and bsfw firewall list to find them.

Global flags

FlagDescription
--endpoint <url>Management API base URL
--namespace <id>Namespace ID
--token <token>Access token. A command-specific --token on firewall credentials means the upstream token instead
--firewall <id>Default firewall ID for the command. Alias --fw
--profile <name>Profile to use
--credential-store auto|keyring|fileStored-token backend
--interaction <id>Interaction ID for log correlation
-o, --output table|jsonOutput format. logs and exec also support ndjson and logfmt
--timeout <seconds>Request timeout; default 30
--no-colorDisable colored output
-v, --verbosePrint diagnostics to stderr

Dates and durations

Every flag that takes a point in time (logs --since, audit --from, audit --to) accepts the same four forms.

FormExampleMeans
Date2026-08-01Midnight local time on that date
Date and time"2026-08-01 14:30" or "2026-08-01 14:30:00"That local time. Quote it, or the shell splits it into two arguments
RFC 3339 timestamp2026-08-01T14:30:00ZExactly that instant, in the time zone the value carries
Duration back from now30m, 24h--since only

The date order is fixed: YYYY-MM-DD, the same order the CLI prints. Other orders such as 08/01/2026 are rejected with a usage error. A value without a time zone is read in the machine's local time zone, so the same command run in two time zones covers two different windows. Pass an RFC 3339 timestamp when the window has to be identical everywhere, which is the usual choice in CI.

Durations use hours, minutes, and seconds (h, m, s). There is no day unit: for a week use 168h or a date, not 7d. The fixed windows 7d, 30d, and 90d belong to observations --period only.

Timestamps in table output are printed in local time as YYYY-MM-DD HH:MM:SS. JSON output keeps the server's RFC 3339 UTC timestamps unchanged.

Commands

bsfw auth

CommandDescription
bsfw auth loginVerify and store an access token. --token-stdin reads it from stdin. Explicit --endpoint and --namespace values are saved to the profile
bsfw auth statusShow resolved configuration and verify the token. --no-verify skips the request
bsfw auth logoutRemove the stored token for the selected profile

bsfw whoami

Show the organization, namespace, user, and permissions granted by the token. Organization and user names appear alongside their IDs when the server returns them. Use this first when a command returns 403.

bsfw whoami
bsfw whoami -o json

bsfw namespaces

List namespaces available to the current credentials. Personal and Service Access Tokens are pinned to one namespace, so they normally return one entry.

bsfw namespaces

bsfw firewall list

Every firewall in the namespace, with the IDs the other commands take. Firewalls created in the dashboard get a generated ID that differs from the display name, and commands, profiles, and API paths all want the ID.

bsfw firewall list

The five commands below take the firewall ID as an argument. Leave it out to use the firewall set on the profile or in BYTESAFE_FIREWALL; without either, the command exits with a usage error.

bsfw firewall show

Summarize one firewall: ecosystem, which firewall it inherits from, its upstreams, and how many rules and exceptions it has. For the raw configuration, use export.

bsfw firewall show <firewall-id>

bsfw firewall rules

The firewall's rules, one per row. --verbose adds the selector columns, and -o json returns the complete rule objects. Inherited rules are not included; they stay on the parent firewall.

bsfw firewall rules <firewall-id> --verbose

bsfw firewall exceptions

The firewall's exceptions, one per row. --verbose adds columns; -o json returns the complete objects, including reason, expiry, and notes, which is what a review of open exceptions needs.

bsfw firewall exceptions <firewall-id> -o json

Creating and changing policy

The CLI deliberately changes firewall policy as one configuration document. Export, edit, and import it. Granular rule and exception editing lives in the dashboard, and the CLI has no delete command for a firewall.

bsfw firewall export

Print the firewall's complete configuration as JSON on stdout: upstreams, rules, exceptions, and permissions. Redirect it to a file to keep it in git. Stored upstream credentials come out as placeholders, never as values, so an export is safe to commit. Inherited rules stay on the parent firewall and are not part of the document.

Without --version this exports the current configuration. --version exports a stored past version instead, without changing anything; list the available versions with bsfw firewall history.

bsfw firewall export <firewall-id> > firewall-config.json
bsfw firewall export <firewall-id> --version 7 > firewall-config-v7.json

bsfw firewall history

Every save keeps the previous version. List them, newest first, to find a version number before exporting it with bsfw firewall export --version. --limit caps how many versions come back, 20 by default and 200 at most.

bsfw firewall history <firewall-id>
bsfw firewall history <firewall-id> --limit 50 -o json

bsfw firewall import

Read a complete firewall configuration from a file or stdin and apply it. The id in the JSON says which firewall it belongs to; there is no --firewall flag here. Import creates that firewall when it does not exist and replaces its entire configuration when it does, so a rule or exception missing from the file is removed from the firewall.

bsfw firewall import --file firewall-config.json
bsfw firewall import < firewall-config.json

Imports reject plaintext credentials. Exported placeholders preserve stored values for the same firewall and upstream. A new firewall or upstream has no stored value to preserve; set it with firewall credentials.

bsfw firewall credentials

Set the credentials a firewall uses against one private upstream. This is the command that fills in what an export leaves as a placeholder, and the one to run on a schedule when an upstream's token expires.

Only the fields you pass change, so rotating a token does not mean re-entering a username and password. With no credential flags and no --stdin, the CLI prompts for the values without echoing them, which keeps secrets out of shell history.

bsfw firewall credentials --firewall <firewall-id> --upstream <upstream-id>
printf '%s' '{"token":"<upstream-token>"}' | \
  bsfw firewall credentials --firewall <firewall-id> --upstream <upstream-id> --stdin
FlagDescription
--firewall <id>Which firewall owns the upstream
--file <path>Take the firewall ID from a config JSON file instead of --firewall
--upstream <id>Required. The upstream's id from the firewall config, not its URL
--user <value>Username. Sent with the password as basic auth
--password <value>Password
--token <value>Token, sent as a bearer header. When both a token and a username and password are stored, the token is used
--stdinRead user, password, and token as one JSON object from stdin, for scripted rotation

bsfw exec

Put bsfw in front of your install command to send its registry requests through a firewall. When the command finishes, see which versions were blocked, which rules fired, and whether an upstream failed.

Log in with a token that can read the firewall configuration (fw:read) and fetch packages through it (fw:access). Then run the command for your project.

Package managerCommand
npmbsfw npm install
pip with a requirements filebsfw pip install -r requirements.txt
uvbsfw uv sync

The full form is bsfw exec -- <command> [args...]. For example, bsfw exec -- npm install does the same thing as bsfw npm install.

With a shortcut, put bsfw flags after the package manager name. For example, bsfw npm --log install prints the run's log entries after the summary. Use -- to pass a shared flag to the package manager. In bsfw npm -- -v, npm receives -v and prints its version.

Supported package managers

EcosystemExecutables
Cargocargo
npmnpm, npx, yarn, pnpm, pnpx, bun, bunx
NuGetdotnet
PyPIpip, pip3, uv, uvx, poetry
RubyGemsgem, bundle, bundler

For a tool or task the wrapper cannot run, such as a Maven or Gradle build, a Go module download, or a container pull, set up the tool directly and run your usual command. Then use bsfw logs to see the decisions the firewall recorded.

The wrapper routes requests to registry hosts served by the selected firewall and refuses other hosts. If a lockfile points to a download host the firewall does not serve, regenerate it through the firewall.

The wrapper covers only commands run with bsfw. A plain npm install in another terminal goes wherever npm is configured to go. To cover every install, see Enforce firewall use.

Choose a firewall

If you haven't selected a firewall, the wrapper asks you to pick one in the terminal. Use it for this run, save it in your profile, or share it in the repo's .bytesafe.toml. A saved npm choice also works for Yarn, pnpm, and Bun. Run bsfw profile show in the project directory to see what the wrapper will use.

The wrapper checks --fw, then BYTESAFE_FIREWALL, then the project's .bytesafe.toml, then the profile. Within each file, a command entry in exec.commands takes priority over an ecosystem entry in exec.ecosystems. In CI, pass --fw or save a firewall choice before the run.

Save the project's choices in .bytesafe.toml at the repository root. The file holds firewall IDs and an optional namespace. Keep credentials in the CLI credential store or CI secrets.

namespace = "<namespace-id>"

[exec.ecosystems]
npm = "<npm-firewall-id>"
pypi = "<pypi-firewall-id>"

--namespace and BYTESAFE_NAMESPACE take priority over the project's namespace. Use bsfw profile set firewall to set a default for commands such as bsfw logs. Use the wrapper's picker or an exec.ecosystems entry to save a default for installs.

Read the result

In this bsfw npm install run, the rule block the old version filtered out is-number@6.0.0. The project needed that exact version, so npm exited with code 1.

 [BLOCKED] is-number 6.0.0  versions
           block the old version

 1 blocked  ·  1 allowed, logged by a rule  ·  npm exited 1

The exit code tells you whether the install succeeded. In this bsfw uv sync run, the firewall filtered out requests@2.20.0, and uv installed 2.31.0.

 [BLOCKED] requests 2.20.0  versions
           block the old version

 1 blocked  ·  2 allowed, logged by a rule  ·  uv exited 0

The wrapper returns the package manager's exit code. Its report covers log entries for that run. An install that uses cached packages can produce no new entries.

FlagDescription
--fw <id>Use this firewall for the command
--logPrint the run's log entries below the summary
--wideShow the Detail column with --log
--nocacheUse a temporary client cache to see fresh requests. With Cargo and RubyGems, this can also change where the client puts installed files
-v, --verboseShow which firewall and interaction ID the run used

To look up a run later, use its namespace, firewall, and interaction ID. Pass -v to see those values even when the run produces no entries.

bsfw logs --namespace "<namespace-id>" --firewall "<firewall-id>" \
  --all-users --interaction-id "<interaction-id>"

For scripts that parse the log, query it separately with bsfw logs -o json. A wrapped command can write its own output to the same stream as the wrapper's report.

bsfw logs

Read logged rule decisions and upstream errors. Results are newest first.

Without --user or --all-users, the server returns only the calling user's own entries, which is why a first run often looks empty. A Service Access Token belongs to no user, so a CI token sees nothing unless --all-users is given.

bsfw logs --firewall <firewall-id>
bsfw logs --all-users --blocked --since 24h
bsfw logs --all-users --status error --since 24h
bsfw logs --all-users --interaction-id "$CI_JOB_ID"
bsfw logs --all-users --follow --wide
bsfw logs --all-users --follow -o ndjson
FlagDescription
--firewall <id>Only this firewall. Falls back to the profile default when omitted
--user <value>Filter by Bytesafe user ID or the user identity reported by a company proxy. Mutually exclusive with --all-users
--all-usersEveryone's requests, not just your own
--blockedOnly requests the firewall stopped. Start here when someone reports a failed install
--phase versions|download|uploadOnly one execution phase: versions is the metadata request that lists versions, download is fetching one artifact, upload is a publish
--status blocked|allowed|errorOnly one outcome: blocked for requests a rule stopped, allowed for requests a rule or exception let through, error for upstream failures such as rate limiting or rejected credentials. The three are exclusive, and an upstream failure outranks a block
--search <text>Free-text match across user, ecosystem, package name, version, message, and interaction ID. Use the package name reported in the install error
--interaction-id <id>Only entries carrying this interaction ID, exact match, so build-12 does not also return build-123. Not to be confused with the global --interaction flag, which tags your own requests
--since <value>Entries newer than a duration or a point in time. See Dates and durations
--limit <n>Entries to return; default 100. Asking for more than one server page pages through automatically
-f, --followKeep the connection open and print entries as they arrive, reconnecting if the stream drops
-w, --wideAdd the Detail column to the table for rule and error details when available

--follow starts from the server's short backfill and then prints new entries, so --since and --limit do not apply to it. Filters and output format do.

The Outcome column shows ALLOWED, BLOCKED, or ERROR. Rule identifies the matched rule, the exception, or the upstream that failed. The table shows names when available and uses IDs otherwise. Your own entries show you in the User column. For upstream errors, see Check for failing upstreams.

The default table is a compact view. Use -o json for the complete response, -o ndjson for one complete entry per line (the form to pipe into jq while following), or -o logfmt for the legacy single-line form.

bsfw package

Known vulnerability and malware findings for one exact package version: the same data the firewall's rules evaluate. Use it to explain a block, or to check a dependency before adding it.

bsfw package <ecosystem> <name> <version>

Ecosystem is one of npm, pypi, maven, nuget, go, cargo, composer, conda, or rubygems. The name is written the way that ecosystem writes it, and the version must be exact: no ranges, no dist-tags.

bsfw package npm lodash 4.17.21
bsfw package npm @scope/name 1.2.3
bsfw package maven org.apache.commons:commons-lang3 3.14.0 -o json

The Severity column shows each advisory's severity and score, such as HIGH (7.5). An advisory nobody has scored shows UNKNOWN (?): it is not treated as critical, and it crosses no vulnerabilities rule threshold. An absent malware result is reported as unknown, not clean.

bsfw observations

The inventory view: which package versions your builds actually pulled through the firewall in a period, how often each was requested, and how many known vulnerabilities each carries today. Derived from traffic, not from manifests.

bsfw observations --period 30d --firewall <firewall-id>
bsfw observations --new-risks
bsfw observations --ecosystem npm -o json
FlagDescription
--period today|7d|30d|90dHow far back to look by last-seen time. Default 7d
--firewall <id>Only this firewall. Falls back to the profile default when omitted
--ecosystem <name>Only rows from one ecosystem, such as npm or oci. Filtered by the server, so every page holds only that ecosystem
--search <text>Filter by package name
--sort <column>Sort by lastSeen, firstSeen, count, packageName, version, ecosystem, or firewall. Prefix with - for descending order. Default -lastSeen
--new-risksShow packages with findings that appeared in the last seven days after the package was served
--page-size <n>Rows per server page; the server's own default applies when unset
--page-token <token>Continue from the previous page. The CLI prints the token to pass when more rows are available

Vulns shows severity counts, such as C2 H1 for two critical and one high. M means moderate, L low, and U unscored. It also marks known malware (MALWARE), known exploited vulnerabilities (KEV), and container images that have yet to be scanned (not scanned).

Monitor shows no for a version outside monitoring, daily when checked daily with no new findings, and new:N when there are new findings. An exclamation mark signals malware, a known exploited vulnerability, or a critical vulnerability. - means the server did not return a monitoring status.

Use -o json for the full response. See the Observations reference for the fields.

bsfw audit

The audit log answers who changed the setup: policy edits, upstream credentials, tokens, teams, and denied attempts. It does not contain package traffic, which is what bsfw logs shows.

Every event records what it acted on as a resource type plus the ID of that one resource, so most reviews start by naming one or both. These are the values --resource-type takes:

Resource typeCovers
firewallConfig imports, rule and exception changes, upstream credentials, firewall deletion
tokenPersonal and Service Access Token creation and deletion
teamTeam creation, updates, and membership changes
namespaceNamespace creation, rename, settings, cloning, deletion
trusted_builderTrusted Builder registration and OIDC exchanges
license_setLicense set changes
webhookWebhook endpoint changes, test deliveries, and secret rotation
sessionSign-ins, including failed ones

--resource-id takes the exact ID the event carries. For a firewall that is the firewall ID from bsfw firewall list, never its display name. For the other types, copy the ID from an event with -o json or from the event detail in the dashboard, then reuse it as a filter.

bsfw audit --resource-type firewall --resource-id <firewall-id>
bsfw audit --outcome failure --from 2026-08-01
bsfw audit --action firewall.config.upsert -o json
FlagDescription
--resource-type <type>What kind of thing was acted on, from the table above
--resource-id <id>Which one, by ID. Combine with --resource-type to scope a review to a single firewall or token
--action <action>One exact action string, for example firewall.rule.upsert or token.delete. Prefixes and wildcards do not match; the full list is the action catalog
--actor <user-id>Who did it, by user ID. bsfw whoami prints your own ID; other users' IDs appear in -o json output and in the dashboard event detail. It is an opaque ID, not an email address
--outcome success|failureWhether the action went through. failure collects permission denials, rejected imports, and failed sign-ins, which is the useful review for spotting misconfigured automation
--from, --toTime bounds, inclusive. See Dates and durations
--limit <n>Events per request, 1 to 1000; default 100
--offset <n>Skip this many events. When more events match than were returned, the table footer prints the --offset value for the next page

The default table shows time, action, outcome, resource, actor, status, and IP. Use -o json for the complete events, including the request path and the action-specific eventData. Field-level detail: Audit log reference.

bsfw oidc exchange

Exchange a GitHub Actions OIDC ID token for a short-lived Service Access Token. With permissions: id-token: write, the CLI fetches the GitHub token automatically. The exchange endpoint does not require an existing access token.

bsfw oidc exchange --audience bytesafe:trusted-builder:<id>
FlagDescription
--audience <value>Trusted Builder audience; defaults to BYTESAFE_TRUSTED_BUILDER_AUDIENCE
--id-token <token>Supply the OIDC token instead of fetching it from GitHub Actions
--format token|jsonPrint only the token or the full response; default token

End-to-end setup: GitHub Actions.

bsfw completion

Generate completion scripts for bash, zsh, fish, or PowerShell. Homebrew installs completions automatically; release archives include generated completion files.

bsfw completion zsh > "${fpath[1]}/_bsfw"
bsfw completion bash > /etc/bash_completion.d/bsfw

bsfw version

Print the installed release, commit, build time, Go version, and platform. Release archives also include generated man pages.

bsfw version -o json

Exit codes

Scripts can branch on these instead of parsing messages.

CodeMeaningUsually means
0Success
1Runtime errorThe server rejected the request, for example an import that failed validation
2Usage errorA misspelled flag or value, a missing argument, or no endpoint, namespace, or firewall configured
3Authentication or authorization failure (401 or 403)Missing, expired, or wrong-namespace token, or a token without the permission the command needs. Run bsfw whoami
4Not found (404)The firewall, namespace, or package version does not exist under that ID. Check with bsfw firewall list
5Network failure or timeoutThe endpoint is unreachable, or the request took longer than --timeout