Greenmask 0.3.0
Changes
- feat:
directory,s3,azureandsshstorages now come from the greenmaskio/storages library. The S3 storage runs onaws-sdk-go-v2, because support foraws-sdk-gov1 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.keyorSTORAGE_ENCRYPTION_KEY,dumpencrypts 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-dumpsanddeleteneed no key: the dump'sheartbeatstays plain, andlist-dumpsgets anENCRYPTEDcolumn. See Client-side encryption #580 - feat: new
ssh.private_key_passphrasekey for encrypted private keys, andssh.connect_timeoutto limit the TCP connection and the SSH handshake (default30s). See ssh storage #549 - feat: new
azure.max_retrieskey, the number of retries after a failed try (default3) #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 whenaccess_key_idandsecret_access_keywere also set, andsession_namewas required #549 - fix:
Hash,ReplaceandRegexpReplacewithapply_for_references: trueare 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_referencesnow 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_referencesset 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-onlyanddata-only: trueindump.pg_dump_optionsnow work. Before, the dump failed withoptions -s/--schema-only and -a/--data-only cannot be used together. In this modepg_dumpnow selects no table, so it locks none.--data-onlytogether with--schema-onlyor--cleanis rejected before the dump starts #581. Closes #104 - fix:
restorewithexit-on-error: falsenow exits with code 1 when it ignored an error, aspg_restoredoes. 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:
restorenow warns when scripts configured for a section skipped by--data-only,--schema-onlyor--sectionwould not run, instead of dropping them silently #577. Closes #575 - fix:
--lock-wait-timeoutnow passes its own value topg_dump. Before,pg_dumpgot the value of--compressinstead #562. Closes #561 - fix: the
pg_dump:andpg_restore:debug lines hide a--dbnameconnection string as***, so its password no longer reaches the log. A plain database name is logged as before #566 - fix: Masking with
type: teland themaskingtemplate 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 --diffnow deletes its temporary directory after the run #549 - fix:
validatein 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.
restoreandshow-dumpwith a dump ID that leaves the storage, such as../x, report that the dump is not found #549 - fix: the help of
dump --exclude-schemasaid the opposite of what the flag does #576 - change: the text tables of
list-dumps,list-transformers,show-transformerandvalidateare printed with go-pretty.validateheaders show the real column names, and colors are printed only to a terminal:NO_COLORturns them off,FORCE_COLORforces 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_sslis deprecated. It never had an effect: puthttp://inendpointto 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. Ifrole_arnis set withoutaccess_key_idandsecret_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 withAWS_SDK_LOAD_CONFIG=1. Aregionset in the Greenmask config takes precedence. - S3 endpoint and retries. An
endpointwithout a scheme is still used ashttps://<endpoint>, andmax_retriesstill 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
30sby default. Raisessh.connect_timeoutfor 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=1andtls10server=1are 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_FILEandSSL_CERT_DIRnow 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-dumpsanddeletein 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 bydelete --prune-failedin 0.2.x, like a failed plain one. - Restore exit code. A restore with
exit-on-error: falsethat 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.
Maskingwithtype: telgives 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-transformerorvalidatemay need changes: borders, wrapping andvalidateheaders differ. Use the JSON output where it exists. - Interrupted uploads. The
directoryandsshstorages 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 affectlist-dumpsorrestore, anddeleteremoves 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: