Skip to main content

Audit Logging

Yopass can emit a structured audit log recording every security-relevant event — secret creation, access, deletion, and authentication — without ever logging encrypted content. The log is designed for compliance requirements such as SOC 2, ISO 27001, and GDPR data-access accountability.

Requires a valid license. Audit logging is a premium feature gated behind --license-key.


Enabling audit logging​

yopass-server \
--license-key "your-license-key" \
--audit-log

By default, audit records are written to stdout as NDJSON (one JSON object per line), separate from the regular application log. To write to a dedicated file instead:

yopass-server \
--license-key "your-license-key" \
--audit-log \
--audit-log-file /var/log/yopass/audit.log

Flags​

FlagEnv varDefaultDescription
--audit-logAUDIT_LOGfalseEnable audit logging (requires valid license)
--audit-log-fileAUDIT_LOG_FILE—Write audit log to this file path. When unset, records go to stdout.

Log format​

Each event is a single JSON object terminated by a newline (NDJSON). Fields are only emitted when they are relevant to the event — optional fields are omitted rather than set to null or empty.

Fields​

FieldTypeAlways presentDescription
timestampstring (RFC3339Nano, UTC)yesWhen the event occurred
eventstringyesEvent type (see Events)
outcomestringyessuccess, failure, or denied
client_ipstringyesReal client IP, respecting --trusted-proxies
secret_idstringnoFirst 12 hexadecimal characters of the SHA-256 hash of the secret or file ID
user_emailstringnoAuthenticated user's email (OIDC sessions only)
user_subjectstringnoAuthenticated user's OIDC subject claim
one_timeboolnoWhether the secret was configured for one-time access
expiration_secondsnumbernoTTL in seconds at creation time
require_authboolnoWhether the secret requires OIDC authentication to access
restrictedboolnoWhether the secret is restricted to a named recipient. The address itself is never logged; user_email names who opened or was refused
access_methodstringnoHow the viewer of a restricted secret proved their identity: oidc or email_code
errorstringnoHuman-readable reason for failure or denied outcomes

Privacy note: Encrypted secret content is never written to the audit log — only a hashed ID and metadata are recorded.

Example records​

Successful secret creation:

{"timestamp":"2026-04-09T12:00:01.123456789Z","event":"secret.created","outcome":"success","client_ip":"203.0.113.42","secret_id":"3a128f193823","one_time":true,"expiration_seconds":3600,"require_auth":false,"user_email":"[email protected]","user_subject":"auth0|abc123"}

Access denied (unauthenticated):

{"timestamp":"2026-04-09T12:01:00.000000001Z","event":"secret.accessed","outcome":"denied","client_ip":"198.51.100.7","secret_id":"3a128f193823","require_auth":true,"error":"authentication required"}

Successful login:

{"timestamp":"2026-04-09T12:00:00.500000000Z","event":"auth.callback_success","outcome":"success","client_ip":"203.0.113.42","user_email":"[email protected]","user_subject":"auth0|abc123"}

Events​

Secret events​

EventTriggered byOutcomes
secret.createdPOST /create/secretsuccess, failure, denied
secret.accessedGET /secret/{key}success, failure, denied
secret.deletedDELETE /secret/{key}success, failure, denied
secret.status_checkedGET /secret/{key}/status (the one-time warning page)success, failure, denied (with --require-auth-all)
secret.receipt_checkedGET /secret/{key}/receipt (see Read Receipts)success, failure, denied
secret.code_requestedPOST /secret/{key}/code: a visitor asked for an emailed code. failure when no code was sent, with the reason, such as not an eligible recipient, too many codes requested or code mail not sentsuccess, failure, denied
secret.code_verifiedPOST /secret/{key}/code/verify accepted a code. user_email is the recipientsuccess
secret.code_failedPOST /secret/{key}/code/verify refused a code: wrong code or no live codefailure, denied

File events​

EventTriggered byOutcomes
file.uploadedPOST /create/filesuccess, failure, denied
file.downloadedGET /file/{key}success, failure, denied
file.deletedDELETE /file/{key}success, failure, denied
file.status_checkedGET /file/{key}/statussuccess, failure, denied (with --require-auth-all)
file.code_requested, file.code_verified, file.code_failedAs the secret.code_* events, for /file/{key}/codeas above
file.cleanup_failedThe download link was revoked or consumed but the stored ciphertext could not be removed (see File Storage)failure

Secret request events​

EventTriggered by
request.createdPOST /request
request.viewedGET /request/{key} (a responder opening the link)
request.fulfilledPOST /request/{key}/secret
request.secret_accessedGET /request/{key}/secret
request.revokedDELETE /request/{key}
request.key_rotatedPUT /request/{key}/key

See Secret Requests for the flow behind these events.

Auth events​

EventTriggered byOutcomes
auth.callback_successOIDC callback (successful login)success
auth.callback_failedOIDC callback (rejected login, including state/code exchange failures)failure, denied
auth.logoutPOST /auth/logoutsuccess, denied

Outcomes:

  • success — operation completed normally
  • failure — operation failed (validation error, database error, not found)
  • denied — operation was refused: missing or insufficient authentication, a wrong token, or a state that no longer allows it (for example fulfilling a request that was already fulfilled), or, with --frontend-url, a state-changing request from any other origin ("error":"cross-origin request")

HTTP access logs​

Regular HTTP access logs are redacted regardless of whether licensed audit logging is enabled. The uri field contains the route template, such as /secret/{key}/status. Only routes with a {key} parameter include secret_id, which contains the same truncated SHA-256 hash used by audit logs. Routes such as /config and /auth/callback omit that field.

Raw identifiers and URL query strings are omitted, including OIDC callback codes and state parameters. Requests that match no API route, including those served by the static-file fallback, log / without the requested filename.

File store errors and cleanup messages in the application log follow the same rule: an identifier inside an S3 request URL or a disk path is replaced with its secret_id hash. The continuation token of a failed S3 list request is removed, because S3-compatible services may derive it from an object key.

Apply equivalent redaction to reverse proxies, API Gateway access logs, and log collectors: application redaction cannot remove URLs recorded by those systems. Existing logs may still contain usable identifiers until the associated secrets expire or are consumed; restrict access and handle those logs under your credential-exposure policy.


Log rotation​

When writing to a file (--audit-log-file), Yopass does not rotate logs itself. Use your platform's standard tooling:

logrotate (/etc/logrotate.d/yopass-audit):

/var/log/yopass/audit.log {
daily
rotate 90
compress
delaycompress
missingok
notifempty
copytruncate
}

The copytruncate directive truncates the file in place so no SIGHUP or file descriptor hand-off is needed.

systemd: leave --audit-log-file unset and let journald capture and rotate stdout. journald drops messages from a service that exceeds its rate limit (RateLimitBurst= within RateLimitIntervalSec=), so raise those limits for high-volume deployments or write to a file instead.


Docker Compose example​

services:
yopass:
image: jhaals/yopass:latest
ports:
- "1337:1337"
environment:
DATABASE: redis
REDIS: redis://valkey:6379/0
LICENSE_KEY: your-license-key
AUDIT_LOG: "true"
AUDIT_LOG_FILE: /var/log/yopass/audit.log
volumes:
- ./logs:/var/log/yopass # must be writable by UID 1000, the user the image runs as
depends_on:
- valkey

valkey:
image: valkey/valkey:8-alpine
command: valkey-server --save "" --appendonly no

To write to stdout (and let your log collector handle it):

environment:
AUDIT_LOG: "true"
# no AUDIT_LOG_FILE — records go to stdout alongside application logs

Tip: When writing to stdout in a containerized environment, have your log shipper select lines containing "event": to separate audit records from regular application log lines.


Combining with OIDC​

Audit logging is most valuable when combined with OpenID Connect. With OIDC configured, every audit record that involves an authenticated session includes user_email and user_subject, giving you a full identity trail for compliance reviews.

yopass-server \
--license-key "your-license-key" \
--audit-log \
--oidc-issuer "https://accounts.google.com" \
--oidc-client-id "123456789-abc.apps.googleusercontent.com" \
--oidc-client-secret "GOCSPX-…" \
--oidc-redirect-url "https://yopass.example.com/auth/callback"

Without OIDC, user_email and user_subject are omitted from all audit records.