1

What's the best way to ensure that developers can't modify the contents of the appspec.yml file used by AWS CodeDeploy? This file executes scripts on production servers with root privileges so it would be ideal if there were a way to ensure the files can't be modified by anyone with access to the application repository.

Please note that I'm looking for technical suggestions.

Please also note I'm using CodeDeploy as part of CodePipeline with GitHub as source.

1
  • Could you indicate whether you solved the issue?
    – 030
    Commented Dec 23, 2019 at 8:33

2 Answers 2

2

The way I handled this in the past was to have a separate repository that contains the scripts, as most of them ended up shared across multiple projects anyway. Then your appspec.yml file just contains references to the scripts and imports them via a submodule. It's not perfect because a developer could change the appspec.yml to call his own scripts instead, although that's a lot more obvious.

Another approach I have used on Azure is to require that scripts are signed with a specific GPG key. I used a PowerShell and a CodeSigning certificate, but I suspect there is an equally suitable solution with GPG.

A final approach would be to automatically fail the build or reject the commit if changes are detected within appspec.yml except when those changes are made by an "approved" person.

1

You could store this file in a Version Control System (VCS) like CodeCommit and ensure that the developers can only merge it when a pull request has been approved by you.

1
  • Do you mean merge with the main application repo? The problem is this is part of a CodePipeline that executes on push to the application repository. Are you suggesting having a post commit hook that pulls in the appspec.yml file from a different repo? I'd have to check but this might break the execution of the pipeline
    – Nelfo
    Commented Oct 9, 2019 at 18:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.