github GreenmaskIO/greenmask v0.3.0

one hour ago

Greenmask 0.3.0

Changes

  • feat: directory, s3, azure and ssh storages now come from the greenmaskio/storages library. The S3 storage runs on aws-sdk-go-v2, because support for aws-sdk-go v1 ended on 2025-07-31 #549
  • feat: PostgreSQL 19 is supported and tested by the integration suite. The dump format of PostgreSQL 19 is the same as in PostgreSQL 18 (archive version 1.16). The Docker image includes the PostgreSQL 19 client. See Supporting a New PostgreSQL Version #579 #590
  • feat: client-side encryption of dumps. With a key in storage.encryption.key or STORAGE_ENCRYPTION_KEY, dump encrypts the objects of the dump on the host before they reach the storage. Plain and encrypted dumps can share one storage, and plain dumps are read as before with any encryption config. list-dumps and delete need no key: the dump's heartbeat stays plain, and list-dumps gets an ENCRYPTED column. See Client-side encryption #580
  • feat: new ssh.private_key_passphrase key for encrypted private keys, and ssh.connect_timeout to limit the TCP connection and the SSH handshake (default 30s). See ssh storage #549
  • feat: new azure.max_retries key, the number of retries after a failed try (default 3) #549
  • fix: with s3.role_arn, Greenmask now works under the assumed role and renews its credentials before they expire. Before, the role was applied only when access_key_id and secret_access_key were also set, and session_name was required #549
  • fix: Hash, Replace and RegexpReplace with apply_for_references: true are now applied to the referencing foreign-key columns. Before, the config passed validation, but the transformer was applied only to the primary key, and the referencing columns were dumped unchanged #572. Closes #571
  • fix: apply_for_references now reaches every table that references a transformed column, at any depth. Before, below the first level a table got the transformer only when its foreign key was part of its own primary key, so the foreign key of the last table in a chain was dumped unchanged #572
  • fix: a transformer with apply_for_references set by hand on a table in the middle of a chain is no longer applied twice to the tables below it #572
  • fix: dump --data-only and data-only: true in dump.pg_dump_options now work. Before, the dump failed with options -s/--schema-only and -a/--data-only cannot be used together. In this mode pg_dump now selects no table, so it locks none. --data-only together with --schema-only or --clean is rejected before the dump starts #581. Closes #104
  • fix: restore with exit-on-error: false now exits with code 1 when it ignored an error, as pg_restore does. Before, it exited with 0. Each ignored error is logged as a warning when it happens and again as an error at the end #568. Closes #567
  • fix: restore now warns when scripts configured for a section skipped by --data-only, --schema-only or --section would not run, instead of dropping them silently #577. Closes #575
  • fix: --lock-wait-timeout now passes its own value to pg_dump. Before, pg_dump got the value of --compress instead #562. Closes #561
  • fix: the pg_dump: and pg_restore: debug lines hide a --dbname connection string as ***, so its password no longer reaches the log. A plain database name is logged as before #566
  • fix: Masking with type: tel and the masking template function with "tel" mask the last 4 characters of a number of any length. Before, a number that was not 8 or 10 characters long, such as +1 (415) 555-2671, was left unmasked #574. Closes #573
  • fix: validate --diff now deletes its temporary directory after the run #549
  • fix: validate in the vertical format wrote to standard output instead of the given writer, and in the horizontal format cut multi-byte words and dropped runs of spaces, so values that differ only in spaces looked equal in --diff #550
  • fix: storage keys are checked before use. restore and show-dump with a dump ID that leaves the storage, such as ../x, report that the dump is not found #549
  • fix: the help of dump --exclude-schema said the opposite of what the flag does #576
  • change: the text tables of list-dumps, list-transformers, show-transformer and validate are printed with go-pretty. validate headers show the real column names, and colors are printed only to a terminal: NO_COLOR turns them off, FORCE_COLOR forces them. JSON output is unchanged #550
  • change: PostgreSQL 13 and 14 are no longer supported and are dropped from the integration tests, because their upstream support has ended. Greenmask will most likely keep working with them, and the Docker image still includes their clients, but they are untested. See Supporting a New PostgreSQL Version
  • docs: s3.disable_ssl is deprecated. It never had an effect: put http:// in endpoint to use plain HTTP #549
  • chore: Greenmask is built with Go 1.27.4 #569
  • chore: greenmaskio/storages is updated to v0.5.1, with a newer AWS SDK for the S3 storage #569
  • chore: update Go dependencies, including pgx 5.13.0 #560 #578 #589

Upgrade notes

The dump format and the storage layout have not changed. Dumps made by 0.2.x can be listed, restored and deleted by 0.3.0, and the other way round, so rolling back to 0.2.27 is safe, as long as no dump was made with client-side encryption.

  • S3 with role_arn. If role_arn is set without access_key_id and secret_access_key, 0.2.x assumed the role but kept using the default credentials. 0.3.0 uses the role, so the role itself needs access to the bucket. The role is assumed with the default AWS credential chain on the first storage request, so a wrong or untrusted role fails there, not at startup.
  • S3 shared config. The AWS SDK now always reads ~/.aws/config, including the region and the credentials of the active profile. Before, it read the file only with AWS_SDK_LOAD_CONFIG=1. A region set in the Greenmask config takes precedence.
  • S3 endpoint and retries. An endpoint without a scheme is still used as https://<endpoint>, and max_retries still counts retries after the first attempt.
  • Logs. Debug output of the AWS and Azure SDKs and the wording of some storage errors have changed. Messages about invalid storage config are the same.
  • SSH. The connection now times out after 30s by default. Raise ssh.connect_timeout for hosts that are slower to connect.
  • Go 1.27. The macOS binaries need macOS 13 Ventura or later. The legacy TLS settings GODEBUG=tlsrsakex=1, tls3des=1 and tls10server=1 are gone, so a PostgreSQL server or an S3-compatible storage that offers only RSA key exchange or 3DES can no longer be reached. On macOS and Windows, SSL_CERT_FILE and SSL_CERT_DIR now replace the system certificate store for TLS connections that rely on it, such as the S3 and Azure storages.
  • Encrypted dumps and 0.2.x. Only 0.3.0 and later read an encrypted dump. 0.2.x fails to restore it, and list-dumps and delete in 0.2.x skip a finished encrypted dump with a warning, so 0.2.x never deletes it. A failed encrypted dump is still pruned by delete --prune-failed in 0.2.x, like a failed plain one.
  • Restore exit code. A restore with exit-on-error: false that ignored errors now exits with code 1. A CI job or script that ran such a restore and checked the exit code now sees it fail.
  • Masking of phone numbers. Masking with type: tel gives a different value for numbers that are not 8 or 10 characters long, because they are masked now.
  • CLI tables. Scripts that parse the text output of list-dumps, list-transformers, show-transformer or validate may need changes: borders, wrapping and validate headers differ. Use the JSON output where it exists.
  • Interrupted uploads. The directory and ssh storages write each file under a temporary .copy-* name and rename it when done. A dump killed in the middle can leave such a file in its directory. It does not affect list-dumps or restore, and delete removes it with the dump.

Full Changelog: v0.2.27...v0.3.0

Contributors

@Huyvux12
@tudorcebere
@vamsibvv
@wwoytenko

Links

Feel free to reach out to us if you have any questions or need assistance:

Don't miss a new greenmask release

NewReleases is sending notifications on new releases.