dependabot-github_actions 0.401.0 → 0.402.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f52dcc4ffca3fffd85efa133c46ee31fee800ddca84ed787876441ec34414b47
4
- data.tar.gz: a623cf219e7f0b21463f6e3345cccce0c30773340695adf102cbf332d018f163
3
+ metadata.gz: 2b4e91bfa491ff4e2ec830e11a36ede433981bb4eed911892731ee86c1524e5a
4
+ data.tar.gz: 72215130e11597be9306a4d06aaef10c14f23324b7c05e9a9ede16ab407c8a8c
5
5
  SHA512:
6
- metadata.gz: eabbda950f81fdeef7ec92d5865b67a467beaf70652ca53123a740d1ad1346b4e3a624b7542da3336e3a3a9e3daef68da641930ae034e903baf1620afd08b7b9
7
- data.tar.gz: bfd97e4e98fd61922cb6b8034dc3160ccbb2d1924174f14431650e5b82d9291473f63f61c17ca13427f78a32f4e389df1f4c699b927a6acfb9f13edee67c7f35
6
+ metadata.gz: 0de27643b909bdc0145989098cd705eec0c96cf3d3a78dcba5556c15c5db16b2542dfd2d6a82d1ac73f1d07d0a3321427cc9fad93c732fc4a079bd6efd3040ca
7
+ data.tar.gz: cd48b7b7093a9f6c4b8a607ff4607272e0b993206deafca33d1c72731365c2c6af0e569bb1254d287d96c8087bbb5ef0bfcc26ae1fc51165a370ea249509cac4
@@ -176,11 +176,13 @@ module Dependabot
176
176
  def uses_declaration_pattern(declaration)
177
177
  escaped_declaration = Regexp.escape(declaration)
178
178
 
179
+ # The declaration must end at whitespace, a flow delimiter or the end of the line. `$` does not match
180
+ # before a carriage return, so a CRLF line ending has to be listed explicitly.
179
181
  /
180
182
  (?:^|[ \t{,])
181
183
  (?:"uses"|'uses'|uses)[ \t]*:[ \t]*
182
184
  (?:"#{escaped_declaration}"|'#{escaped_declaration}'|#{escaped_declaration})
183
- (?=[ \t]|$|[,}\]])
185
+ (?=[ \t\r]|$|[,}\]])
184
186
  /x
185
187
  end
186
188
 
@@ -108,8 +108,8 @@ module Dependabot
108
108
  end
109
109
 
110
110
  # Repository workflows whose step-level `$/` chain (through nested composites)
111
- # reaches a changed action. Only `$/` matters: gh-actions-lock refuses
112
- # `./` refs in locked workflows.
111
+ # reaches a changed action. Only `$/` matters: gh-actions-lock never follows
112
+ # `./` actions.
113
113
  sig do
114
114
  params(changed_actions: T::Array[Dependabot::DependencyFile])
115
115
  .returns(T::Array[Dependabot::DependencyFile])
@@ -28,6 +28,7 @@ module Dependabot
28
28
  UNRESOLVABLE_CATEGORIES = %w(
29
29
  unreachable-pin repo-replaced repo-unavailable repo-renamed not-pinned
30
30
  local-action invalid-self-repository-ref misleading-sha
31
+ tag-commit-mismatch incomplete-lockfile ref-missing invalid-workflow
31
32
  ).freeze
32
33
 
33
34
  # Host-identity failures from the engine: the lock is bound to a host it can't
@@ -35,6 +36,10 @@ module Dependabot
35
36
  # engine wraps every lookup error, so only a 404 counts; 5xx/429/403/timeouts stay EngineError.
36
37
  HOST_IDENTITY_ERROR = /verifying repository identity .*: HTTP 404\b|repository IDs|not the selected host/
37
38
 
39
+ # Write-time refusals (an incomplete lock graph, or a `uses:` cycle the lock
40
+ # can't record). Deterministic and user-actionable, so retrying never helps.
41
+ WRITE_REFUSED_ERROR = /refusing to write /
42
+
38
43
  # `hostname` is the repository's home host. The engine binds every pin with an
39
44
  # omitted lockfile `hostname` to it, so it must never be guessed.
40
45
  sig { params(credentials: T::Array[Dependabot::Credential], hostname: String).void }
@@ -52,7 +57,10 @@ module Dependabot
52
57
 
53
58
  # Re-pins workflows already tracked in the lockfile. `--no-onboard` refuses new
54
59
  # workflows/actions (surfaced as onboarding-required skips); `--no-narrow`
55
- # keeps the exact ref Dependabot wrote.
60
+ # keeps the exact ref Dependabot wrote. `--ignore-local-actions` keeps `./`
61
+ # actions a warning: the lock can't record them, Dependabot never rewrites
62
+ # them, and whether their action.yml is readable here depends on whether the
63
+ # repo also uses `$/`.
56
64
  sig do
57
65
  params(
58
66
  workflow_files: T::Array[Dependabot::DependencyFile],
@@ -68,15 +76,16 @@ module Dependabot
68
76
  action_files: []
69
77
  )
70
78
  in_repo(workflow_files + action_files, lockfile) do |dir|
71
- args = %w(--no-onboard --no-narrow --no-interactive --json=findings) +
79
+ args = %w(--no-onboard --no-narrow --ignore-local-actions --no-interactive --json=findings) +
72
80
  ["--hostname", hostname] + workflow_paths
73
81
  json, exit_status = run(dir, args)
74
82
 
75
83
  skipped = onboarding_skips(json, lockfile)
76
84
  log_skips(skipped)
77
85
 
78
- # `findings` is the PRE-fix diagnosis; at exit 0 fix-mode already resolved
79
- # them. Writes are all-or-nothing, so exit 1 means nothing was written.
86
+ # At exit 1 `findings` is the pre-fix diagnosis of what blocked the fix;
87
+ # at exit 0 it reports the post-fix state. Writes are all-or-nothing, so
88
+ # exit 1 means nothing was written.
80
89
  raise_on_findings(json) if exit_status == 1
81
90
 
82
91
  File.read(File.join(dir, LOCKFILE_PATH))
@@ -120,12 +129,16 @@ module Dependabot
120
129
 
121
130
  # Invokes the binary and returns [parsed JSON, exit code]. Exit is tri-state:
122
131
  # 0 = valid, 1 = blocking findings (still well-formed JSON on stdout, parse it),
123
- # 2+ = tool failure (no usable JSON). JSON and exit are not interchangeable in
124
- # fix-mode: findings/valid are PRE-fix, exit is POST-fix, so callers gate on exit.
132
+ # 2+ = tool failure (no usable JSON). In fix-mode, findings/valid describe the
133
+ # post-fix state after a successful fix but the pre-fix state at exit 1, so
134
+ # callers gate on exit.
125
135
  sig { params(dir: String, args: T::Array[String]).returns([JsonObject, Integer]) }
126
136
  def run(dir, args)
127
137
  stdout, stderr, exit_status = invoke(dir, args)
128
- raise DependencyFileNotResolvable, stderr.strip if exit_status > 1 && stderr.match?(HOST_IDENTITY_ERROR)
138
+ if exit_status > 1 && stderr.match?(Regexp.union(HOST_IDENTITY_ERROR, WRITE_REFUSED_ERROR))
139
+ raise DependencyFileNotResolvable, stderr.strip
140
+ end
141
+
129
142
  raise EngineError, "gh-actions-lock failed (exit #{exit_status}): #{stderr.strip}" if exit_status > 1
130
143
 
131
144
  json = case (parsed = JSON.parse(stdout))
@@ -165,7 +178,7 @@ module Dependabot
165
178
  unresolvable = errors.find { |finding| UNRESOLVABLE_CATEGORIES.include?(finding["category"].to_s) }
166
179
  if unresolvable
167
180
  raise UnresolvableDependency.new(
168
- (unresolvable["dependency"] || "unknown").to_s,
181
+ (unresolvable["dependency"] || unresolvable["workflow"] || "unknown").to_s,
169
182
  (unresolvable["detail"] || unresolvable["category"]).to_s
170
183
  )
171
184
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dependabot-github_actions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.401.0
4
+ version: 0.402.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dependabot
@@ -15,14 +15,14 @@ dependencies:
15
15
  requirements:
16
16
  - - '='
17
17
  - !ruby/object:Gem::Version
18
- version: 0.401.0
18
+ version: 0.402.0
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - '='
24
24
  - !ruby/object:Gem::Version
25
- version: 0.401.0
25
+ version: 0.402.0
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: debug
28
28
  requirement: !ruby/object:Gem::Requirement
@@ -278,7 +278,7 @@ licenses:
278
278
  - MIT
279
279
  metadata:
280
280
  bug_tracker_uri: https://github.com/dependabot/dependabot-core/issues
281
- changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.401.0
281
+ changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.402.0
282
282
  rdoc_options: []
283
283
  require_paths:
284
284
  - lib