-
Notifications
You must be signed in to change notification settings - Fork 228
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for obfuscated id or alternate entity id (#3261)
* Support use of an alternate entity identifier not the primary key * Add id obfuscation * Adjust counts * Add test for BytesEncryptorIdObfuscator
- Loading branch information
1 parent
22387ac
commit 8643a2f
Showing
34 changed files
with
1,304 additions
and
35 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
elide-core/src/main/java/com/yahoo/elide/annotation/EntityId.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright 2024, the original author or authors. | ||
* Licensed under the Apache License, Version 2.0 | ||
* See LICENSE file in project root for terms. | ||
*/ | ||
package com.yahoo.elide.annotation; | ||
|
||
import static java.lang.annotation.ElementType.FIELD; | ||
import static java.lang.annotation.ElementType.METHOD; | ||
import static java.lang.annotation.RetentionPolicy.RUNTIME; | ||
|
||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.Target; | ||
|
||
/** | ||
* Indicates the field or property that represents the identity of the entity. | ||
* <p> | ||
* This is intended to be used if the primary key undesirably leaks information | ||
* about the record and to designate another field or property as the entity | ||
* identifier. | ||
* <p> | ||
* Another option instead of using another field or column as the entity | ||
* identifier is to obfuscate the id directly. | ||
* <p> | ||
* The following are some things to consider when choosing the entity id. | ||
* <ul> | ||
* <li>Opaque token</li> | ||
* <li>Cryptographically secure</li> | ||
* <li>Implementation only based on Randomness</li> | ||
* <li>Predictability of the ID</li> | ||
* <li>Leaks the count of items</li> | ||
* <li>Leaks information about the machine/process</li> | ||
* <li>Leaks the date of creation</li> | ||
* </ul> | ||
*/ | ||
@Target({ METHOD, FIELD }) | ||
@Retention(RUNTIME) | ||
public @interface EntityId { | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.