Repository navigation
Restrict the CodeDeploy on-premises config file on Windows - #10892
Open
nathan-inge wants to merge 1 commit into
Open
nathan-inge wants to merge 1 commit into
nathan-inge wants to merge 1 commit into
Conversation
luigi617
approved these changes
Nov 12, 2026
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #10892 +/- ##
============================================
- Coverage 93.42% 44.61% -48.82%
============================================
Files 211 301 +90
Lines 17312 36797 +19485
============================================
+ Hits 16174 16417 +243
- Misses 1138 20380 +19242 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of changes
AWS CLI v1 counterpart of #10891. Same change; only the tests are adapted to this branch.
On Windows,
aws deploy installwrites the on-premises instance configuration file toC:\ProgramData\Amazon\CodeDeploy\conf.onpremises.yml. The0o600mode used when the file is written only applies on POSIX: on Windows,os.openandos.chmoddon't set ACLs, so the file inherits its ACL from its directory.This change creates the file on Windows with its own access control list, so its permissions don't depend on the directory:
Add
Windows.create_config_file(), which creates the file withCreateFileW(CREATE_NEW)and a security descriptor with a protected DACL (D:P(A;;FA;;;SY)(A;;FA;;;BA)), granting full control only to LocalSystem and Administrators. Nothing is inherited from the directory.An existing file is deleted and recreated rather than truncated, so it doesn't keep its previous ACL. This also applies when
--config-fileis the installed path; the contents are read first.CREATE_NEWfails if the file reappears between the delete and the create. If the file can't be replaced or created,installstops with a clear error before writing the config.The file is opened without sharing while it's written, and
os.chmodis skipped for it on Windows.Linux behavior is unchanged.
Differences from the v2 change
test_install.pyuses this branch's import style.instead of the return code. It still checks that nothing is written and the agent isn't installed.Behavior changes
installfails and asks the user to close it.--override-configand--config-fileset to the installed path, Windows now rewrites the file (same contents) instead of leaving it untouched.Testing
tests/unit/customizations/codedeployon Linux (Python 3.12): 139 passed, 3 skipped (the elevated-Windows tests).windows-latestCI job.rufffindings in the changed files.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.