File tree Expand file tree Collapse file tree
kura/org.eclipse.kura.container.provider/src/main/java/org/eclipse/kura/container/provider Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -418,15 +418,17 @@ private void createTemporaryIdentityIfEnabled(final ContainerInstanceOptions opt
418418 final Set <Permission > permissions = options .getContainerPermissions ().stream ().map (Permission ::new )
419419 .collect (Collectors .toSet ());
420420
421- // Generate password
422- final String password = new String ( PasswordGenerator
423- .generatePassword (passwordStrengthVerificationService .getPasswordStrengthRequirements ())) ;
421+ // Generate password as char[] to minimize exposure
422+ final char [] password = PasswordGenerator
423+ .generatePassword (passwordStrengthVerificationService .getPasswordStrengthRequirements ());
424424
425- final String identityName = createTemporaryIdentityWithValidName (options , permissions , password );
425+ final String identityName = createTemporaryIdentityWithValidName (options , permissions ,
426+ new String (password ));
426427
427- // Store identity name and password for env injection (fresh char[] from same string)
428+ // Store identity name and a copy of the password for env injection
428429 ContainerInstance .this .currentTemporaryIdentityName .set (identityName );
429- ContainerInstance .this .currentTemporaryPassword .set (password .toCharArray ());
430+ ContainerInstance .this .currentTemporaryPassword .set (Arrays .copyOf (password , password .length ));
431+ Arrays .fill (password , '\0' );
430432
431433 logger .info ("Created temporary identity {} for container {} with {} permissions" , identityName ,
432434 options .getContainerName (), permissions .size ());
You can’t perform that action at this time.
0 commit comments