BytesafeDependency Firewall

CLI

Reference for the bsfw command line tool. Commands, flags, and environment variables.

bsfw is the Bytesafe Dependency Firewall CLI. It talks to the same management API as the dashboard: list firewalls, rules, and exceptions, query and stream logs, export and import configuration, and exchange OpenID Connect (OIDC) tokens in CI.

Creating firewalls, rules, and exceptions

Creating and changing firewalls, rules, and exceptions from the CLI is done with config import: export the configuration as JSON, edit it, import it back. Importing a new firewall ID creates the firewall. There are no dedicated create commands; firewalls, rules, and exceptions are read-only. Interactive creation lives in the dashboard.

Environment variables

VariableDescription
BYTESAFE_ENDPOINTBase URL of the firewall service
BYTESAFE_NAMESPACENamespace ID to operate in (the value in the URL path, not the display name)
BYTESAFE_TOKENAccess token. Required by all commands except oidc exchange
BYTESAFE_INTERACTIONInteraction ID appended to the token for log correlation
BYTESAFE_TRUSTED_BUILDER_AUDIENCEDefault audience for oidc exchange

BYTESAFE_NAMESPACE and every --firewall <firewall-id> take IDs, not the display names you typed when creating them: the namespace ID from the URL path, the firewall ID from the firewall list or its Setup tab. Passing the display name does not resolve.

Global flags

FlagDescription
--interaction <id>Interaction ID for log correlation. Overrides BYTESAFE_INTERACTION

The interaction ID is an opaque string of your choice, recorded on every log entry the request produces. Use it to tag requests with whatever dimension you want to correlate on later: a CI pipeline run (build-4711), an application or project (checkout-service), an environment (staging), or a combination (checkout-service/staging/build-4711). The firewall does not interpret the value; it only stores it for filtering and grouping in the logs. See Access Tokens for how the ID travels with the token.

List commands accept --format table|json. Default is table.

Commands

bsfw firewalls

List firewalls in the namespace. Read-only; create a firewall with config import.

bsfw firewalls
bsfw firewalls --format json

bsfw rules

List rules for a firewall. Read-only; create or change rules by editing the rules array via config import.

bsfw rules --firewall <firewall-id>
FlagRequiredDescription
--firewall <firewall-id>yesFirewall ID
--format table|jsonnoOutput format

bsfw exceptions

List exceptions for a firewall. Read-only; create or change exceptions by editing the exceptions array via config import.

bsfw exceptions --firewall <firewall-id>

Same flags as rules.

bsfw logs

Query or stream firewall logs.

bsfw logs --firewall <firewall-id>
bsfw logs --firewall <firewall-id> --tail
bsfw logs --all-users
FlagDescription
--tailStream new entries continuously
--firewall <firewall-id>Filter to one firewall
--user <id>Filter to a specific user
--all-usersEntries for all users. Mutually exclusive with --user

Without a user filter, you see your own entries.

bsfw config export

Export the full firewall configuration, including rules and exceptions, as JSON to stdout.

bsfw config export --firewall <firewall-id> > firewall-config.json

Exported configuration is the basis for config-as-code workflows: keep the JSON in git, edit, and import.

bsfw config import

Import a firewall configuration from JSON. This is an upsert of the full config, and the CLI's create and update path:

  • Create a firewall. Import a config with a firewall ID that does not exist yet. Requires the fw:create permission. A practical starting point is exporting an existing firewall and changing the id.
  • Create or change rules and exceptions. Export the config, edit the rules or exceptions arrays, and import it back.
  • Credentials never travel through import. Exports contain placeholders, and imports reject plaintext credential values. A placeholder preserves an existing target's stored value; under a new firewall ID or upstream it resolves to empty. Set credentials separately with config credentials.
bsfw config import --file firewall-config.json
bsfw config import < firewall-config.json
FlagDescription
--file <path>Read from a file instead of stdin

The config JSON must contain the firewall id. A typical edit round trip:

bsfw config export --firewall <firewall-id> > firewall-config.json
# edit firewall-config.json: add a rule, add an exception, change upstreams
bsfw config import --file firewall-config.json

bsfw config credentials

Set credentials for an upstream. Credentials are not part of exports, so this is how you provide them after an import.

bsfw config credentials --firewall <firewall-id> --upstream <upstream-id>
FlagDescription
--firewall <firewall-id>Firewall ID
--file <path>Read the firewall ID from a config JSON file instead
--upstream <upstream-id>Upstream ID

bsfw oidc exchange

Exchange a GitHub Actions OpenID Connect (OIDC) ID token for a short-lived Service Access Token (sat-). Inside GitHub Actions with permissions: id-token: write, the ID token is fetched automatically for the configured Trusted Builder audience. The exchange endpoint is unauthenticated, so BYTESAFE_TOKEN is not required.

bsfw oidc exchange --audience bytesafe:trusted-builder:<id>
FlagDescription
--audience <aud>Trusted Builder audience, bytesafe:trusted-builder:<id>. Defaults to BYTESAFE_TRUSTED_BUILDER_AUDIENCE
--id-token <token>Provide the OIDC ID token yourself, outside GitHub Actions
--format token|jsontoken prints the token to stdout; json prints the full exchange response

End-to-end setup, including Trusted Builder registration: GitHub Actions.

On this page