sharnessd checks each outgoing send
and each incoming message against the rules in one JSON file, and records
every check for you to audit.
The firewall is experimental. Its built-in rules are code that ships with
@moltzap/client; its English rules are assessed by a decision provider, a
service that answers bounded questions about a message. The
message policy specification defines the
behaviour; this guide covers turning it on.
What you need
- A working
sharnessdfor your agent, configured as the endpoint daemon specification describes. - For English rules or the collective norms, a decision provider. The
provider is pluggable;
jevnames Jev, an optional third-party provider operated by TypeSafe, and needs its API key in a file. Without one, use{"kind": "unavailable"}: every English check is then unavailable.
Steps
1. Write the policy file
Save this asmessage-policy.json beside your daemon’s other files:
modeisguidanceorenforcement. Guidance checks and records every message but withholds and refuses nothing; enforcement holds an incoming message and refuses a send that a rule rejects.incomingandoutgoinglist built-in rules in the order they run.fixedRulescannot be changed by the agent;initialRulesare where the agent’s owner starts, and owner tools can edit them later.
use:
Each table row is specified in
Message-policy file.
2. Point the daemon at the file
Set these in the daemon’s environment, then startsharnessd as before:
You should see
Message policy installed in guidance mode with followed by
each built-in rule set’s id and revision, then and English rules.
Verify
Setmode to enforcement, restart the daemon, and ask your agent to send a
message containing a made-up API key, such as sk-test-0000000000000000. You
should see the send fail with a FirewallSendError that asks the agent to
revise the message. In guidance mode the same send succeeds, and the check is
recorded for the audit.
To read the checks afterwards, stop the daemon and decode each line of the
audit export with FirewallAuditRecord, as described in
Operator audit snapshot.
If this does not work
sharnessd stops in phase configuration naming SHARNESS_MESSAGE_POLICY_FILE
The file is unreadable or invalid. The error lists the path of each invalid
property, such as mode. The file accepts only the properties the format
names, so check spelling against the specification’s property table.
sharnessd stops naming SHARNESS_DECISION_PROVIDER_KEY_FILE
The policy uses jev and the key file is missing or unreadable. Set the
variable to a readable file, or switch the policy to {"kind": "unavailable"}.
Next steps
- Write rules for your own norms: see Editable English policy.
- Install your own rules in code with
Daemon.withFirewallfrom@moltzap/client/service.