aws / containers-roadmap

This is the public roadmap for AWS container services (ECS, ECR, Fargate, and EKS).
https://aws.amazon.com/about-aws/whats-new/containers/
Other
5.21k stars 320 forks source link

ECS console should not allow variable names with spaces, especially at the end #2364

Open AstroTom opened 4 months ago

AstroTom commented 4 months ago

Community Note

Tell us about your request In the task definition for ECS, the console allows the creation of variable names with spaces in them. Although the AWS documentation is not clear about this, variable names generally do not allow spaces, as in the shell.

For example entering 'a b c' in th console generates:

            "environment": [
                {
                    "name": "a b c",
                    "value": "foo"

Even worse, if a user uses copy-and-paste to enter a name, there will usually (in Windows) be an extra space at the end. This generates a variable name with a space at the end that is very hard to detect in the console without looking at the generated JSON.

"environment": [
                {
                    "name": "Variable ",
                    "value": "value "
                }
            ],

Which service(s) is this request for? I have tested this in ECS. There could be similar issues with EKS.

Tell us about the problem you're trying to solve. What are you trying to do, and why is it hard? If an extra space is serendipitously added to the end of a variable in the console, it is stored as part of the variable name in the task definition, which is certainly not what the user intended. e.g. "Variable " instead of "Variable".

This kind of mistake is also very hard for a user to diagnose because looking at the console does not reveal whether an extra space is present.

This could easily be fixed by AWS by either always filtering out extra spaces, since they are generally not allowed in variable names, or just reporting an error in the console for invalid values.

Actually, now that I am testing I see the console also allows all kinds of illegal characters in the name:

               {
                    "name": " !@#$%^&*()=;zz ",
                    "value": "very bad"
                }
pallymore commented 4 months ago

Hello - thanks for reaching out.

We've made some improvements in the ECS Console to alert customers about whitespaces and equal signs = in environment variables. For now, the form will not prevent customers from submitting with names including non-alphabetical characters, because the rules for environment variables can vary a lot between operating systems. (for example, the rules for naming env vars in Windows is generally much looser than Linux). Please give it a go and let us know if the changes can help catch issues early.

The improvement is available in all regions.

CleanShot 2024-06-13 at 09 28 26

Thanks! Yurui

AstroTom commented 3 months ago

Thanks Yurui! It's great to see such responsiveness from AWS! I tried it out and I do see the warning. (It is not as pretty using the default light browser). In addition to the warning, I see it now does strip out the whitespace at the end of the line. Which, I think is fine, but not what the warning says.

pallymore commented 3 months ago

Hi @AstroTom - thanks for the response. I can see the warning is not very obvious in light mode - I will relay this feedback to Cloudscape team.

I think we can suppress the warning when whitespaces are only found before and after the key - since they will be trimmed anyways. The warning still applies when whitespaces are found in the middle.

CleanShot 2024-07-11 at 09 17 59@2x