Added a check for the characters of ERI usernames, tokens, and passwords (#1228)

This commit is contained in:
Thorsten Sommer authored and GitHub committed 2026-11-24 18:47:44 +01:00
1 parent e5a7f5423f
commit 9b4d07552d
16 files changed
+988 -21

No files matched your search

@@ -198,7 +198,7 @@ public partial class DataSourceERI_V1Dialog : MSGComponentBase, ISecretId
Name = this.dataName,
Hostname = cleanedHostname.EndsWith('/') ? cleanedHostname[..^1] : cleanedHostname,
AuthMethod = this.dataAuthMethod,
Username = this.dataUsername,
Username = ERICredentialValidation.Normalize(this.dataUsername),
UsernamePasswordMode = DataSourceERIUsernamePasswordMode.USER_MANAGED,
Type = DataSourceType.ERI_V1,
SecurityPolicy = this.dataSecurityPolicy,
@@ -389,8 +389,11 @@ public partial class DataSourceERI_V1Dialog : MSGComponentBase, ISecretId
var addedDataSource = this.CreateDataSource();
if (!string.IsNullOrWhiteSpace(this.dataSecret))
{
// Store the secret in the OS secure storage:
var storeResponse = await this.RustService.SetSecret(this, this.dataSecret, SecretStoreType.DATA_SOURCE);
//
// Store the secret in the OS secure storage, without the whitespace around it: it goes
// to the ERI server in an HTTP header, which drops that whitespace anyway:
//
var storeResponse = await this.RustService.SetSecret(this, ERICredentialValidation.Normalize(this.dataSecret), SecretStoreType.DATA_SOURCE);
if (!storeResponse.Success)
{
this.dataSecretStorageIssue = string.Format(TA("Failed to store the auth. secret in the operating system. The message was: {0}. Please try again."), storeResponse.Issue);