File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed
src/main/java/com/aws/greengrass/lifecyclemanager Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,7 @@ public class KernelCommandLine {
6464 private static final String deploymentsPathName = "~root/deployments" ;
6565 private static final String cliIpcInfoPathName = "~root/cli_ipc_info" ;
6666 private static final String binPathName = "~root/bin" ;
67+ private static final String validUserCharExpr = "^[a-zA-Z0-9._]+[a-zA-Z0-9._-]*$" ;
6768
6869 public KernelCommandLine (Kernel kernel ) {
6970 this (kernel , kernel .getNucleusPaths ());
@@ -158,6 +159,10 @@ void updateDeviceConfiguration(DeviceConfiguration deviceConfiguration) {
158159 }
159160 if (defaultUserFromCmdLine != null ) {
160161 if (PlatformResolver .isWindows ) {
162+ if (!defaultUserFromCmdLine .matches (validUserCharExpr )) {
163+ logger .warn ("Component user may contain invalid characters. This can cause issues starting a "
164+ + "component." );
165+ }
161166 deviceConfiguration .getRunWithDefaultWindowsUser ().withValue (defaultUserFromCmdLine );
162167 } else {
163168 deviceConfiguration .getRunWithDefaultPosixUser ().withValue (defaultUserFromCmdLine );
You can’t perform that action at this time.
0 commit comments