You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Dynamic labels policy has no allow-list mode, only deny-list #5412
aws_dynamic_labels_policy (the guardrail for ghr-ec2-* dynamic labels) only supports a blocklist: blocked_keys rejects specific keys, restricted_keys limits the values a specific key can have, and any key not on either list is allowed.
This means: if GitHub adds a new EC2 override key later, or a key is simply left off the list, that key stays allowed until someone notices and blocks it. There is no way to set up a strict "nothing except these specific keys" policy without listing every single key to forbid — an open-ended, easy-to-miss list.
Impact
An allow-list (deny by default) is the safer choice here, because dynamic labels let workflow authors set arbitrary EC2 launch settings (instance type, AMI, subnet, EBS volume size) — see the security warning already in docs/configuration.md. Right now, any new EC2 override key GitHub adds in the future is allowed by default for every deployment using this policy, until someone notices and adds it to blocked_keys.
Proposed fix
Add allowed_keys to AwsDynamicLabelsPolicy: when set (not empty), only the keys listed there are allowed — everything else is rejected. blocked_keys/restricted_keys keep working exactly as before when allowed_keys is not set. Since allowed_keys and blocked_keys mean opposite things (allow-only vs. block-only), only one of them should be used at a time in the same policy — checked by Terraform at config time, and also checked at runtime (rejecting everything) if a policy with both somehow still reaches the code.
Activity
feat(dynamic-labels): add allow-list mode to the AWS dynamic labels p…