38a2fea043
Road files in Pensum's strict header subset (unknown keys are errors, random ids), the directory and device snapshots, deny-by-default compilation to one plan per device, explain from the compiler's own grants, CBOR envelope v1 with version-first refusals. Tests: the six mandatory ones (validation fixtures for every rule, revocation, the least-privilege property against an independent oracle, determinism with golden plans, explain, custom round-trip), QA's attack cases, the protocol and the CLI.
126 lines
4.0 KiB
Rust
126 lines
4.0 KiB
Rust
//! Every rule code a [`crate::Problem`] can carry (docs/FORMATS.md). The validation test fails if one of
|
|
//! these has no failing fixture.
|
|
|
|
// Road files
|
|
pub const FILE_KIND: &str = "file.kind";
|
|
pub const FILE_NAME: &str = "file.name";
|
|
pub const FILE_SIZE: &str = "file.size";
|
|
pub const FILE_ENCODING: &str = "file.encoding";
|
|
pub const FILE_HEADER: &str = "file.header";
|
|
pub const FILE_COUNT: &str = "file.count";
|
|
pub const YAML_REFUSED: &str = "yaml.refused";
|
|
pub const YAML_SYNTAX: &str = "yaml.syntax";
|
|
pub const KEY_UNKNOWN: &str = "key.unknown";
|
|
pub const KEY_DUPLICATE: &str = "key.duplicate";
|
|
pub const KEY_MISSING: &str = "key.missing";
|
|
pub const KEY_FORBIDDEN: &str = "key.forbidden";
|
|
pub const KEY_TYPE: &str = "key.type";
|
|
pub const ID_FORMAT: &str = "id.format";
|
|
pub const ID_FILE_NAME: &str = "id.file-name";
|
|
pub const ID_DUPLICATE: &str = "id.duplicate";
|
|
pub const VERB_UNKNOWN: &str = "verb.unknown";
|
|
pub const REF_FORMAT: &str = "ref.format";
|
|
pub const SUBJECT_KIND: &str = "subject.kind";
|
|
pub const SUBJECT_UNKNOWN: &str = "subject.unknown";
|
|
pub const OBJECT_KIND: &str = "object.kind";
|
|
pub const OBJECT_UNKNOWN: &str = "object.unknown";
|
|
pub const OBJECT_NOT_EXIT: &str = "object.not-exit";
|
|
pub const SUBNET_NOT_CANONICAL: &str = "subnet.not-canonical";
|
|
pub const SUBNET_UNROUTED: &str = "subnet.unrouted";
|
|
pub const UNTIL_FORMAT: &str = "until.format";
|
|
pub const CREATED_FORMAT: &str = "created.format";
|
|
pub const PORTS_FORMAT: &str = "ports.format";
|
|
pub const PORTS_NOT_SERVED: &str = "ports.not-served";
|
|
pub const VIA_FORMAT: &str = "via.format";
|
|
pub const VIA_UNKNOWN: &str = "via.unknown";
|
|
pub const VIA_NOT_RELAY: &str = "via.not-relay";
|
|
pub const CLASSIC_FORMAT: &str = "classic.format";
|
|
pub const CLASSIC_UNACKNOWLEDGED: &str = "classic.unacknowledged";
|
|
pub const BODY_RAW_MISSING: &str = "body.raw-missing";
|
|
pub const BODY_RAW_OUTSIDE_CUSTOM: &str = "body.raw-outside-custom";
|
|
pub const BODY_RAW_HOOK: &str = "body.raw-hook";
|
|
|
|
// Inactive roads
|
|
pub const ROAD_EXPIRED: &str = "road.expired";
|
|
pub const ROAD_NO_DEVICES: &str = "road.no-devices";
|
|
pub const ROAD_SELF: &str = "road.self";
|
|
pub const EXIT_CONFLICT: &str = "exit.conflict";
|
|
pub const DIRECT_KILL_SWITCH: &str = "direct.kill-switch";
|
|
|
|
// Snapshots
|
|
pub const SNAPSHOT_JSON: &str = "snapshot.json";
|
|
pub const SNAPSHOT_FORMAT: &str = "snapshot.format";
|
|
pub const DIRECTORY_ID: &str = "directory.id";
|
|
pub const DIRECTORY_DUPLICATE: &str = "directory.duplicate";
|
|
pub const DIRECTORY_NAME: &str = "directory.name";
|
|
pub const DIRECTORY_MEMBER: &str = "directory.member";
|
|
pub const DEVICES_KEY: &str = "devices.key";
|
|
pub const DEVICES_DUPLICATE: &str = "devices.duplicate";
|
|
pub const DEVICES_NAME: &str = "devices.name";
|
|
pub const DEVICES_OWNER: &str = "devices.owner";
|
|
pub const DEVICES_ADDRESS: &str = "devices.address";
|
|
pub const DEVICES_ROUTE: &str = "devices.route";
|
|
pub const DEVICES_OVERLAP: &str = "devices.overlap";
|
|
pub const DEVICES_SERVICE: &str = "devices.service";
|
|
pub const DEVICES_PORTS: &str = "devices.ports";
|
|
|
|
pub const ALL: &[&str] = &[
|
|
FILE_KIND,
|
|
FILE_NAME,
|
|
FILE_SIZE,
|
|
FILE_ENCODING,
|
|
FILE_HEADER,
|
|
FILE_COUNT,
|
|
YAML_REFUSED,
|
|
YAML_SYNTAX,
|
|
KEY_UNKNOWN,
|
|
KEY_DUPLICATE,
|
|
KEY_MISSING,
|
|
KEY_FORBIDDEN,
|
|
KEY_TYPE,
|
|
ID_FORMAT,
|
|
ID_FILE_NAME,
|
|
ID_DUPLICATE,
|
|
VERB_UNKNOWN,
|
|
REF_FORMAT,
|
|
SUBJECT_KIND,
|
|
SUBJECT_UNKNOWN,
|
|
OBJECT_KIND,
|
|
OBJECT_UNKNOWN,
|
|
OBJECT_NOT_EXIT,
|
|
SUBNET_NOT_CANONICAL,
|
|
SUBNET_UNROUTED,
|
|
UNTIL_FORMAT,
|
|
CREATED_FORMAT,
|
|
PORTS_FORMAT,
|
|
PORTS_NOT_SERVED,
|
|
VIA_FORMAT,
|
|
VIA_UNKNOWN,
|
|
VIA_NOT_RELAY,
|
|
CLASSIC_FORMAT,
|
|
CLASSIC_UNACKNOWLEDGED,
|
|
BODY_RAW_MISSING,
|
|
BODY_RAW_OUTSIDE_CUSTOM,
|
|
BODY_RAW_HOOK,
|
|
ROAD_EXPIRED,
|
|
ROAD_NO_DEVICES,
|
|
ROAD_SELF,
|
|
EXIT_CONFLICT,
|
|
DIRECT_KILL_SWITCH,
|
|
SNAPSHOT_JSON,
|
|
SNAPSHOT_FORMAT,
|
|
DIRECTORY_ID,
|
|
DIRECTORY_DUPLICATE,
|
|
DIRECTORY_NAME,
|
|
DIRECTORY_MEMBER,
|
|
DEVICES_KEY,
|
|
DEVICES_DUPLICATE,
|
|
DEVICES_NAME,
|
|
DEVICES_OWNER,
|
|
DEVICES_ADDRESS,
|
|
DEVICES_ROUTE,
|
|
DEVICES_OVERLAP,
|
|
DEVICES_SERVICE,
|
|
DEVICES_PORTS,
|
|
];
|