<commit_before>= Configuration mecanism

The configuration uses for most entries Microprofile Config. It means it can be passed through system properties,
environment variables (potentially replacing dots by underscores and uppercasing the keys).

If you want to configure a docker image and not a standalone instance we also add Docker secrets and config integration
which will enable you to read configuration from files. Here you can want to customize the configuration of these integration
through system properties (see children parts). Also note that Docker integration provides a `secure:` support to encrypt
values if needed which can be used with Docker integrations or not (it works for system properties too).

== Docker Config

org.talend.sdk.component.docker.secret.config.DockerConfigConfigSource.base:: where to look for configuration, default to `/`.
org.talend.sdk.component.docker.secret.config.DockerConfigConfigSource.prefixes:: which file name prefixes are to take into account, default to nothing which means all but the common UNIx exclusions.

For instance creating a file `/talend.foo.bar` will make available its content under the key `talend.foo.bar`.

== Docker Secrets

org.talend.sdk.component.docker.secret.config.DockerSecretConfigSource:: where to look for secrets, default to `/run/secrets`.

For instance creating a file `/run/secrets/talend.foo.bar` will make available its content under the key `talend.foo.bar`.

== Secure values support

The goal here is to not enter a clear value for a credential (password, secret, token, ...) but a ciphered value.

The mecanism relies on `org.talend.sdk.component.configuration.converter.secured.ConfigurationMain` which will enable you to:

1. create a `master_key` file
2. encrypt a value
3. decrypt a value (for testing purposes)

High level it uses a master password stored obfuscated in a `master_key` file. Then it uses algorithm to cipher the value
and finally it encodes the result in base64 to ensure it can be managed as a plain text and easily passed through all
potential ways you can set a configuration.

IMPORTANT: all the management commands for the secure values support is done through `org.talend.sdk.component:secured-string-converter`
artifact. It can be found with other releases on link:http://repo.maven.apache.org/maven2/org/talend/sdk/component/secured-string-converter[central].

The coming command examples will assume you have the set in your profile the alias:

[source,sh]
----
alias tssc="java -cp secured-string-converter.jar org.talend.sdk.component.configuration.converter.secured.ConfigurationMain"
----

If not just replace `tssc` by the full command.

=== Generate your master

To generate the master key just use the provided main in `org.talend.sdk.component:secured-string-converter` artifact:

[source,sh]
----
tssc --master-key /path/to/my_master_key [secret-value]
----

IMPORTANT: don't forget to set `talend.component.server.configuration.master_key.location` system property on the server
to ensure it uses this master key. Also it is very very important to ensure only the applications needing this key can read it!

=== Encrypt a value

To encrypt a value you can also use the provided main in `org.talend.sdk.component:secured-string-converter` artifact:

[source,sh]
----
tssc --encrypt /path/to/my_master_key my_credential_to_encrypt
----

=== Decrypt a value

To decrypt a value you can also use the provided main in `org.talend.sdk.component:secured-string-converter` artifact:

[source,sh]
----
tssc --decrypt /path/to/my_master_key secure:my_credential_to_encrypt
----
<commit_msg>precision about the used algorithm for ciphering<commit_after>= Configuration mecanism

The configuration uses for most entries Microprofile Config. It means it can be passed through system properties,
environment variables (potentially replacing dots by underscores and uppercasing the keys).

If you want to configure a docker image and not a standalone instance we also add Docker secrets and config integration
which will enable you to read configuration from files. Here you can want to customize the configuration of these integration
through system properties (see children parts). Also note that Docker integration provides a `secure:` support to encrypt
values if needed which can be used with Docker integrations or not (it works for system properties too).

== Docker Config

org.talend.sdk.component.docker.secret.config.DockerConfigConfigSource.base:: where to look for configuration, default to `/`.
org.talend.sdk.component.docker.secret.config.DockerConfigConfigSource.prefixes:: which file name prefixes are to take into account, default to nothing which means all but the common UNIx exclusions.

For instance creating a file `/talend.foo.bar` will make available its content under the key `talend.foo.bar`.

== Docker Secrets

org.talend.sdk.component.docker.secret.config.DockerSecretConfigSource:: where to look for secrets, default to `/run/secrets`.

For instance creating a file `/run/secrets/talend.foo.bar` will make available its content under the key `talend.foo.bar`.

== Secure values support

The goal here is to not enter a clear value for a credential (password, secret, token, ...) but a ciphered value.

The mecanism relies on `org.talend.sdk.component.configuration.converter.secured.ConfigurationMain` which will enable you to:

1. create a `master_key` file
2. encrypt a value
3. decrypt a value (for testing purposes)

High level it uses a master password stored obfuscated in a `master_key` file. Then it uses algorithm `AES/CBC/PKCS5Padding` to cipher the value
and finally it encodes the result in base64 to ensure it can be managed as a plain text and easily passed through all
potential ways you can set a configuration.

IMPORTANT: all the management commands for the secure values support is done through `org.talend.sdk.component:secured-string-converter`
artifact. It can be found with other releases on link:http://repo.maven.apache.org/maven2/org/talend/sdk/component/secured-string-converter[central].

The coming command examples will assume you have the set in your profile the alias:

[source,sh]
----
alias tssc="java -cp secured-string-converter.jar org.talend.sdk.component.configuration.converter.secured.ConfigurationMain"
----

If not just replace `tssc` by the full command.

=== Generate your master

To generate the master key just use the provided main in `org.talend.sdk.component:secured-string-converter` artifact:

[source,sh]
----
tssc --master-key /path/to/my_master_key [secret-value]
----

IMPORTANT: don't forget to set `talend.component.server.configuration.master_key.location` system property on the server
to ensure it uses this master key. Also it is very very important to ensure only the applications needing this key can read it!

=== Encrypt a value

To encrypt a value you can also use the provided main in `org.talend.sdk.component:secured-string-converter` artifact:

[source,sh]
----
tssc --encrypt /path/to/my_master_key my_credential_to_encrypt
----

=== Decrypt a value

To decrypt a value you can also use the provided main in `org.talend.sdk.component:secured-string-converter` artifact:

[source,sh]
----
tssc --decrypt /path/to/my_master_key secure:my_credential_to_encrypt
----

{'fraction_non_alphanumeric': 0.0763107329124348, 'fraction_numerical': 0.001784243755146857, 'mean_word_length': 4.631375579598146, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '144080', 'n_tokens_mistral': 2020, 'n_tokens_neox': 1939, 'n_words': 873}