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

Release: v0.2 #97

Merged
merged 76 commits into from
May 12, 2024
Merged

Release: v0.2 #97

merged 76 commits into from
May 12, 2024

Conversation

wwoytenko
Copy link
Contributor

@wwoytenko wwoytenko commented May 6, 2024

Pull request description

This PR contains changes in the greenmask core. This is a base of the next major version v0.2. The changes in this PR are a result of the 5 months of continuous development and close connection with greenmask users.

Changes overview

  • Introduced dynamic parameters in the transformers
    • All transformers (where required) have been moved to the dynamic parameters support
    • The dynamic parameters are strict, but If you need to cast the value to another type greenmask provides two template and pre-defined cast functions that can be provided via cast_to. The cast_to functions represented the most on the frequent cast operations such as UnixTimestampToDate, IntToBool, etc
  • The transformation logic is significantly refactored. Transformers are more customizable and flexible than before
  • Introduced transformation engines
    • random - generates the transformer value based on pseudo-random
    • hash - generates the transformer value based on hash functions. For now, it is sha3 hash functions that have low performance but are secure. In the stable release, it is expected to have the option to choose between sha3 and SipHash

Notable changes

Core

  • Introduced Parametrizer interface and it has been implemented for dynamic and static parameters
  • Renamed most of the toolkit types now they are clear and covered with docs
  • Refactired Driver initialization logic
  • Added validation warnings for Driver for overridden types
  • Migrated already implemented built-in transformers to the new rails with Parametrizer interface
  • Implemented new abstraction TransformationContext that is a first step towards new feature transformation conditions Feature: conditional transform #34
  • Most of the transformers have been optimized for working in dynamic and static mode. While the dynamic mode is flexible the static mode remains performant. By using only the required transformation features the transformation time is predictable.

Transformers

  • Email - a new transformer that supports both random and deterministic engines. Generate email value in a flexible way. You can use the column values in the template for the generation of the email. At the same time, you have the option to keep the original domain or use any domain from the domains parameter.
  • NoiseDate, NoiseFloat, NoiseInt - Supports random and deterministic engines. Provides parameters with dynamic mode support that can control threshold values in the min and max range. The old implementations have only one ratio parameter and the noise can be generated between the values [0, ratio]. In a new release we reviewed that logic and introduced two parameters min_ratio and max_ratio where the noise value will be in the range [min_ratio, max_ratio]. By applying the hash engine in Noise* transformers we can complicate statistical analysis for the attacker when the same salt is used for the backups over a long period of time.
  • NoiseNumeric - implemented a new transformer that supports the same features as in the NoiseInt and NoiseFloat but is implemented to work only with numeric (huge int or float values). Since a Numeric value can be with a fraction the parameter precision is introduced.
  • RandomChoice - added hash engine support
  • RandomDate, RandomFloat, RandomInt - added hash engine support. The threshold parameters min and max now supports dynamic mode.
  • RandomInt - implemented a new transformer that supports the same features as in the RandomInt and RandomFloat but is implemented to work only with numeric (huge int or float values).
  • RandomString - added hash engine mode support
  • RandomUnixTimestamp - implemented a new transformer that generates Unix Timestamp with units sec, milli, micro, nano. The logic is similar to RandomDate. The transformer supports the hash engine and dynamic parameters for the min and max thresholds. The units for min and max parameters can be overridden by min_unit and max_unit parameters.
  • RandomUuid - added hash engine support
  • RandomPerson - implemented a new transformer instead of RandomName, RandomLastName, * RandomFirstName, RandomFirstNameMale, RandomFirstNameFemale, RandomTitileMale and RandomTitileFemale. This new transformer represents the same but highly customizable features that the previous versions. The transformer generates Personal data such as FirstName, LastName, and Title based on the provided gender parameter. The gender parameter supports dynamic mode. In the next minor versions, we will provide the possibility to override the default names database.
  • Added tsModify template function
  • Most of the static parameters support the template as a value. You can generate the parameter value using a template, for instance min: '{{ now | tsModify "-30 years" | .EncodeValue }}' # 1994

wwoytenko and others added 30 commits January 10, 2024 22:27
* Implemented Parameterizer interface and the frame for static and dynamic parameter
* Renamed Parameter object attributes into clear naming way: LinkParameter - > LinkColumnParameter
* Added DynamicModeSupport setting for Parameter object
* Added validation warnings for Driver
* Implemented type overriding initialization inside Driver
* Refactored logic of allowed type validation now it is not relying on initialized driver data
* Added chain of inherited types with their name for custom types
* Moved column type overriding to Column object itself
* Implemented type checking helpers
* Added dynamic parameter tests
* Renamed old Parameter to ParameterDefinition
* Renamed old Definition to TransformerDefinition
* Fixed Driver instancing in the tests
* Added dynamic parameters test
* Refactored parameters init function
* fixed error message now it looks clear
* first try to set up greenmask on new rails
* Fixed parameter validation
* Introduced TransformerContext that united parameters that were passed to transformer during initialization procedure and initialized transformer
* Updated RandomDate transformer implementation, adapted to the dynamic parametrization
* Fixed static and dynamic parameters initialization
* Deprecated value-parameters methods in ParameterDefinition
* renamed InitParametersV2 to InitParameters
* renamed parameter.go to parameter_definition.go
* Clean up code from deprecated attributes and methods in that were in ParameterDefinition
* Fixed unit tests
* Added attribute documentation for StaticParameter and DynamicParameter
* Adapted 3 transformers for dynamic parameters usage:
  * RandomDate
  * RandomInt
  * RandomFloat
* Implemented cast template logic
* Implemented default logic behaviour
* Changed Parametrizer interface
* Implemented common function for scanning static objects
* Moved a few files from internal to toolkit
* Added to timeToUnix and unixToTime functions
* Implemented template context object that allows to get the value or raw value for dynamic parameter and Encode/Decode it into destination type
* Introduced TypeCaster for casting original value to dest type
* Implemented cast functions
* Fixed cast_to implementation
* Removed auto cast for now. It might be implemented later
Moved artifacts
Fixed timeToUnix and unixToTime tests
FloatToInt cast fix
@wwoytenko wwoytenko self-assigned this May 6, 2024
@wwoytenko wwoytenko marked this pull request as draft May 6, 2024 19:19
@wwoytenko wwoytenko changed the title Release/v0.2rc Feat: Transformation core refactoring for v0.2 May 6, 2024
@wwoytenko wwoytenko linked an issue May 6, 2024 that may be closed by this pull request
9 tasks
@wwoytenko wwoytenko added this to the v0.2 milestone May 6, 2024
@wwoytenko wwoytenko changed the title Feat: Transformation core refactoring for v0.2 Release: v0.2 May 8, 2024
@wwoytenko wwoytenko marked this pull request as ready for review May 12, 2024 11:56
@wwoytenko wwoytenko merged commit eb92581 into main May 12, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Epic: V0.2b release
1 participant