Class: Rules::AllowForksArtifact

Inherits:
Base
  • Object
show all
Defined in:
lib/rules/allow_forks_artifact.rb

Instance Method Summary collapse

Instance Method Details

#check(workflow) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/rules/allow_forks_artifact.rb', line 7

def check(workflow)
    findings = []

    workflow.lines_of(/allow_forks:\s*true/).each do |line_num|
        findings << finding(workflow,
            line: line_num,
            code: workflow.line_content(line_num).strip,
            message: "Downloading fork-produced artifacts in a privileged workflow_run context",
            fix: "Ensure fork-produced artifact content is not executed or processed unsafely"
        )
    end

    findings
end

#descriptionObject



4
# File 'lib/rules/allow_forks_artifact.rb', line 4

def description = "Artifact download with allow_forks: true in privileged context"

#nameObject



3
# File 'lib/rules/allow_forks_artifact.rb', line 3

def name = "allow-forks-artifact"

#severityObject



5
# File 'lib/rules/allow_forks_artifact.rb', line 5

def severity = :medium