claws-scan 0.9.5 → 0.10.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: 99e68a15fab38b583b1b9c34717ef25f2a1612f0da8b0bf50d5b0d4530829ce5
4
- data.tar.gz: ca653965f7c90d93e2122d70ceb1a54e0c1a326d13d8cbbfbfaa8cadc8e01273
3
+ metadata.gz: 2f59c144218053c0a586d12ef661dbdb5790cfa6ea2a5558853cca2bb96fd7ef
4
+ data.tar.gz: 9480e82f69cf9483e3856262571af392d1470c7a55fedb69057c4e58e615ad42
5
5
  SHA512:
6
- metadata.gz: c1fbbe050665049b3a913681debe61e374d825197e3be5883e7bcbf3e0ea7818937700e576feba9fdd5fd0edb16798a9b2ce1c6a157781036324ff8b6ab4aa59
7
- data.tar.gz: f715f4ea43b80cdc3d25a41554d30b0fcf88a3055e500f325c93f31a3d35020083cf45bcbff14cf10f9373952a8fb918da674fec2bb9aebf1b6c341a522a7eec
6
+ metadata.gz: '0918feded5a9e55e37a86c27b3776e2c6d4abf2bb1356d26be6adf4280331340a9fb1390e168837fd17f57c644b24039a02f49f48911d2c5881a5a17c1d04147'
7
+ data.tar.gz: 803a7627dd4f5d910ed6c5c71a34e57ce0ede591d92c16a92b6e2ebdca291abd44a78b8e6e24c8a31a1b7c458c267968a2785b1a6ecdee010b3d19b2a556ba90
data/.rubocop.yml CHANGED
@@ -1,5 +1,7 @@
1
1
  AllCops:
2
- TargetRubyVersion: 3.2.3
2
+ TargetRubyVersion: 3.4.10
3
+ NewCops: disable
4
+ SuggestExtensions: false
3
5
 
4
6
  Style/StringLiterals:
5
7
  Enabled: true
data/Gemfile CHANGED
@@ -3,15 +3,18 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  gemspec
6
+ ruby "3.4.10"
6
7
 
7
8
  gem "rake", "~> 13.0"
8
9
  gem "rspec", "~> 3.0"
9
10
  gem "rubocop", "~> 1.21"
10
11
 
12
+ gem "base64"
11
13
  gem "equation"
12
14
  gem "fakefs"
13
15
  gem "faraday-retry"
14
16
  gem "octokit"
15
17
  gem "pry"
18
+ gem "racc"
16
19
  gem "slop", "~> 4.9"
17
20
  gem "treetop"
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- claws-scan (0.9.5)
4
+ claws-scan (0.10.0)
5
5
  equation (~> 0.6)
6
6
  pry
7
7
  slop (~> 4.9)
@@ -12,7 +12,8 @@ GEM
12
12
  specs:
13
13
  addressable (2.9.0)
14
14
  public_suffix (>= 2.0.2, < 8.0)
15
- ast (2.4.2)
15
+ ast (2.4.3)
16
+ base64 (0.3.0)
16
17
  coderay (1.1.3)
17
18
  diff-lcs (1.5.0)
18
19
  equation (0.6.2)
@@ -25,7 +26,9 @@ GEM
25
26
  net-http (~> 0.5)
26
27
  faraday-retry (2.0.0)
27
28
  faraday (~> 2.0)
28
- json (2.21.2)
29
+ json (3.0.2)
30
+ language_server-protocol (3.17.0.6)
31
+ lint_roller (1.1.0)
29
32
  logger (1.7.0)
30
33
  method_source (1.0.0)
31
34
  net-http (0.9.1)
@@ -33,18 +36,20 @@ GEM
33
36
  octokit (6.0.1)
34
37
  faraday (>= 1, < 3)
35
38
  sawyer (~> 0.9)
36
- parallel (1.22.1)
37
- parser (3.1.2.1)
39
+ parallel (2.2.0)
40
+ parser (3.3.12.0)
38
41
  ast (~> 2.4.1)
42
+ racc
39
43
  polyglot (0.3.5)
44
+ prism (1.9.0)
40
45
  pry (0.14.2)
41
46
  coderay (~> 1.1)
42
47
  method_source (~> 1.0)
43
48
  public_suffix (7.0.5)
49
+ racc (1.8.1)
44
50
  rainbow (3.1.1)
45
51
  rake (13.0.6)
46
- regexp_parser (2.6.0)
47
- rexml (3.4.2)
52
+ regexp_parser (2.12.0)
48
53
  rspec (3.11.0)
49
54
  rspec-core (~> 3.11.0)
50
55
  rspec-expectations (~> 3.11.0)
@@ -58,26 +63,30 @@ GEM
58
63
  diff-lcs (>= 1.2.0, < 2.0)
59
64
  rspec-support (~> 3.11.0)
60
65
  rspec-support (3.11.1)
61
- rubocop (1.38.0)
62
- json (~> 2.3)
63
- parallel (~> 1.10)
64
- parser (>= 3.1.2.1)
66
+ rubocop (1.91.0)
67
+ json (>= 2.3)
68
+ language_server-protocol (~> 3.17.0.2)
69
+ lint_roller (~> 1.1.0)
70
+ parallel (>= 1.10)
71
+ parser (>= 3.3.0.2)
65
72
  rainbow (>= 2.2.2, < 4.0)
66
- regexp_parser (>= 1.8, < 3.0)
67
- rexml (>= 3.2.5, < 4.0)
68
- rubocop-ast (>= 1.23.0, < 2.0)
73
+ regexp_parser (>= 2.9.3, < 3.0)
74
+ rubocop-ast (>= 1.49.0, < 2.0)
69
75
  ruby-progressbar (~> 1.7)
70
- unicode-display_width (>= 1.4.0, < 3.0)
71
- rubocop-ast (1.23.0)
72
- parser (>= 3.1.1.0)
73
- ruby-progressbar (1.11.0)
76
+ unicode-display_width (>= 2.4.0, < 4.0)
77
+ rubocop-ast (1.50.0)
78
+ parser (>= 3.3.7.2)
79
+ prism (~> 1.7)
80
+ ruby-progressbar (1.13.0)
74
81
  sawyer (0.9.2)
75
82
  addressable (>= 2.3.5)
76
83
  faraday (>= 0.17.3, < 3)
77
84
  slop (4.9.3)
78
85
  treetop (1.6.12)
79
86
  polyglot (~> 0.3)
80
- unicode-display_width (2.3.0)
87
+ unicode-display_width (3.2.0)
88
+ unicode-emoji (~> 4.1)
89
+ unicode-emoji (4.2.0)
81
90
  uri (1.1.1)
82
91
 
83
92
  PLATFORMS
@@ -89,17 +98,22 @@ PLATFORMS
89
98
  x86_64-linux
90
99
 
91
100
  DEPENDENCIES
101
+ base64
92
102
  claws-scan!
93
103
  equation
94
104
  fakefs
95
105
  faraday-retry
96
106
  octokit
97
107
  pry
108
+ racc
98
109
  rake (~> 13.0)
99
110
  rspec (~> 3.0)
100
111
  rubocop (~> 1.21)
101
112
  slop (~> 4.9)
102
113
  treetop
103
114
 
115
+ RUBY VERSION
116
+ ruby 3.4.10p104
117
+
104
118
  BUNDLED WITH
105
119
  2.4.2
data/README.md CHANGED
@@ -40,9 +40,9 @@ jobs:
40
40
  runs-on: ubuntu-latest
41
41
  steps:
42
42
  - name: Set Up Ruby
43
- uses: ruby/setup-ruby@d8d83c3960843afb664e821fed6be52f37da5267 # v1.231.0
43
+ uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1.321.0
44
44
  with:
45
- ruby-version: '3.0'
45
+ ruby-version: '3.4'
46
46
  # Grab your configuration file however makes sense for you
47
47
  # We keep ours in a separate Github repo.
48
48
  - name: Set Up Claws Config
@@ -27,7 +27,7 @@ module Claws
27
27
  def get_violations(filename, workflow)
28
28
  violations = get_workflow_violations(filename, workflow)
29
29
 
30
- workflow.jobs.each do |_job_name, job|
30
+ workflow.jobs.each_value do |job|
31
31
  violations += get_job_violations(filename, workflow, job)
32
32
 
33
33
  job.fetch("steps", []).each do |step|
@@ -15,7 +15,7 @@ class BaseRule
15
15
  difference: ->(arr1, arr2) { arr1.difference arr2 },
16
16
  intersection: ->(arr1, arr2) { arr1.intersection arr2 },
17
17
  get_key: ->(arr, key) { (arr || {}).fetch(key, nil) },
18
- count: ->(n) { n.length },
18
+ count: lambda(&:length),
19
19
  dig: lambda { |object, path, default = nil|
20
20
  # sometimes we might want to traverse the object as if it were a hash
21
21
  # sometimes we might want to traverse it as a Ruby object
data/lib/claws/engine.rb CHANGED
@@ -18,7 +18,7 @@ class ExpressionParser
18
18
  startswith: ->(string, needle) { string.to_s.start_with? needle },
19
19
  endswith: ->(string, needle) { string.to_s.end_with? needle },
20
20
  difference: ->(arr1, arr2) { arr1.difference arr2 },
21
- count: ->(n) { n.length }
21
+ count: lambda(&:length)
22
22
  }
23
23
  )
24
24
  end
@@ -24,10 +24,13 @@ module Claws
24
24
  )
25
25
  ), highlight: "with.ssh-key"
26
26
 
27
+ # secrets.GITHUB_TOKEN is the short lived per-run token, not a static credential.
28
+ # the regex retries at each secrets. reference, so GITHUB_TOKEN alongside another secret is still flagged.
29
+ # %() is double quoted, so \\b is needed to reach the regex as a word boundary (\b would be a backspace)
27
30
  on_step %(
28
31
  $step.meta.action.name == "actions/checkout" &&
29
32
  (
30
- get_key($step.with, "token") =~ "{{.*secrets\..*" ||
33
+ get_key($step.with, "token") =~ "{{.*secrets\.(?!(?i:GITHUB_TOKEN)\\b)" ||
31
34
  get_key($step.with, "token") =~ "{{.*env\..*" ||
32
35
  get_key($step.with, "token") =~ "{{.*vars\..*" ||
33
36
  get_key($step.with, "token") =~ "gh[a-z]_.*"
@@ -8,7 +8,9 @@ module Claws
8
8
  https://github.com/betterment/claws/blob/main/README.md#commandinjection
9
9
  DESC
10
10
 
11
- on_step '$step.run =~ ".*{{.*(github\.event|inputs)\..*}}.*"', highlight: "run"
11
+ # only ${{ }} is expanded by the runner; bare {{ }} (e.g. gh-aw prompt templates) is literal text.
12
+ # (?:(?!\}\}).)* keeps the match inside a single expression while still allowing a lone } like format('{0}', ...)
13
+ on_step '$step.run =~ "\$\{\{(?:(?!\}\}).)*(github\.event|inputs)\."', highlight: "run"
12
14
  end
13
15
  end
14
16
  end
@@ -66,8 +66,11 @@ module Claws
66
66
  def analyze_script(script, shell)
67
67
  sanitized_script, variables = *sanitize_script(script)
68
68
 
69
+ # scripts are piped in via stdin, so sourced files can never be followed
70
+ # https://www.shellcheck.net/wiki/SC1090
71
+ # https://www.shellcheck.net/wiki/SC1091
69
72
  Open3.popen3(
70
- shellcheck_bin, "-", "-s", shell
73
+ shellcheck_bin, "-", "-s", shell, "-e", "SC1090,SC1091"
71
74
  ) do |stdin, stdout, stderr, wait_thr|
72
75
  stdin.write(sanitized_script)
73
76
  stdin.close
data/lib/claws/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Claws
4
- VERSION = "0.9.5"
4
+ VERSION = "0.10.0"
5
5
  end
@@ -36,7 +36,8 @@ class Workflow
36
36
  return @on if key.to_s == "on"
37
37
  return @jobs if key.to_s == "jobs"
38
38
  return @name if key.to_s == "name"
39
- return @env if key.to_s == "env"
39
+
40
+ @env if key.to_s == "env"
40
41
  end
41
42
 
42
43
  def get_snippet(line, context: 3)
@@ -162,7 +163,7 @@ class Workflow
162
163
  return [] if env.nil?
163
164
 
164
165
  secrets = []
165
- env.each do |_k, v|
166
+ env.each_value do |v|
166
167
  next unless v.is_a? String
167
168
 
168
169
  secrets += v.scan(/secrets\.([a-zA-Z0-9_]+)/).flatten
data/mise.lock ADDED
@@ -0,0 +1,46 @@
1
+ # @generated - this file is auto-generated by `mise lock` https://mise.jdx.dev/dev-tools/mise-lock.html
2
+
3
+ lockfile_version = 2
4
+
5
+ [[tools.ruby]]
6
+ version = "3.4.10"
7
+ backend = "core:ruby"
8
+ specifiers = ["3.4.10"]
9
+
10
+ [tools.ruby."platforms.windows-x64"]
11
+ checksum = "sha256:89e3c5e235ac88b9b7e8daaf639eaaab74d7c470667354f6bf0f7432f3191ebb"
12
+ url = "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.4.10-1/rubyinstaller-3.4.10-1-x64.7z"
13
+
14
+ [[tools.ruby]]
15
+ version = "3.4.10"
16
+ backend = "core:ruby"
17
+ specifiers = ["3.4.10"]
18
+
19
+ [tools.ruby.options]
20
+ compile = "true"
21
+ ruby_build_repo = "https://github.com/rbenv/ruby-build.git"
22
+ ruby_install = "false"
23
+
24
+ [tools.ruby."platforms.linux-arm64"]
25
+ checksum = "sha256:ecee2d072a14f2d14347dd56dfd8fe5c3130abf5117bfaacbda0f4ef9cc429ec"
26
+ url = "https://cache.ruby-lang.org/pub/ruby/3.4/ruby-3.4.10.tar.gz"
27
+
28
+ [tools.ruby."platforms.linux-arm64-musl"]
29
+ checksum = "sha256:ecee2d072a14f2d14347dd56dfd8fe5c3130abf5117bfaacbda0f4ef9cc429ec"
30
+ url = "https://cache.ruby-lang.org/pub/ruby/3.4/ruby-3.4.10.tar.gz"
31
+
32
+ [tools.ruby."platforms.linux-x64"]
33
+ checksum = "sha256:ecee2d072a14f2d14347dd56dfd8fe5c3130abf5117bfaacbda0f4ef9cc429ec"
34
+ url = "https://cache.ruby-lang.org/pub/ruby/3.4/ruby-3.4.10.tar.gz"
35
+
36
+ [tools.ruby."platforms.linux-x64-musl"]
37
+ checksum = "sha256:ecee2d072a14f2d14347dd56dfd8fe5c3130abf5117bfaacbda0f4ef9cc429ec"
38
+ url = "https://cache.ruby-lang.org/pub/ruby/3.4/ruby-3.4.10.tar.gz"
39
+
40
+ [tools.ruby."platforms.macos-arm64"]
41
+ checksum = "sha256:ecee2d072a14f2d14347dd56dfd8fe5c3130abf5117bfaacbda0f4ef9cc429ec"
42
+ url = "https://cache.ruby-lang.org/pub/ruby/3.4/ruby-3.4.10.tar.gz"
43
+
44
+ [tools.ruby."platforms.macos-x64"]
45
+ checksum = "sha256:ecee2d072a14f2d14347dd56dfd8fe5c3130abf5117bfaacbda0f4ef9cc429ec"
46
+ url = "https://cache.ruby-lang.org/pub/ruby/3.4/ruby-3.4.10.tar.gz"
data/mise.toml ADDED
@@ -0,0 +1,2 @@
1
+ [tools]
2
+ ruby = "3.4.10"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: claws-scan
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.5
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Omar
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-08-20 00:00:00.000000000 Z
11
+ date: 2026-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: equation
@@ -76,7 +76,6 @@ extra_rdoc_files: []
76
76
  files:
77
77
  - ".rspec"
78
78
  - ".rubocop.yml"
79
- - ".ruby-version"
80
79
  - CONTRIBUTING.md
81
80
  - Gemfile
82
81
  - Gemfile.lock
@@ -114,6 +113,8 @@ files:
114
113
  - lib/claws/version.rb
115
114
  - lib/claws/violation.rb
116
115
  - lib/claws/workflow.rb
116
+ - mise.lock
117
+ - mise.toml
117
118
  homepage: https://github.com/Betterment/claws
118
119
  licenses: []
119
120
  metadata:
@@ -127,7 +128,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
127
128
  requirements:
128
129
  - - ">="
129
130
  - !ruby/object:Gem::Version
130
- version: '3.2'
131
+ version: '3.4'
131
132
  required_rubygems_version: !ruby/object:Gem::Requirement
132
133
  requirements:
133
134
  - - ">="
data/.ruby-version DELETED
@@ -1 +0,0 @@
1
- 3.2.3