feat(dynamic-labels): add allow-list mode to the AWS dynamic labels policy - #5411
Open
atsikham wants to merge 2 commits into
Open
feat(dynamic-labels): add allow-list mode to the AWS dynamic labels policy#5411atsikham wants to merge 2 commits into
atsikham wants to merge 2 commits into
Conversation
atsikham
force-pushed
the
feat/dynamic-labels-allowed-keys
branch
2 times, most recently
from
September 11, 2026 05:55
106462a to
692cf97
Compare
Contributor
|
@atsikham The project requires signed your commits. Please sign so we can merge :) |
…olicy blocked_keys/restricted_keys are a deny-list: any key not named there is allowed by default, so a new EC2 override key added upstream (or one simply left off the list) is allowed until someone notices and blocks it. Add allowed_keys to AwsDynamicLabelsPolicy: when set (non-empty), any dynamic label key not listed there is rejected, denying everything by default except the keys named. blocked_keys and restricted_keys keep working exactly as before; when allowed_keys is unset or empty, behavior is unchanged. allowed_keys and blocked_keys are mutually exclusive per policy - Terraform validation rejects configuring both in every place this policy can be set (the root module's aws_dynamic_labels_policy, modules/webhook's runner_matcher_config configured directly, and both the v1 and v2 shapes of modules/multi-runner's multi_runner_config), and the evaluator fails closed (rejects every dynamic label) if a policy with both somehow reaches the dispatcher some other way (e.g. a hand-edited SSM parameter). modules/webhook's runner_matcher_config now types awsDynamicLabelsPolicy as a proper nested object instead of any, matching the pattern already used in modules/multi-runner's v2 shape (review feedback on PR github-aws-runners#5411).
atsikham
force-pushed
the
feat/dynamic-labels-allowed-keys
branch
from
September 12, 2026 11:06
692cf97 to
af089e1
Compare
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.
Fixes #5412
Summary
aws_dynamic_labels_policy(the guardrail forghr-ec2-*dynamic labels) only supports a blocklist:blocked_keysrejects specific keys,restricted_keyslimits the values a specific key can have, and any key not on either list is allowed. This means a new EC2 override key GitHub adds later — or one that was simply left off the list — stays allowed until someone notices and blocks it. There was no way to set up a strict "nothing except these specific keys" policy without listing every single key to forbid.Changes
allowed_keys?: string[]toAwsDynamicLabelsPolicy. When set (not empty), any key not on that list is rejected — deny by default instead of allow by default. When it's unset or empty, nothing changes from today.blocked_keysandrestricted_keyskeep working exactly as before, on their own.allowed_keysandblocked_keysmean opposite things, so only one should be used per policy at a time:plan/applyif both are set — checked everywhere this policy can be configured: the root module'saws_dynamic_labels_policy,modules/webhook'srunner_matcher_config(used when configuring the webhook module directly), and both the old and new shapes ofmodules/multi-runner'smulti_runner_config.docs/configuration.md) updated with an example for the allow-list next to the existing blocklist example, the new check order, and a note on why the allow-list closes a real gap the blocklist has — a blocklist can't protect against a future key that doesn't exist yet; an allow-list can.Test plan
yarn test— new cases indynamic-labels-policy.test.ts: unset/emptyallowed_keyschanges nothing, a key outside a non-emptyallowed_keysis rejected,allowed_keysworks together withrestricted_keys, and the reject-everything behavior when bothallowed_keys/blocked_keysare set. Fullcompute-providers(308 tests) andwebhook(83 tests) suites pass.yarn lint/yarn format/tsc --noEmitterraform fmt -check/terraform validateon the root module,modules/webhook(standalone), andmodules/multi-runner(standalone)