Open
fix: support network.allowed-domains as alias for network.allowed#48522
Conversation
- Support `network.allowed-domains` as a silent alias for `network.allowed` in `extractNetworkPermissions`, unioning both lists when both are present - Add `allowed-domains` as a deprecated valid field in the network object JSON schema so it does not fail strict schema validation - Add `getNetworkAllowedDomainsCodemod` codemod to rename `network.allowed-domains` → `network.allowed` (merging with any existing `network.allowed` entries) - Register the codemod in `GetAllCodemods` and update `expectedCodemodOrder` test - Update `.github/aw/network.md` to document the common naming confusion and show the correct `network.allowed` syntax Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
pelikhan
July 28, 2026 04:46
View session
pelikhan
marked this pull request as ready for review
July 28, 2026 04:54
Contributor
There was a problem hiding this comment.
Pull request overview
Adds deprecated network.allowed-domains compatibility and automatic migration to network.allowed.
Changes:
- Accepts and compiles the deprecated alias.
- Adds a
gh aw fixcodemod with tests. - Documents the naming mistake and migration.
Show a summary per file
| File | Description |
|---|---|
pkg/workflow/frontmatter_extraction_security.go |
Unions canonical and deprecated domain lists. |
pkg/parser/schemas/main_workflow_schema.json |
Adds the deprecated schema alias. |
pkg/cli/fix_codemods.go |
Registers the codemod. |
pkg/cli/fix_codemods_test.go |
Updates expected codemod ordering. |
pkg/cli/codemod_network_allowed_domains.go |
Implements migration and merging. |
pkg/cli/codemod_network_allowed_domains_test.go |
Tests common migration scenarios. |
.github/workflows/smoke-copilot-auto.lock.yml |
Removes generated model-cost metadata. |
.github/aw/network.md |
Documents canonical naming and automatic fixing. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comments suppressed due to low confidence (2)
pkg/cli/codemod_network_allowed_domains.go:83
- For an alias-only flow-style value such as
allowed-domains: [defaults, github], this replaces the entire line withallowed:and silently deletes the domains. Rename only the key so the existing value, indentation, anchor, and trailing comment are preserved; the existingfindAndReplaceInLinehelper already provides that behavior.
result[absADStart] = fieldIndent + "allowed:"
pkg/cli/codemod_network_allowed_domains.go:76
- The merge path only recognizes block-list lines beginning with
-. Both properties are schema-valid as flow arrays, soallowed: [defaults]plusallowed-domains: [github]produces an empty merged list andgh aw fix --writedeletes both domains. Merge from the already parsednetworkMapslices (or a YAML node representation) rather than reparsing YAML text withcollectListItems.
// Collect domain items from allowed-domains
adDomains := collectListItems(networkLines[adStart : adEnd+1])
- Files reviewed: 8/8 changed files
- Comments generated: 3
- Review effort level: Medium
| ID: "network-allowed-domains-rename", | ||
| Name: "Rename network.allowed-domains to network.allowed", | ||
| Description: "Renames the deprecated 'network.allowed-domains' key to 'network.allowed', merging with any existing 'network.allowed' entries.", | ||
| IntroducedIn: "0.1.0", |
| The top-level `network` block uses **`allowed`** — not `allowed-domains`: | ||
|
|
||
| ```yaml | ||
| # WRONG — network.allowed-domains does not exist |
Comment on lines
+37
to
+41
| for _, key := range []string{"allowed", "allowed-domains"} { | ||
| if raw, exists := networkObj[key]; exists { | ||
| if slice, ok := raw.([]any); ok { | ||
| for _, domain := range slice { | ||
| if domainStr, ok := domain.(string); ok { |
Contributor
|
Excellent work! 🎉 This PR handles a common user mistake gracefully:
This is well-thought-out, focused, and ready to merge. Great contribution to improving the user experience! 👍
|
This was referenced Jul 28, 2026
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.
Users commonly write
network.allowed-domainsby analogy withsafe-outputs.allowed-domains, causing a compile-timeadditionalPropertiesschema error. This PR makes the compiler tolerate the wrong key and auto-migrates it.Changes
frontmatter_extraction_security.go):extractNetworkPermissionsunions bothallowedandallowed-domainswhen present, so affected workflows compile without error.main_workflow_schema.json): Addsallowed-domainsas a deprecated valid property in thenetworkobject, preventing immediate schema rejection.codemod_network_allowed_domains.go):gh aw fixnow renamesnetwork.allowed-domains→network.allowed, merging and deduplicating domain lists..github/aw/network.md): Adds a "Common Naming Mistake" section with a before/after example.