Skip to content

fix(extract): ignore Liquid expressions in named value discovery - #290

Open
Junior (seilorjunior) wants to merge 1 commit into
Azure:mainfrom
seilorjunior:fix/276-liquid-policy-references
Open

Junior (seilorjunior) wants to merge 1 commit into
Azure:mainfrom
seilorjunior:fix/276-liquid-policy-references

Conversation

@seilorjunior

Copy link
Copy Markdown

This pull request refines how policy XML is scanned for dependencies, specifically improving the detection of named value references in the presence of Liquid template bodies. It introduces logic to ignore named value lookups inside <set-body template="liquid"> elements, ensuring only real dependencies are detected. Comprehensive tests are added to validate these changes and cover various edge cases.

Policy XML Parsing Improvements:

  • Updated the scanPolicyReferences function in src/services/transitive-resolver.ts to exclude named value references found within Liquid template bodies, using new regular expressions and parsing logic to correctly handle nested and attribute-rich tags. [1] [2]

Test Coverage Enhancements:

  • Added extensive unit tests in tests/unit/services/transitive-resolver.test.ts to verify that named values inside Liquid templates are ignored, while other dependencies (like backends and fragments) are still detected. These tests cover a wide range of policy XML patterns and edge cases.
  • Introduced integration-style tests in tests/unit/services/extract-service.test.ts to ensure policies using Liquid templates are extracted without false dependency lookups or unintended policy modifications.Skip Liquid set-body content when discovering named values, while preserving ordinary policy references and original extracted artifacts. Handle CDATA, comments, nested body tags, and attribute variations. Add scanner and service/fragment extraction regression coverage.

Closes #276

Skip Liquid set-body content when discovering named values, while
preserving ordinary policy references and original extracted artifacts.
Handle CDATA, comments, nested body tags, and attribute variations.
Add scanner and service/fragment extraction regression coverage.

Closes Azure#276

Co-authored-by: GitHub Copilot <noreply@github.com>
Copilot AI balanced review requested due to automatic review settings September 17, 2026 19:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused fix preserves other dependency scanning and includes comprehensive regression coverage.

Pull request overview

Prevents Liquid expressions from being misidentified as named-value dependencies during extraction.

Changes:

  • Excludes Liquid set-body contents from named-value scanning.
  • Adds scanner edge-case and extraction regression coverage.
File summaries
File Description
src/services/transitive-resolver.ts Skips Liquid bodies during named-value discovery.
tests/unit/services/transitive-resolver.test.ts Covers Liquid parsing variants and boundaries.
tests/unit/services/extract-service.test.ts Verifies successful extraction without false lookups or policy changes.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

This branch has not been deployed

No deployments
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.

extract reports extraction errors / exits with code 1 for APIs using set-body template="liquid" with {{ }} expressions

2 participants