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

Remove algorithm from crypto config #3467

Merged
merged 1 commit into from
May 31, 2024
Merged

Remove algorithm from crypto config #3467

merged 1 commit into from
May 31, 2024

Conversation

dmjb
Copy link
Contributor

@dmjb dmjb commented May 30, 2024

Relates to #3315

Previously, it was possible to set a default and fallback algorithm in the crypto config. This seemed like a good idea at the time but I came to realize the following:

  1. Unlike the key, the algorithm is not an external piece of data - it
    corresponds to something implemented in the codebase. We cannot
    introduce new algorithms without changing the code.
  2. After pairing on a key rotation with Ozz, I realized that the
    relationship between the key ID and the algorithm in the config is
    not really intuitive, and is likely to cause confusion which could
    result in us breaking our ability to decrypt secrets.

This PR removes the algorithm from the config and defines the default vs fallback in the code. As part of this change, the new GCM algorithm becomes the default for everyone, and this required changing some tests to use real encryption keys (the old CFB algorithm would accept arbitrary strings as keys, the GCM cipher expects a base64-encoded 32-byte key).

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.

Relates to #3315

Previously, it was possible to set a default and fallback algorithm.
This seemed like a good idea at the time but I came to realize the
following:

1) Unlike the key, the algorithm is not an external piece of data - it
   corresponds to something implemented in the codebase. We cannot
   introduce new algorithms without changing the code.
2) After pairing on a key rotation with Ozz, I realized that the
   relationship between the key ID and the algorithm in the config is
   not really intuitive, and is likely to cause confusion which could
   result in us breaking our ability to decrypt secrets.

This PR removes the algorithm from the config and defines the default vs
fallback in the code. As part of this change, the new GCM algorithm
becomes the default for everyone, and this required changing some tests
to use real encryption keys (the old CFB algorithm would accept
arbitrary strings as keys, the GCM cipher expects a base64-encoded
32-byte key).
@dmjb dmjb requested a review from a team as a code owner May 30, 2024 15:40
@coveralls
Copy link

Coverage Status

coverage: 52.299% (-0.08%) from 52.376%
when pulling 62a4ef5 on algorithm-not-configurable
into 16e3ca0 on main.

Copy link
Contributor

@jhrozek jhrozek left a comment

Choose a reason for hiding this comment

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

I think not letting users set the algorithms is a good idea in general.

@dmjb dmjb merged commit cee34f8 into main May 31, 2024
26 of 28 checks passed
@dmjb dmjb deleted the algorithm-not-configurable branch May 31, 2024 06:45
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.

4 participants