Skip to main content

Filters and expiry

Keep only the rows you want in a list with --filter, and set when a resource expires with --expiry.

--filter​

--filter takes a CEL expression over the columns of the list (see -c). The columns keep their types:

TypeColumns
TextThe other columns: name, username, uri, role…
Booleandeleted, expired, personal, active, disabled
Numberuser_count
Timestampcreated_timestamp, modified_timestamp, expired_at
Mapmetadata, secret
  • Several --filter are ANDed.
  • A filter that matches nothing is an error: no such resources found with filter ….
  • A filter reading password, description or secret decrypts the secrets.

Examples​

Match a name, then check the URI​

passbolt list resource --filter '(name == "GitHub" || matches(name, "^AWS")) && uri.startsWith("https://")'

List the administrators created since a date​

passbolt list user --filter 'role == "admin" && created_timestamp > timestamp("2024-01-01T00:00:00Z")'

List the resources whose secret has a field​

passbolt list resource --filter '"Account" in secret' -c name

List the groups with more than two members​

passbolt list group --filter 'user_count > 2'

Field conditions​

--filter also takes field conditions. They compare text, case-insensitively:

OperatorMeaningExample
field=valueExact match--filter "role=admin"
field~=valueContains--filter "name~=github"
field^=valueStarts with--filter "username^=john"
field$=valueEnds with--filter "uri$=.com"
field!=valueNot equal--filter "username!=admin"

How the CLI tells them apart:

  • A text that is valid CEL is read as CEL: name != "x" is CEL, name!=x a field condition.
  • The first operator written splits a field condition: uri=https://a/?x!=y is uri equal to https://a/?x!=y.
  • A field condition reading note also decrypts the secrets.

Expiry dates​

--expiry sets when a resource expires, for create resource and update resource:

ValueMeaning
"2025-12-31T00:00:00Z"Absolute date (RFC3339), sent in UTC.
"90d", "2w", "1w2d3h"From now, in weeks, days, hours, minutes, seconds.
"1.5h", "300ms", "2h45m30.5s"From now, as a Go duration.
"-1h"In the past: already expired.
"none" or ""Remove the expiry.

Examples​

Create a resource that expires in a week​

passbolt create resource --name "Temp token" --expiry "7d"

Remove the expiry​

passbolt update resource --id <UUID> --expiry "none"

Mark a resource as expired​

passbolt update resource --id <UUID> --expiry=-1h
note

A negative value needs the = form: --expiry=-1h.

  • Output: columns, tables and JSON.
  • Resources: list resource, create resource, update resource.
  • Rotation guide: find what to rotate and set a new expiry.