Skip to content

Encrypt/Decrypt adapterconfig fields automatically for Intergation tests #671

@Apollon77

Description

@Apollon77

When changing adapter configuration (harness.changeAdapterConfig()) in integration tests for the adapter in test the fields defined in the adapter object ("system.adapter.${adapterName}.0") in "encryptedNative" should be automatically encrypted (and decrypted when adapter config is read).

Additionally the hardness should offer encrypt and decrypt methods for potential manual usage by the developer in tests.

For encryption:

  • Read the object "system.config"
  • use "obj.native.secret" as the secret
  • Apply the following encryption logic with the Password as value:
let result = '';
for (var i = 0; i < value.length; ++i) {
    result += String.fromCharCode(secret[i % key.length].charCodeAt(0) ^ value.charCodeAt(i));
}

The result is the encrypted value.

For decryption:

  • determine the secret as above and apply the same logic (because ORed this works)

When the test harness encrypts or decrypts field it should log a ling with the affected fields so that it is transparent.
Add a changelog entry in the changelog and mark it as breaking change because potential manual code that encrypts data might break now.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions