feat(security): encrypt game and player names with env-based key - #2743
Closed
Adarshkumar0509 wants to merge 14 commits into
Closed
feat(security): encrypt game and player names with env-based key#2743Adarshkumar0509 wants to merge 14 commits into
Adarshkumar0509 wants to merge 14 commits into
Conversation
…OWASP#2232 Signed-off-by: Adarsh Kumar <adarshkumarthakur0509@gmail.com>
Adarshkumar0509
requested review from
cw-owasp,
rewtd and
sydseter
as code owners
March 27, 2026 20:16
Signed-off-by: Adarsh Kumar <adarshkumarthakur0509@gmail.com>
Signed-off-by: Adarsh Kumar <adarshkumarthakur0509@gmail.com>
Signed-off-by: Adarsh Kumar <adarshkumarthakur0509@gmail.com>
Adarshkumar0509
marked this pull request as draft
March 27, 2026 20:48
Signed-off-by: Adarsh Kumar <adarshkumarthakur0509@gmail.com>
Signed-off-by: Adarsh Kumar <adarshkumarthakur0509@gmail.com>
Signed-off-by: Adarsh Kumar <adarshkumarthakur0509@gmail.com>
Signed-off-by: Adarsh Kumar <adarshkumarthakur0509@gmail.com>
Signed-off-by: Adarsh Kumar <adarshkumarthakur0509@gmail.com>
Signed-off-by: Adarsh Kumar <adarshkumarthakur0509@gmail.com>
Signed-off-by: Adarsh Kumar <adarshkumarthakur0509@gmail.com>
Signed-off-by: Adarsh Kumar <adarshkumarthakur0509@gmail.com>
Adarshkumar0509
marked this pull request as ready for review
March 28, 2026 10:25
Collaborator
Author
|
@sydseter please check this out ,Happy to make any changes you suggest. |
Collaborator
|
@Adarshkumar0509 That won't work, we will need to migrate the data and encrypt it in order to be able to load existing player names. Otherwise you get a mismatch between the strings that is saved in the database and the new binary type. |
Collaborator
Author
|
Ok sir I will be working on this |
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements field-level encryption for game.name and player.name as requested in #2232.
Uses Cloak and Cloak.Ecto for AES-256-GCM authenticated encryption. The vault
is configured via the COPI_ENCRYPTION_KEY environment variable in production.
A deterministic test key is configured in test.exs so CI runs without any
additional setup.
The database migration converts the name columns from varchar to binary.
Existing plaintext data is preserved during migration and remains readable
until re-encrypted on next write.
Tested locally with PostgreSQL — 13 tests passing.
Resolved or fixed issue: #2232
###Ai disclosure
Used AI to assist with implementation. The logic, integration with the existing schema and application layer, and all verification were done manually including running migrations and tests locally. No AI-generated noise or unnecessary comments are present in the code. All code are manually written.