Commit Graph

19 Commits

Author SHA1 Message Date
Evan
ad613d472a fix(encrypt): fail closed on empty engine value; sync SIP runbook; typed CLI tests
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-13 04:18:19 -07:00
Evan
10c49b61f9 fix(encrypt): fail-closed engine selection + authenticated-first rollback classification
Addresses review feedback on the selectable encryption engine PR. Posture:
authenticated checks gate decisions; unauthenticated paths never silently win.

- Unknown engine name fails closed. An unrecognized
  SQLALCHEMY_ENCRYPTED_FIELD_ENGINE now raises at field-construction (startup)
  instead of silently degrading to unauthenticated AES-CBC. The value is
  normalized (trim/lower/underscores→hyphens) to match the CLI's
  case-insensitive click.Choice, and the offending value is kept out of the
  error message (same clear-text-logging rationale as the CodeQL fix). Absent
  key still defaults to "aes" (no behavior change for existing installs).

- Rollback (GCM→CBC) no longer mis-skips. The "already in target form" fast
  path trusted any successful target decrypt — but unauthenticated CBC can
  coincidentally decrypt a GCM blob, counting it skipped and leaving GCM
  ciphertext that bricks on the next config flip while the run reports success.
  When the target engine is unauthenticated, the value is now first probed
  under any authenticated engine (current + previous key); an authenticated
  decrypt wins. Generalized on "is the target authenticated", not engine names.

- De-dup the redundant previous-key decryptor when prev_key == SECRET_KEY (the
  column's own engine is already decryptors[0]).

- Runbook: add the post-restart re-run step (sweeps secrets written CBC during
  the migration window) and a quiet-window note (multi-worker cutover is not
  zero-downtime).

Tests: flip the unknown-engine test to assert the fail-closed raise (and that
the value isn't leaked); add a normalization test; add the rollback
ordering-invariant test (authenticated probe wins over a forced-spurious CBC
skip); add combined key-rotation + engine-migration coverage at both the
migrator and CLI levels; hoist the function-local AesGcmEngine imports.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-10 14:52:31 -07:00
Evan
0fe86ea0c3 test(encrypt): add CLI coverage for re-encrypt-secrets --engine option
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-05 16:37:26 -07:00
Ville Brofeldt
af4dc3a9aa fix(re-encrypt): handle non-id PKs and make command idempotent (#40079) 2026-05-12 17:59:52 -07:00
Maxime Beauchemin
cb27d5fe8d chore: proper current_app.config proxy usage (#34345)
Co-authored-by: Claude <noreply@anthropic.com>
2025-07-31 19:27:42 -07:00
Jack
7db0589340 fix(thumbnail cache): Enabling force parameter on screenshot/thumbnail cache (#31757)
Co-authored-by: Kamil Gabryjelski <kamil.gabryjelski@gmail.com>
2025-01-31 19:22:31 +01:00
Maxime Beauchemin
2d63722150 chore: set up ruff as a new linter/formatter (#28158) 2024-04-24 17:19:53 -07:00
Maxime Beauchemin
e86d4d3c92 fix(import): only import FORMULA annotations (#26652) 2024-01-19 15:13:18 -08:00
Michael S. Molina
f63e66be01 refactor: Removes the deprecated VERSIONED_EXPORT feature flag (#26347) 2024-01-19 15:21:14 -03:00
John Bodley
07bcfa9b5f chore(command): Organize Commands according to SIP-92 (#25850) 2023-11-22 16:55:54 -03:00
Hugh A. Miles II
b820eb8235 chore: Update pre-commit packages (#23173) 2023-03-13 17:05:13 -06:00
Elizabeth Thompson
4ddf67fc14 chore: move dashboard screenshot standalone logic (#23003) 2023-02-15 14:35:08 -08:00
Ville Brofeldt
a619cb4ea9 chore: upgrade black (#19410) 2022-03-29 20:03:09 +03:00
AAfghahi
c345029fbc chore!: turn on Versioned Export in config.py (#19142)
* turning off versioned export

* deleted two tests that required version export false

* added tests

* test suggestions
2022-03-17 13:32:50 -04:00
cccs-Dustin
2dd64f9a93 fix(import_datasources): --sync flag works correctly (#18046)
* Added code that properly accepts the -s flag on the import-datasources cli command. Also added unit tests for all of the edge cases (with both metrics & columns, with just columns, and with just metrics)

* Files were reformated using the 'pre-commit run --all-files' command

* added '*args: Any' back into v0.py as it did not need to be removed. Removing it might cause headaches for someone trying to work on this particular piece of code in the future

* Fixed the merge conflict as the cli.py was moved to another directory

* Modified my created unit tests to work with the new format of uni tests since the merge

* Modified my created unit tests to work with the new format of uni tests since the merge

* Fixed errors which were encountered while using the unit tests
2022-01-25 15:53:44 +01:00
Beto Dealmeida
9e2bc72fb9 chore: split CLI into multiple files (#18082)
* chore: split CLI into multiple files

* Update tests

* Who fixes the fixtures?

* Add subcommands dynamically

* Rebase
2022-01-19 11:27:16 -08:00
Bogdan
afd2e9f2ca chore: update fixtures scope that are loading data into the analytical db (#17780)
* Update db setup fixture scope

* Load data into db only once

* Update fixture scopes for data loading

* cleanup imports

* try import

* Update scope

* fix cleanup

* Import all fixtures

* Separate data log and metadata creation

* Retain table description

* fix dtype

Co-authored-by: Bogdan Kyryliuk <bogdankyryliuk@dropbox.com>
2021-12-16 16:11:47 -08:00
Étienne Boisseau-Sierra
f0c0ef7048 fix(cli): fail CLI script on failed import/export (#16976)
* Test that failing export or import is done properly

For each CLI entry-point we will modify, we make sure that:

- a failing process exits with a non-0 exit code,
- an error is logged.

Signed-off-by: Étienne Boisseau-Sierra <etienne.boisseau-sierra@unipart.io>

* Exit process with error if export/import failed

Bubble exception up when failing import or export

During a CLI import or export of dashboards, if the process fails, the
exception it caught and a simple message is sent to the logger.
This makes that from a shell point of view, the script was successfull —
cf. #16956.

To prevent this, we want to ensure that the process exits with an error
(i.e., a non-0 exit-code) should the export or import fail mid-flight.

Signed-off-by: Étienne Boisseau-Sierra <etienne.boisseau-sierra@unipart.io>
2021-10-29 08:56:29 +01:00
ofekisr
b5119b8dff refactor(tests): decouple unittests from integration tests (#15473)
* refactor move all tests to be under integration_tests package

* refactor decouple unittests from integration tests - commands

* add unit_tests package

* fix celery_tests.py

* fix wrong FIXTURES_DIR value
2021-07-01 18:03:07 +03:00