aws / aws-codedeploy-agent

Host Agent for AWS CodeDeploy
https://aws.amazon.com/codedeploy
Apache License 2.0
328 stars 188 forks source link

[Feature Request]Appspec.yml validation #369

Open t0shiii opened 1 year ago

t0shiii commented 1 year ago

There is a gap where the appspec.yml can be a valid yaml but incorrectly formatted which can cause the Ruby interpreter to crash.

An example is the permissions section:

permissions:
  - object: /tmp/my-app
    pattern: "*-3.txt"
    owner: adm
    group: wheel
    mode: 464
    type:
      - file

where type is expecting an array. If a str is given

type: file

this will crash the agent with a message similar to the following:

put_host_command_complete(command_status:"Failed",diagnostics:{format:"JSON",payload:"{\"error_code\":5,\"script_name\":\"\",\"message\":\"undefined method `each' for \\\"file\\\":String\",\"log