Repository navigation
Allow validated status-only jobs after detection - #71623
Conversation
Co-authored-by: pelikhan <[email protected]>
| return ok && (strings.EqualFold(value.Value, "success") || strings.EqualFold(value.Value, "skipped")) | ||
| } | ||
|
|
||
| func statusOnlyExpressionPath(node actionlint.ExprNode) ([]string, bool) { |
| if path == "jobs."+validator.jobID && uses != "" { | ||
| validator.addViolation(childPath, "status-only jobs cannot call an opaque reusable workflow") | ||
| } | ||
| if strings.Contains(strings.ToLower(uses), "actions/download-artifact") { |
This comment has been minimized.
This comment has been minimized.
|
@copilot rename "detection-gate: status-only" to "continue-on-detection-error: true" |
There was a problem hiding this comment.
🟡 Changes recommended
Status-only validation still permits prohibited agent-data access, and compiler/linter integration has unresolved correctness gaps.
7 open issues
Prevent artifact retrieval through status-only jobs · New Parse complete step conditions safely · New Validate complete needs access chains · New Validate effective Actions fields from companion opt-in · New Assert compiled status job guards and detection dependency · New Match built-in customization targets in custom job checks · New Allow compiler-injected gateway security guards · New
What changed in this PR
Adds a detection-gate: status-only opt-in to gh-aw custom jobs so status notifications can run after failed or warn-mode detection while ordinary jobs retain their detection guards.
Changes:
- Preserves opted-in jobs’ authored conditions and ensures detection ordering.
- Adds shared compiler/linter contract validation and schema support.
- Adds regression tests and updates security specifications and documentation.
| File | Description |
|---|---|
specs/compiler-threat-detection-spec.md |
Defines the status-only exception under CTR-005. |
specs/compiler-threat-detection-changelog.md |
Records the exception and validation mapping. |
pkg/workflow/lint/custom_job_detection.go |
Adds status-only contract diagnostics and exemption handling. |
pkg/workflow/lint/custom_job_detection_test.go |
Covers permitted reads, prohibited operations, and leaf requirements. |
pkg/workflow/compiler_custom_job_detection.go |
Validates opted-in jobs before omitting the detection guard. |
pkg/workflow/compiler_custom_job_detection_test.go |
Adds compilation and contract-validation cases. |
pkg/workflow/compiler_custom_job_detection_expression_test.go |
Updates calls to the guard helper. |
pkg/workflow/aw/status_only_job.go |
Introduces shared expression and job-contract validation. |
pkg/parser/schemas/main_workflow_schema.json |
Accepts the compiler-only status-only opt-in. |
docs/src/content/docs/reference/workflow-linters.md |
Documents lint behavior and contract restrictions. |
docs/src/content/docs/reference/steps-jobs.md |
Explains status-only notifications with an example. |
docs/adr/70997-enforce-detection-gates-for-custom-workflow-jobs.md |
Records the exception to mandatory detection gating. |
Review effort: Max
| if strings.Contains(strings.ToLower(uses), "actions/download-artifact") { | ||
| validator.addViolation(childPath, "status-only jobs cannot use actions/download-artifact") | ||
| } |
| matches := statusOnlyExpressionPattern.FindAllString(value, -1) | ||
| for _, match := range matches { | ||
| validator.inspectExpression(match, path) | ||
| } | ||
| if strings.Contains(value, "${{") && len(matches) == 0 { | ||
| validator.addViolation(path, "status-only job contains an expression that cannot be inspected safely") | ||
| } | ||
| if inIf && !strings.Contains(value, "${{") && strings.Contains(strings.ToLower(value), "needs") { | ||
| validator.inspectExpression(value, path) | ||
| } |
| parts, ok := statusOnlyExpressionPath(child) | ||
| jobID, outputsReference := statusOnlyOutputJobID(parts) | ||
| if !ok || !outputsReference { | ||
| return |
| if input.Document != nil { | ||
| if sourceFields, ok := authored[id].(map[string]any); ok { | ||
| fields["uses"] = sourceFields["uses"] | ||
| fields["runs-on"] = sourceFields["runs-on"] | ||
| maps.Copy(fields, sourceFields) |
| require.Contains(t, content, "if: always()") | ||
| require.NotContains(t, content, "if: needs.detection.result == 'success'") |
| func customJobDetectionStatusOnlyDiagnostics(id string, fields map[string]any, jobs map[string]any, graph aw.JobDependencyGraph, allowedOutputJobs map[string]struct{}) []Diagnostic { | ||
| var diagnostics []Diagnostic | ||
| for _, dependent := range sliceutil.SortedKeys(jobs) { | ||
| if dependent != id && !constants.IsCompilerOwnedJobName(dependent) && graph.DependsOn(dependent, id) { |
| break | ||
| } | ||
| } | ||
| for _, violation := range aw.ValidateStatusOnlyJob(id, fields, allowedOutputJobs) { |
|
@copilot run pr-finisher skill |
Renamed the option to |
| // HasSuccessfulDetectionCondition reports whether a job's condition requires | ||
| // detection success on every branch, allowing skipped detection for conditional gates. | ||
| func HasSuccessfulDetectionCondition(condition string) bool { | ||
| if strings.TrimSpace(condition) == "" { |
| } | ||
| } | ||
|
|
||
| func (validator *statusOnlyJobValidator) inspectMapKey(value map[string]any, path, key, childPath string, inEnv bool) { |
|
@copilot return to "detection-gate: status-only" naming + update compiler threat specification and TLA+ specs |
Co-authored-by: pelikhan <[email protected]>
Ran pr-finisher. Commit
Restored |
| if path == "jobs."+validator.jobID && uses != "" { | ||
| validator.addViolation(childPath, "status-only jobs cannot call an opaque reusable workflow") | ||
| } | ||
| if strings.Contains(strings.ToLower(uses), "actions/download-artifact") { |
|
Thanks for implementing detection-gate status-only! One item: please confirm unit tests cover the key validator scenarios in pkg/workflow/aw/status_only_job.go (rejecting artifact downloads, opaque reusable workflows, allowed detection-gated outputs).
|
|
@copilot address the following outstanding work in one pass:
Push the necessary fixes, reply to each listed review thread and resolve it when addressed. Ignore feedback already answered or resolved. Use the pr-finisher skill and stop when only human review or CI remains; do not trigger CI. Sous-chef head: 7cb1256
|
|
🎉 This pull request is included in a new release. Release: |


Post-agent custom jobs were blocked whenever detection failed or reported warn-mode findings, leaving status notifications unresolved. Add a constrained opt-out for jobs that report job results without consuming agent-derived data.
detection-gate: status-onlypreserves the authoredifand ensuresdetectionis inneeds.safe_outputs.