Skip to content

chore: System settings key can be rotated#4085

Merged
Rockyy174 merged 5 commits into
operately:mainfrom
Rockyy174:keys-rotation
Jan 27, 2026
Merged

chore: System settings key can be rotated#4085
Rockyy174 merged 5 commits into
operately:mainfrom
Rockyy174:keys-rotation

Conversation

@Rockyy174
Copy link
Copy Markdown
Collaborator

No description provided.

Signed-off-by: Adriano Lazzaretti <lazzaretti136@gmail.com>
Signed-off-by: Adriano Lazzaretti <lazzaretti136@gmail.com>
Signed-off-by: Adriano Lazzaretti <lazzaretti136@gmail.com>
Signed-off-by: Adriano Lazzaretti <lazzaretti136@gmail.com>
Signed-off-by: Adriano Lazzaretti <lazzaretti136@gmail.com>
Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • In encryption_base_secrets/0, only the first element is checked for nil, so a list like ["k1", nil] will pass and later blow up in KeyGenerator.generate/4; consider validating that all keys are non-nil (e.g., Enum.any?(keys, &is_nil/1) and raising early).
  • The decrypt/1 implementation using Enum.reduce_while/3 ignores the accumulator and always starts with {:error, :invalid}; using Enum.find_value/2 or a small recursive helper would make the intent clearer and avoid the dummy accumulator value.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `encryption_base_secrets/0`, only the first element is checked for `nil`, so a list like `["k1", nil]` will pass and later blow up in `KeyGenerator.generate/4`; consider validating that *all* keys are non-nil (e.g., `Enum.any?(keys, &is_nil/1)` and raising early).
- The `decrypt/1` implementation using `Enum.reduce_while/3` ignores the accumulator and always starts with `{:error, :invalid}`; using `Enum.find_value/2` or a small recursive helper would make the intent clearer and avoid the dummy accumulator value.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@Rockyy174 Rockyy174 merged commit d7ac9f6 into operately:main Jan 27, 2026
3 checks passed
@Rockyy174 Rockyy174 deleted the keys-rotation branch January 27, 2026 20:58
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.

1 participant