Skip to content

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

@github-actions

Description

@github-actions

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

Metadata

Metadata

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions