Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
pelikhan
approved these changes
Sep 8, 2025
Copilot
AI
changed the title
[WIP] Add a simple expression parser that can handle && || , parenthesis. Use parser when validating expressions in agenric workflow markdown by visiting the expression tree and validating literalexpresssions. Extend existing expreessions.go support
Add expression parser for && || and parentheses with tree visitor validation
Sep 8, 2025
Mossaka
added a commit
that referenced
this pull request
Feb 6, 2026
Includes fixes for chroot mode MCP server connectivity: - fix: resolve host.docker.internal DNS in chroot mode (#555) - fix: inject host.docker.internal from docker-manager.ts - fix: postprocess smoke workflows to build containers locally - fix: set NO_PROXY for host gateway to bypass Squid (#554) - fix: bypass Squid for network gateway to fix MCP SSE crash (#553) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Problem
The existing expression validation in
validateExpressionSafetyonly handled simple literal expressions within GitHub Actions${{ }}blocks. It couldn't parse or validate complex expressions using logical operators like&&,||,!, and parentheses for grouping. This meant that complex expressions like:${{ (github.event_name == 'issues') && (github.event.action == 'opened') || !github.event.pull_request.draft }}Would be treated as a single literal and either fully allowed or rejected, rather than validating each individual component expression.
Solution
This PR adds a comprehensive expression parser that extends the existing
expressions.goinfrastructure:New Components
ConditionNodeASTvalidateExpressionSafetyto use the parser for complex expressionsSupported Syntax
github.event_name == 'issues'condition1 && condition2(higher precedence)condition1 || condition2(lower precedence)!condition1(condition1 && condition2) || condition3Implementation Details
The parser follows these design principles:
ConditionNodeinfrastructure rather than replacing it&&) has higher precedence than OR (||)Example Usage
Validation Enhancement
The expression safety validation now:
Testing
Added comprehensive test coverage including:
The implementation successfully handles complex expressions while maintaining the security properties of the original validation system.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
api.contoso.com/tmp/go-build1091059789/b278/cli.test -test.testlogfile=/tmp/go-build1091059789/b278/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true(dns block)/tmp/go-build1482235784/b278/cli.test -test.testlogfile=/tmp/go-build1482235784/b278/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true(dns block)If you need me to access, download, or install something from one of these locations, you can either:
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.