Skip to content

Behavior Settings

dotsecenv provides granular behavior settings that control how the tool handles various edge cases and error conditions. These settings replace the previous all-or-nothing strict: true flag with fine-grained controls.

Behavior settings are configured in your ~/.config/dotsecenv/config.yaml file under the behavior section:

behavior:
require_explicit_vault_upgrade: false
restrict_to_configured_vaults: false

Controls whether vault format upgrades happen automatically or require explicit user action.

ValueBehavior
false (default)Vaults are automatically upgraded to the latest format with a notice
trueWarns about outdated format but doesn’t modify; requires dotsecenv vault upgrade

Use case: Set to true in shared environments where you want to coordinate vault upgrades across team members.

behavior:
require_explicit_vault_upgrade: true

When enabled, you’ll see:

Terminal window
dotsecenv: warning: vault "/path/to/vault" uses format v1, upgrade to v2 recommended
dotsecenv: run 'dotsecenv vault upgrade' to upgrade the vault format

Controls whether CLI -v flags can override vaults specified in the configuration file.

ValueBehavior
false (default)CLI -v flags can specify different vaults than config
trueCLI -v flags are ignored; only config vaults are used

Use case: Set to true to prevent accidental use of wrong vaults in production.

behavior:
restrict_to_configured_vaults: true

Several behaviors that were previously controlled by strict: true now have sensible defaults that cannot be changed:

BehaviorDefaultRationale
Flag conflicts (--last -v)Always errorConflicting flags should fail early
Secret fallbackAlways allowed with warningSupports multi-user private values
Identity already existsAlways warn + skipFingerprints are unique
Identity auto-addAlways warn + auto-addConvenient default
Revoke unknown identityAlways warn + proceedRevoke should complete
Decrypt errorsAlways warn + try othersBest-effort recovery

When a user requests a secret but cannot access the latest value (e.g., their access was revoked), dotsecenv will:

  1. Attempt to decrypt older values that the user can still access
  2. Print a warning: warning: returning older value for 'SECRET_NAME' (access to latest value is revoked)
  3. Return the most recent accessible value

This allows multi-user scenarios where each user maintains their own private values.

The GPG program path is now configured explicitly:

gpg:
program: PATH # Infer from system PATH (recommended)
# OR
program: /usr/bin/gpg # Absolute path to specific binary

If you currently use strict: true, here’s how to migrate:

# Old configuration
strict: true

The strict: true shorthand still works during the deprecation period and is equivalent to setting both behavior flags to true.

You can use strict: true with individual overrides:

strict: true
behavior:
require_explicit_vault_upgrade: false # Override: allow auto-upgrades
approved_algorithms:
- algo: RSA
min_bits: 2048
vault:
- ~/.local/share/dotsecenv/vault
gpg:
program: PATH
# behavior section omitted - all defaults (permissive)
approved_algorithms:
- algo: ECC
curves: [P-384, P-521]
min_bits: 384
vault:
- /secure/path/to/vault
behavior:
restrict_to_configured_vaults: true
gpg:
program: /usr/bin/gpg
approved_algorithms:
- algo: RSA
min_bits: 4096
vault:
- ~/projects/myapp/.dotsecenv/vault
behavior:
require_explicit_vault_upgrade: true # Coordinate upgrades
gpg:
program: PATH