Repository navigation
Split general workflow patches into ordered domain modules - #11544
Conversation
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
The extraction removes rationale comments for the Azure credential-exclusion workaround and diagnosis-maintenance cache retention, leaving these intentional exceptions unexplained.
2 open issues
What changed in this PR
Refactors AWF’s compiled-workflow postprocessor into an ordered pipeline and domain modules, addressing #11540 while preserving the existing public interfaces.
Changes:
- Extracts transforms, patterns, and sentinels into focused modules without changing generated locks.
- Preserves interleaved processing order and compatibility exports.
- Adds tests for domain behavior, safeguards, idempotency, log order, and shared regex identity.
| File | Description |
|---|---|
scripts/ci/workflow-step-builders.ts |
Imports the engine sentinel from its owning module. |
scripts/ci/workflow-patches/workflow-patches.test.ts |
Adds domain and pipeline compatibility tests. |
scripts/ci/workflow-patches/types.ts |
Defines shared transform and context interfaces. |
scripts/ci/workflow-patches/session-state.ts |
Owns session-state injection and log-path normalization. |
scripts/ci/workflow-patches/network-and-install.ts |
Owns feed, installer, release-selection, and image transforms. |
scripts/ci/workflow-patches/network-and-install-patterns.ts |
Houses installation and image-related patterns. |
scripts/ci/workflow-patches/engine-lifecycle.ts |
Owns engine installation, copy gating, tools, and model transforms. |
scripts/ci/workflow-patches/engine-lifecycle-patterns.ts |
Houses engine-specific patterns and helpers. |
scripts/ci/workflow-patches/enclave.ts |
Extracts gateway, readiness, metadata, and diagnostic transforms. |
scripts/ci/workflow-patches/credentials.ts |
Extracts credential exclusions and recovery-root restrictions. |
scripts/ci/workflow-patches/concurrency.ts |
Owns per-issue conclusion concurrency scoping. |
scripts/ci/workflow-patches/cache-memory.ts |
Extracts cache hardening and persistence policies. |
scripts/ci/workflow-patches/cache-memory-patterns.ts |
Houses cache-memory patterns and sentinels. |
scripts/ci/workflow-patches/azure-smoke.ts |
Extracts Azure smoke pricing and tool restrictions. |
scripts/ci/workflow-patches/admission.ts |
Extracts disabled-admission output declarations. |
scripts/ci/workflow-patch-patterns.ts |
Re-exports moved symbols for compatibility. |
scripts/ci/apply-general-workflow-patches.ts |
Replaces the monolithic function with a 68-line ordered pipeline. |
Review effort: Max (dynamic)
| messages.push(` 'Scan cache-memory for instruction-injection' step already present (new version)`); | ||
| } | ||
|
|
||
| if (workflowFile !== undefined && diagnosisMaintenanceCacheWorkflowLockFiles.has(workflowFile)) { |
| return { content, messages }; | ||
| } | ||
|
|
||
| export function excludeAzureCredentials(content: string, { workflowPath }: PatchContext): TransformResult { |
|
@copilot address all review feedback |
Co-authored-by: lpcox <[email protected]>
Addressed the review feedback in commit |
|
✅ Copilot review passed with no inline comments. @copilot Add the |
Co-authored-by: lpcox <[email protected]>
Fixed the failing fixture in |
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Cover explicit session-state opt-in and fail-closed Azure exclusions, preserve the session-state facade export, and tolerate insignificant command whitespace. Co-authored-by: Copilot App <[email protected]>
|
|
||
| export function hardenCacheMemory(content: string, { workflowFile }: PatchContext): TransformResult { | ||
| const messages: string[] = []; | ||
| const scanInjectionStep = buildScanInjectionStep(HARDENED_INJECTION_PATTERN); |
…ort, function or class' Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
|
@copilot make sure that all review feedback is addressed and that 'npm test' runs without any failures |
|
|
||
| // Case-insensitive and tolerant of leading whitespace / common punctuation prefixes. | ||
| // This is used when (re)injecting the scan step to reduce prompt-injection bypasses. | ||
| const HARDENED_INJECTION_PATTERN = String.raw`(?i).*(?:^|[\s\-\*\>\#\|:;.,\(\)\[\]\{\}"'])(system|assistant|developer|user)\s*:.*`; |
…ort, function or class' Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: lpcox <[email protected]>
✅ Coverage Check PassedOverall Coverage
✨ New Files (1 files)
Coverage comparison generated by |
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Fixed the scanner hardening gap and added regression coverage for insertion and upgrade in |

applyGeneralWorkflowPatchesmixed order-dependent transforms in a 1,090-line function, obscuring credential isolation and cache-memory hardening.