Skip to content

[WIP] Allow network.allowed and network.blocked to accept GitHub Actions expressions#23861

Closed
Copilot wants to merge 1 commit intomainfrom
copilot/parameterize-network-allowed-blocked
Closed

[WIP] Allow network.allowed and network.blocked to accept GitHub Actions expressions#23861
Copilot wants to merge 1 commit intomainfrom
copilot/parameterize-network-allowed-blocked

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 1, 2026

Thanks for asking me to work on this. I will get started on it and keep this PR's description up to date as I form a plan and make progress.


This section details on the original issue you should resolve

<issue_title>[plan] Parameterize network.allowed and network.blocked to accept GitHub Actions expressions</issue_title>
<issue_description>## Objective

Allow the network.allowed (and network.blocked) frontmatter fields to accept GitHub Actions expression strings (e.g. ${{ inputs.allowed-domains }}) as list items or as the full list value, enabling reusable workflows to customize network policy at call time.

Context

Tracked in issue #23724. Currently blocked by JSON schema type constraints (expects array, gets string). The Go extraction code in pkg/workflow/engine.go also does strict type assertions on []string.

Current Behavior

network:
  allowed:
    - github.com
    - npm  # Only literal domain/ecosystem strings work

Expected Behavior

network:
  allowed:
    - github.com
    - ${{ inputs.extra-domain }}   # ✅ Expression for individual item

Or potentially:

network:
  allowed: ${{ inputs.allowed-domains }}  # ✅ Expression for entire list

Approach

  1. Decide on granularity (recommend per-item approach for schema simplicity):

    • Per-item: array items accept string (existing behavior) or an expression ${{ ... }}
    • Full-list expression: the allowed field accepts an array OR a single expression string
  2. Update JSON schema in pkg/parser/schemas/main_workflow_schema.json:

    • For the per-item approach: items: { oneOf: [domain-string, expression-string] }
    • Or relax the item pattern to also accept ${{ ... }} strings.
  3. Update NetworkPermissions parsing in pkg/workflow/engine.go (extractNetworkPermissions or similar):

    • When iterating network.allowed items, check if the item is a ${{ ... }} expression and pass it through as-is to the compiled YAML.
    • At compile time, validate non-expression items as domains/ecosystems; skip validation for expression items.
  4. Update compiler output: Ensure expression items emit correctly in the compiled .lock.yml (GitHub Actions evaluates them at runtime).

  5. Update tests to cover expression items alongside literal domains.

Files to Modify

  • pkg/parser/schemas/main_workflow_schema.json — relax item type constraint
  • pkg/workflow/engine.goNetworkPermissions extraction to handle expression items
  • pkg/workflow/ compilation code emitting the allowed list
  • Tests in pkg/workflow/ or pkg/parser/

Acceptance Criteria

  • network.allowed: [github.com, npm] still works (backward compatible)
  • network.allowed: [${{ inputs.domain }}, github.com] compiles and expressions appear correctly in the compiled .lock.yml
  • Non-expression strings that aren't valid domains/ecosystems still produce validation errors
  • Tests pass: make agent-finish
    Related to Ask: Runtime Parameterization of Compile-Time Frontmatter Fields #23724

Generated by Plan Command for issue #23724 ·

  • expires on Apr 3, 2026, 5:44 AM UTC

Comments on the Issue (you are @copilot in this section)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[plan] Parameterize network.allowed and network.blocked to accept GitHub Actions expressions

2 participants