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

dynamic schema attribute support #71

Open
tomtau opened this issue Sep 25, 2024 · 2 comments
Open

dynamic schema attribute support #71

tomtau opened this issue Sep 25, 2024 · 2 comments

Comments

@tomtau
Copy link
Collaborator

tomtau commented Sep 25, 2024

We'd like to be able to add a dynamic "catch-all-other-attributes" field in a data struct, e.g.:

#[derive(
    Debug,
    Clone,
    PartialEq,
    Eq,
    Searchable,
    Encryptable,
    Decryptable,
    Hash,
    PartialOrd,
)]
#[cipherstash(sort_key_prefix = None)]
pub struct Data {
      #[cipherstash(plaintext)]
      pub(crate) plain: String,
      pub(crate) protected: String,
      pub(crate) other_data: BTreeMap<String, String>,
}

where other_data contains all other attributes (the key is the attribute name, the value is the corresponding protected attribute value).
Encryptable and Decryptable traits cannot be currently derived for BTreeMap. If we try to implement them manually we'll hit two issues:

  1. fn protected_attributes is static
  2. a way to list these other attributes in fn from_unsealed : I guess one could use unsealed.protected() and exclude the statically known attributes?
@auxesis
Copy link
Contributor

auxesis commented Sep 26, 2024

Thanks for reporting this @tomtau.

We think this is feasible, and will get back to you shortly with a rough timeline.

@tomtau
Copy link
Collaborator Author

tomtau commented Sep 27, 2024

@auxesis maybe one alternative for this, possibly safer, could be if Cipherstash supported nested DDB map, so it could just be one static attribute other_data (of type map), and the values inside that map would be protected.

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

No branches or pull requests

2 participants