Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement process for migrating keys and algorithms #3435

Merged
merged 5 commits into from
May 29, 2024
Merged

Conversation

dmjb
Copy link
Contributor

@dmjb dmjb commented May 27, 2024

Fixes #3315

Implement CLI command which is used to migrate keys and algorithms. This will:

  1. Open connection to the DB
  2. Query for secrets which do not have the default key ID or algorithm 3) Decrypts and re-encrypts with new data
  3. Wraps all the above in a transaction which asks permission before
    commiting

State secrets in the session state table are deleted. Since they are short-lived secrets, there is no point in migrating them.

Tested locally.

Summary

Provide a brief overview of the changes and the issue being addressed.
Explain the rationale and any background necessary for understanding the changes.
List dependencies required by this change, if any.

Fixes #(related issue)

Change Type

Mark the type of change your PR introduces:

  • Bug fix (resolves an issue without affecting existing features)
  • Feature (adds new functionality without breaking changes)
  • Breaking change (may impact existing functionalities or require documentation updates)
  • Documentation (updates or additions to documentation)
  • Refactoring or test improvements (no bug fixes or new functionality)

Testing

Outline how the changes were tested, including steps to reproduce and any relevant configurations.
Attach screenshots if helpful.

Review Checklist:

  • Reviewed my own code for quality and clarity.
  • Added comments to complex or tricky code sections.
  • Updated any affected documentation.
  • Included tests that validate the fix or feature.
  • Checked that related changes are merged.

@dmjb dmjb requested a review from a team as a code owner May 27, 2024 11:40
Copy link
Contributor

@blkt blkt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just left a couple of non-blocking suggestions.

cmd/server/app/encryption_rotate.go Outdated Show resolved Hide resolved
cmd/server/app/encryption_rotate.go Outdated Show resolved Hide resolved
@coveralls
Copy link

coveralls commented May 28, 2024

Coverage Status

coverage: 52.021%. remained the same
when pulling 909bfad on key-rotate-command
into ad16d48 on main.

dmjb added 4 commits May 29, 2024 12:53
Fixes #3315

Implement CLI command which is used to migrate keys and algorithms. This
will:

1) Open connection to the DB
2) Query for secrets which do not have the default key ID or algorithm
3) Decrypts and re-encrypts with new data
4) Wraps all the above in a transaction which asks permission before
   commiting

State secrets in the session state table are deleted. Since they are
short-lived secrets, there is no point in migrating them.

Tested locally.
Copy link
Contributor

@blkt blkt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the split, thanks @dmjb

@dmjb dmjb merged commit d67a405 into main May 29, 2024
20 checks passed
@dmjb dmjb deleted the key-rotate-command branch May 29, 2024 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migrate encrypted data in database to new encryption structure
3 participants