From 85ecb0aa3f95a53b226ffec28785e4f45930f9a7 Mon Sep 17 00:00:00 2001 From: Serena Fang Date: Mon, 30 Oct 2023 14:42:23 -0500 Subject: [PATCH 01/10] Initial commit of gitlab-secret_detection gem Changelog: added --- Gemfile | 2 + Gemfile.lock | 6 ++ gems/gitlab-secret_detection/.gitignore | 12 +++ gems/gitlab-secret_detection/.gitlab-ci.yml | 4 + gems/gitlab-secret_detection/.rspec | 3 + gems/gitlab-secret_detection/.rubocop.yml | 8 ++ gems/gitlab-secret_detection/CHANGELOG.md | 5 + gems/gitlab-secret_detection/Gemfile | 6 ++ gems/gitlab-secret_detection/Gemfile.lock | 100 ++++++++++++++++++ gems/gitlab-secret_detection/README.md | 29 +++++ .../gitlab-secret_detection.gemspec | 33 ++++++ .../lib/gitlab/secret_detection.rb | 9 ++ .../lib/gitlab/secret_detection/version.rb | 7 ++ .../spec/gitlab/secret_detection_spec.rb | 10 ++ .../spec/spec_helper.rb | 19 ++++ 15 files changed, 253 insertions(+) create mode 100644 gems/gitlab-secret_detection/.gitignore create mode 100644 gems/gitlab-secret_detection/.gitlab-ci.yml create mode 100644 gems/gitlab-secret_detection/.rspec create mode 100644 gems/gitlab-secret_detection/.rubocop.yml create mode 100644 gems/gitlab-secret_detection/CHANGELOG.md create mode 100644 gems/gitlab-secret_detection/Gemfile create mode 100644 gems/gitlab-secret_detection/Gemfile.lock create mode 100644 gems/gitlab-secret_detection/README.md create mode 100644 gems/gitlab-secret_detection/gitlab-secret_detection.gemspec create mode 100644 gems/gitlab-secret_detection/lib/gitlab/secret_detection.rb create mode 100644 gems/gitlab-secret_detection/lib/gitlab/secret_detection/version.rb create mode 100644 gems/gitlab-secret_detection/spec/gitlab/secret_detection_spec.rb create mode 100644 gems/gitlab-secret_detection/spec/spec_helper.rb diff --git a/Gemfile b/Gemfile index c1e9e34c3a5548..3b365e8d155475 100644 --- a/Gemfile +++ b/Gemfile @@ -43,6 +43,8 @@ group :monorepo do gem 'gitlab-backup-cli', path: 'gems/gitlab-backup-cli', feature_category: :backup_restore end +gem 'gitlab-secret_detection', path: 'gems/gitlab-secret_detection' # rubocop:todo Gemfile/MissingFeatureCategory + # Responders respond_to and respond_with gem 'responders', '~> 3.0' # rubocop:todo Gemfile/MissingFeatureCategory diff --git a/Gemfile.lock b/Gemfile.lock index e2ebb91381337f..0eff85d76ff4ad 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -60,6 +60,11 @@ PATH diffy pg_query +PATH + remote: gems/gitlab-secret_detection + specs: + gitlab-secret_detection (0.1.0) + PATH remote: gems/gitlab-utils specs: @@ -1871,6 +1876,7 @@ DEPENDENCIES gitlab-rspec! gitlab-safe_request_store! gitlab-schema-validation! + gitlab-secret_detection! gitlab-sidekiq-fetcher! gitlab-styles (~> 11.0.0) gitlab-utils! diff --git a/gems/gitlab-secret_detection/.gitignore b/gems/gitlab-secret_detection/.gitignore new file mode 100644 index 00000000000000..99deaff73aabc0 --- /dev/null +++ b/gems/gitlab-secret_detection/.gitignore @@ -0,0 +1,12 @@ + +/.bundle/ +/.yardoc +/_yardoc/ +/coverage/ +/doc/ +/pkg/ +/spec/reports/ +/tmp/ + +# rspec failure tracking +.rspec_status diff --git a/gems/gitlab-secret_detection/.gitlab-ci.yml b/gems/gitlab-secret_detection/.gitlab-ci.yml new file mode 100644 index 00000000000000..53ae91fe4ca4b8 --- /dev/null +++ b/gems/gitlab-secret_detection/.gitlab-ci.yml @@ -0,0 +1,4 @@ +include: + - local: gems/gem.gitlab-ci.yml + inputs: + gem_name: "gitlab-secret_detection" diff --git a/gems/gitlab-secret_detection/.rspec b/gems/gitlab-secret_detection/.rspec new file mode 100644 index 00000000000000..34c5164d9b56c7 --- /dev/null +++ b/gems/gitlab-secret_detection/.rspec @@ -0,0 +1,3 @@ +--format documentation +--color +--require spec_helper diff --git a/gems/gitlab-secret_detection/.rubocop.yml b/gems/gitlab-secret_detection/.rubocop.yml new file mode 100644 index 00000000000000..1dc800520ca557 --- /dev/null +++ b/gems/gitlab-secret_detection/.rubocop.yml @@ -0,0 +1,8 @@ +inherit_from: + - ../config/rubocop.yml + +AllCops: + NewCops: enable + +RSpec/MultipleMemoizedHelpers: + Max: 25 diff --git a/gems/gitlab-secret_detection/CHANGELOG.md b/gems/gitlab-secret_detection/CHANGELOG.md new file mode 100644 index 00000000000000..7213bfcc3f21b7 --- /dev/null +++ b/gems/gitlab-secret_detection/CHANGELOG.md @@ -0,0 +1,5 @@ +## [Unreleased] + +## [0.1.0] - 2023-10-09 + +- Initial release diff --git a/gems/gitlab-secret_detection/Gemfile b/gems/gitlab-secret_detection/Gemfile new file mode 100644 index 00000000000000..d0fb4d4d12be4b --- /dev/null +++ b/gems/gitlab-secret_detection/Gemfile @@ -0,0 +1,6 @@ +# frozen_string_literal: true + +source "https://rubygems.org" + +# Specify your gem's dependencies in gitlab-secret_detection.gemspec +gemspec diff --git a/gems/gitlab-secret_detection/Gemfile.lock b/gems/gitlab-secret_detection/Gemfile.lock new file mode 100644 index 00000000000000..191448e6d22aea --- /dev/null +++ b/gems/gitlab-secret_detection/Gemfile.lock @@ -0,0 +1,100 @@ +PATH + remote: . + specs: + gitlab-secret_detection (0.1.0) + +GEM + remote: https://rubygems.org/ + specs: + ast (2.4.2) + benchmark-malloc (0.2.0) + benchmark-perf (0.6.0) + benchmark-trend (0.4.0) + binding_of_caller (1.0.0) + debug_inspector (>= 0.0.1) + coderay (1.1.3) + debug_inspector (1.1.0) + diff-lcs (1.5.0) + json (2.6.3) + parallel (1.23.0) + parser (3.2.2.4) + ast (~> 2.4.1) + racc + pg (1.5.4) + proc_to_ast (0.1.0) + coderay + parser + unparser + racc (1.7.1) + rainbow (3.1.1) + regexp_parser (2.8.2) + rexml (3.2.6) + rspec (3.12.0) + rspec-core (~> 3.12.0) + rspec-expectations (~> 3.12.0) + rspec-mocks (~> 3.12.0) + rspec-benchmark (0.6.0) + benchmark-malloc (~> 0.2) + benchmark-perf (~> 0.6) + benchmark-trend (~> 0.4) + rspec (>= 3.0) + rspec-core (3.12.2) + rspec-support (~> 3.12.0) + rspec-expectations (3.12.3) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.12.0) + rspec-mocks (3.12.6) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.12.0) + rspec-parameterized (1.0.0) + rspec-parameterized-core (< 2) + rspec-parameterized-table_syntax (< 2) + rspec-parameterized-core (1.0.0) + parser + proc_to_ast + rspec (>= 2.13, < 4) + unparser + rspec-parameterized-table_syntax (1.0.1) + binding_of_caller + rspec-parameterized-core (< 2) + rspec-support (3.12.1) + rubocop (1.50.2) + json (~> 2.3) + parallel (~> 1.10) + parser (>= 3.2.0.0) + rainbow (>= 2.2.2, < 4.0) + regexp_parser (>= 1.8, < 3.0) + rexml (>= 3.2.5, < 4.0) + rubocop-ast (>= 1.28.0, < 2.0) + ruby-progressbar (~> 1.7) + unicode-display_width (>= 2.4.0, < 3.0) + rubocop-ast (1.30.0) + parser (>= 3.2.1.0) + rubocop-capybara (2.19.0) + rubocop (~> 1.41) + rubocop-factory_bot (2.24.0) + rubocop (~> 1.33) + rubocop-rspec (2.25.0) + rubocop (~> 1.40) + rubocop-capybara (~> 2.17) + rubocop-factory_bot (~> 2.22) + ruby-progressbar (1.13.0) + unicode-display_width (2.5.0) + unparser (0.6.9) + diff-lcs (~> 1.3) + parser (>= 3.2.2.4) + +PLATFORMS + arm64-darwin-22 + +DEPENDENCIES + gitlab-secret_detection! + pg (~> 1.5.3) + rspec (~> 3.0) + rspec-benchmark (~> 0.6.0) + rspec-parameterized (~> 1.0) + rubocop (~> 1.50) + rubocop-rspec (~> 2.22) + +BUNDLED WITH + 2.4.21 diff --git a/gems/gitlab-secret_detection/README.md b/gems/gitlab-secret_detection/README.md new file mode 100644 index 00000000000000..06e081c17b81c9 --- /dev/null +++ b/gems/gitlab-secret_detection/README.md @@ -0,0 +1,29 @@ +# Gitlab::SecretDetection + +The gitlab-secret_detection gem performs regex matching on git blobs that may include secrets. The gem accepts one or more git blobs, matches them against a defined ruleset of regular expressions (based on gitleaks.toml used by secrets analyzer), and returns scan results. + +## Installation + +TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org. + +Install the gem and add to the application's Gemfile by executing: + + $ bundle add UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG + +If bundler is not being used to manage dependencies, install the gem by executing: + + $ gem install UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG + +## Usage + +TODO: Write usage instructions here + +## Development + +After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment. + +To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org). + +## Contributing + +Bug reports and merge requests are welcome on GitLab at https://gitlab.com/[USERNAME]/gitlab-secret_detection. \ No newline at end of file diff --git a/gems/gitlab-secret_detection/gitlab-secret_detection.gemspec b/gems/gitlab-secret_detection/gitlab-secret_detection.gemspec new file mode 100644 index 00000000000000..ea436009a0132c --- /dev/null +++ b/gems/gitlab-secret_detection/gitlab-secret_detection.gemspec @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +require_relative "lib/gitlab/secret_detection/version" + +Gem::Specification.new do |spec| + spec.name = "gitlab-secret_detection" + spec.version = Gitlab::SecretDetection::VERSION + spec.authors = ["group::static analysis"] + spec.email = ["eng-dev-secure-static-analysis@gitlab.com"] + + spec.summary = "The gitlab-secret_detection gem performs regex matching on git blobs that may include secrets." + spec.description = "The gitlab-secret_detection gem accepts one or more git blobs, + matches them against a defined ruleset of regular expressions (based on gitleaks.toml used by secrets analyzer), + and returns scan results." + spec.homepage = "https://gitlab.com/gitlab-org/gitlab/-/tree/master/gems/gitlab-secret_detection" + spec.license = "MIT" + spec.required_ruby_version = ">= 3.0" + + spec.metadata["rubygems_mfa_required"] = "true" + spec.metadata["homepage_uri"] = spec.homepage + spec.metadata["source_code_uri"] = spec.homepage + spec.metadata["changelog_uri"] = "https://gitlab.com/gitlab-org/gitlab/-/tree/master/gems/gitlab-secret_detection/CHANGELOG.md" + + spec.files = Dir['lib/**/*.rb'] + spec.require_paths = ["lib"] + + spec.add_development_dependency "pg", "~> 1.5.3" + spec.add_development_dependency "rspec", "~> 3.0" + spec.add_development_dependency "rspec-benchmark", "~> 0.6.0" + spec.add_development_dependency "rspec-parameterized", "~> 1.0" + spec.add_development_dependency "rubocop", "~> 1.50" + spec.add_development_dependency "rubocop-rspec", "~> 2.22" +end diff --git a/gems/gitlab-secret_detection/lib/gitlab/secret_detection.rb b/gems/gitlab-secret_detection/lib/gitlab/secret_detection.rb new file mode 100644 index 00000000000000..813e1aa1a35486 --- /dev/null +++ b/gems/gitlab-secret_detection/lib/gitlab/secret_detection.rb @@ -0,0 +1,9 @@ + +# frozen_string_literal: true + +require_relative "secret_detection/version" + +module Gitlab + module SecretDetection + end +end \ No newline at end of file diff --git a/gems/gitlab-secret_detection/lib/gitlab/secret_detection/version.rb b/gems/gitlab-secret_detection/lib/gitlab/secret_detection/version.rb new file mode 100644 index 00000000000000..0d3e39049fda7e --- /dev/null +++ b/gems/gitlab-secret_detection/lib/gitlab/secret_detection/version.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +module Gitlab + module SecretDetection + VERSION = "0.1.0" + end +end \ No newline at end of file diff --git a/gems/gitlab-secret_detection/spec/gitlab/secret_detection_spec.rb b/gems/gitlab-secret_detection/spec/gitlab/secret_detection_spec.rb new file mode 100644 index 00000000000000..86e37cb7cec16f --- /dev/null +++ b/gems/gitlab-secret_detection/spec/gitlab/secret_detection_spec.rb @@ -0,0 +1,10 @@ + +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Gitlab::SecretDetection do + it "has a version number" do + expect(Gitlab::SecretDetection::VERSION).not_to be_nil + end +end diff --git a/gems/gitlab-secret_detection/spec/spec_helper.rb b/gems/gitlab-secret_detection/spec/spec_helper.rb new file mode 100644 index 00000000000000..5cfcbb3f231972 --- /dev/null +++ b/gems/gitlab-secret_detection/spec/spec_helper.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +require "gitlab/secret_detection" +require 'rspec-parameterized' +require 'pg' + +RSpec.configure do |config| + # Enable flags like --only-failures and --next-failure + config.example_status_persistence_file_path = ".rspec_status" + + # Disable RSpec exposing methods globally on `Module` and `main` + config.disable_monkey_patching! + + Dir['./spec/support/**/*.rb'].each { |f| require f } + + config.expect_with :rspec do |c| + c.syntax = :expect + end +end -- GitLab From a60a9fd19ed1b39090ba27a73d5d899d8c4c9524 Mon Sep 17 00:00:00 2001 From: Serena Fang Date: Tue, 31 Oct 2023 14:55:20 -0500 Subject: [PATCH 02/10] Small lint changes --- gems/gitlab-secret_detection/README.md | 28 +------------------ .../lib/gitlab/secret_detection.rb | 2 +- .../lib/gitlab/secret_detection/version.rb | 2 +- .../spec/spec_helper.rb | 2 +- 4 files changed, 4 insertions(+), 30 deletions(-) diff --git a/gems/gitlab-secret_detection/README.md b/gems/gitlab-secret_detection/README.md index 06e081c17b81c9..cce5a2579a5ef3 100644 --- a/gems/gitlab-secret_detection/README.md +++ b/gems/gitlab-secret_detection/README.md @@ -1,29 +1,3 @@ # Gitlab::SecretDetection -The gitlab-secret_detection gem performs regex matching on git blobs that may include secrets. The gem accepts one or more git blobs, matches them against a defined ruleset of regular expressions (based on gitleaks.toml used by secrets analyzer), and returns scan results. - -## Installation - -TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org. - -Install the gem and add to the application's Gemfile by executing: - - $ bundle add UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG - -If bundler is not being used to manage dependencies, install the gem by executing: - - $ gem install UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG - -## Usage - -TODO: Write usage instructions here - -## Development - -After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment. - -To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org). - -## Contributing - -Bug reports and merge requests are welcome on GitLab at https://gitlab.com/[USERNAME]/gitlab-secret_detection. \ No newline at end of file +The gitlab-secret_detection gem performs regex matching on git blobs that may include secrets. The gem accepts one or more git blobs, matches them against a defined ruleset of regular expressions, and returns scan results. diff --git a/gems/gitlab-secret_detection/lib/gitlab/secret_detection.rb b/gems/gitlab-secret_detection/lib/gitlab/secret_detection.rb index 813e1aa1a35486..8ba04b0bd5835b 100644 --- a/gems/gitlab-secret_detection/lib/gitlab/secret_detection.rb +++ b/gems/gitlab-secret_detection/lib/gitlab/secret_detection.rb @@ -6,4 +6,4 @@ module Gitlab module SecretDetection end -end \ No newline at end of file +end diff --git a/gems/gitlab-secret_detection/lib/gitlab/secret_detection/version.rb b/gems/gitlab-secret_detection/lib/gitlab/secret_detection/version.rb index 0d3e39049fda7e..8fc73a0212160f 100644 --- a/gems/gitlab-secret_detection/lib/gitlab/secret_detection/version.rb +++ b/gems/gitlab-secret_detection/lib/gitlab/secret_detection/version.rb @@ -4,4 +4,4 @@ module Gitlab module SecretDetection VERSION = "0.1.0" end -end \ No newline at end of file +end diff --git a/gems/gitlab-secret_detection/spec/spec_helper.rb b/gems/gitlab-secret_detection/spec/spec_helper.rb index 5cfcbb3f231972..f2865b904a5c15 100644 --- a/gems/gitlab-secret_detection/spec/spec_helper.rb +++ b/gems/gitlab-secret_detection/spec/spec_helper.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require "gitlab/secret_detection" +require 'gitlab/secret_detection' require 'rspec-parameterized' require 'pg' -- GitLab From e059bdd9a935653f3b0265bb83b0b15af771a3eb Mon Sep 17 00:00:00 2001 From: Serena Fang Date: Mon, 6 Nov 2023 13:51:02 -0600 Subject: [PATCH 03/10] Apply reviewer suggestions --- Gemfile | 2 +- gems/gitlab-secret_detection/CHANGELOG.md | 2 +- gems/gitlab-secret_detection/Gemfile.lock | 2 -- gems/gitlab-secret_detection/README.md | 2 +- gems/gitlab-secret_detection/gitlab-secret_detection.gemspec | 1 - .../spec/gitlab/secret_detection_spec.rb | 2 -- 6 files changed, 3 insertions(+), 8 deletions(-) diff --git a/Gemfile b/Gemfile index 3b365e8d155475..21c8f74560fb01 100644 --- a/Gemfile +++ b/Gemfile @@ -43,7 +43,7 @@ group :monorepo do gem 'gitlab-backup-cli', path: 'gems/gitlab-backup-cli', feature_category: :backup_restore end -gem 'gitlab-secret_detection', path: 'gems/gitlab-secret_detection' # rubocop:todo Gemfile/MissingFeatureCategory +gem 'gitlab-secret_detection', path: 'gems/gitlab-secret_detection', feature_category: :secret_detection # Responders respond_to and respond_with gem 'responders', '~> 3.0' # rubocop:todo Gemfile/MissingFeatureCategory diff --git a/gems/gitlab-secret_detection/CHANGELOG.md b/gems/gitlab-secret_detection/CHANGELOG.md index 7213bfcc3f21b7..35648bae90c820 100644 --- a/gems/gitlab-secret_detection/CHANGELOG.md +++ b/gems/gitlab-secret_detection/CHANGELOG.md @@ -1,5 +1,5 @@ ## [Unreleased] -## [0.1.0] - 2023-10-09 +## [0.1.0] - Initial release diff --git a/gems/gitlab-secret_detection/Gemfile.lock b/gems/gitlab-secret_detection/Gemfile.lock index 191448e6d22aea..81cac98a3ffe9c 100644 --- a/gems/gitlab-secret_detection/Gemfile.lock +++ b/gems/gitlab-secret_detection/Gemfile.lock @@ -20,7 +20,6 @@ GEM parser (3.2.2.4) ast (~> 2.4.1) racc - pg (1.5.4) proc_to_ast (0.1.0) coderay parser @@ -89,7 +88,6 @@ PLATFORMS DEPENDENCIES gitlab-secret_detection! - pg (~> 1.5.3) rspec (~> 3.0) rspec-benchmark (~> 0.6.0) rspec-parameterized (~> 1.0) diff --git a/gems/gitlab-secret_detection/README.md b/gems/gitlab-secret_detection/README.md index cce5a2579a5ef3..1e1095b234aa16 100644 --- a/gems/gitlab-secret_detection/README.md +++ b/gems/gitlab-secret_detection/README.md @@ -1,3 +1,3 @@ # Gitlab::SecretDetection -The gitlab-secret_detection gem performs regex matching on git blobs that may include secrets. The gem accepts one or more git blobs, matches them against a defined ruleset of regular expressions, and returns scan results. +The gitlab-secret_detection gem performs keyword and regex matching on git blobs that may include secrets. The gem accepts one or more git blobs, matches them against a defined ruleset of regular expressions, and returns scan results. diff --git a/gems/gitlab-secret_detection/gitlab-secret_detection.gemspec b/gems/gitlab-secret_detection/gitlab-secret_detection.gemspec index ea436009a0132c..3baf59895f71aa 100644 --- a/gems/gitlab-secret_detection/gitlab-secret_detection.gemspec +++ b/gems/gitlab-secret_detection/gitlab-secret_detection.gemspec @@ -24,7 +24,6 @@ Gem::Specification.new do |spec| spec.files = Dir['lib/**/*.rb'] spec.require_paths = ["lib"] - spec.add_development_dependency "pg", "~> 1.5.3" spec.add_development_dependency "rspec", "~> 3.0" spec.add_development_dependency "rspec-benchmark", "~> 0.6.0" spec.add_development_dependency "rspec-parameterized", "~> 1.0" diff --git a/gems/gitlab-secret_detection/spec/gitlab/secret_detection_spec.rb b/gems/gitlab-secret_detection/spec/gitlab/secret_detection_spec.rb index 86e37cb7cec16f..3e9721cd7618ad 100644 --- a/gems/gitlab-secret_detection/spec/gitlab/secret_detection_spec.rb +++ b/gems/gitlab-secret_detection/spec/gitlab/secret_detection_spec.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true -require 'spec_helper' - RSpec.describe Gitlab::SecretDetection do it "has a version number" do expect(Gitlab::SecretDetection::VERSION).not_to be_nil -- GitLab From c56e5859bb55397c994b901dd20f07e3c631d7bd Mon Sep 17 00:00:00 2001 From: Serena Fang Date: Mon, 6 Nov 2023 14:06:11 -0600 Subject: [PATCH 04/10] Remove require pg from spec helper --- gems/gitlab-secret_detection/spec/spec_helper.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/gems/gitlab-secret_detection/spec/spec_helper.rb b/gems/gitlab-secret_detection/spec/spec_helper.rb index f2865b904a5c15..b694e52d2b6a7f 100644 --- a/gems/gitlab-secret_detection/spec/spec_helper.rb +++ b/gems/gitlab-secret_detection/spec/spec_helper.rb @@ -2,7 +2,6 @@ require 'gitlab/secret_detection' require 'rspec-parameterized' -require 'pg' RSpec.configure do |config| # Enable flags like --only-failures and --next-failure -- GitLab From 52e2186750c9b4591fe2b6650f18e63e475a7c92 Mon Sep 17 00:00:00 2001 From: Serena Fang Date: Wed, 8 Nov 2023 12:38:17 -0600 Subject: [PATCH 05/10] Add gem to gitlab ci yml --- .gitlab/ci/gitlab-gems.gitlab-ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitlab/ci/gitlab-gems.gitlab-ci.yml b/.gitlab/ci/gitlab-gems.gitlab-ci.yml index cc8a058d354991..99c9242ee665c2 100644 --- a/.gitlab/ci/gitlab-gems.gitlab-ci.yml +++ b/.gitlab/ci/gitlab-gems.gitlab-ci.yml @@ -32,3 +32,6 @@ include: - local: .gitlab/ci/templates/gem.gitlab-ci.yml inputs: gem_name: "gitlab-backup-cli" + - local: .gitlab/ci/templates/gem.gitlab-ci.yml + inputs: + gem_name: "gitlab-secret_detection" -- GitLab From 74f4c7bfd9ee4c70eb8b47892243a0296838b721 Mon Sep 17 00:00:00 2001 From: Serena Fang Date: Thu, 9 Nov 2023 09:56:43 -0600 Subject: [PATCH 06/10] Update gemfile platform --- gems/gitlab-secret_detection/Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gems/gitlab-secret_detection/Gemfile.lock b/gems/gitlab-secret_detection/Gemfile.lock index 81cac98a3ffe9c..323ab67d8cf630 100644 --- a/gems/gitlab-secret_detection/Gemfile.lock +++ b/gems/gitlab-secret_detection/Gemfile.lock @@ -84,7 +84,7 @@ GEM parser (>= 3.2.2.4) PLATFORMS - arm64-darwin-22 + ruby DEPENDENCIES gitlab-secret_detection! -- GitLab From 7b15ad50d261fff7fa19a8cdc630020652ed7e15 Mon Sep 17 00:00:00 2001 From: Serena Fang Date: Thu, 9 Nov 2023 13:19:07 -0600 Subject: [PATCH 07/10] Add gitlab styles dependency --- gems/gitlab-secret_detection/Gemfile.lock | 40 +++++++++++++++++++ .../gitlab-secret_detection.gemspec | 1 + 2 files changed, 41 insertions(+) diff --git a/gems/gitlab-secret_detection/Gemfile.lock b/gems/gitlab-secret_detection/Gemfile.lock index 323ab67d8cf630..792b77b4af0b2a 100644 --- a/gems/gitlab-secret_detection/Gemfile.lock +++ b/gems/gitlab-secret_detection/Gemfile.lock @@ -6,16 +6,42 @@ PATH GEM remote: https://rubygems.org/ specs: + activesupport (7.1.1) + base64 + bigdecimal + concurrent-ruby (~> 1.0, >= 1.0.2) + connection_pool (>= 2.2.5) + drb + i18n (>= 1.6, < 2) + minitest (>= 5.1) + mutex_m + tzinfo (~> 2.0) ast (2.4.2) + base64 (0.2.0) benchmark-malloc (0.2.0) benchmark-perf (0.6.0) benchmark-trend (0.4.0) + bigdecimal (3.1.4) binding_of_caller (1.0.0) debug_inspector (>= 0.0.1) coderay (1.1.3) + concurrent-ruby (1.2.2) + connection_pool (2.4.1) debug_inspector (1.1.0) diff-lcs (1.5.0) + drb (2.2.0) + ruby2_keywords + gitlab-styles (10.1.0) + rubocop (~> 1.50.2) + rubocop-graphql (~> 0.18) + rubocop-performance (~> 1.15) + rubocop-rails (~> 2.17) + rubocop-rspec (~> 2.22) + i18n (1.14.1) + concurrent-ruby (~> 1.0) json (2.6.3) + minitest (5.20.0) + mutex_m (0.2.0) parallel (1.23.0) parser (3.2.2.4) ast (~> 2.4.1) @@ -25,6 +51,7 @@ GEM parser unparser racc (1.7.1) + rack (3.0.8) rainbow (3.1.1) regexp_parser (2.8.2) rexml (3.2.6) @@ -73,11 +100,23 @@ GEM rubocop (~> 1.41) rubocop-factory_bot (2.24.0) rubocop (~> 1.33) + rubocop-graphql (0.19.0) + rubocop (>= 0.87, < 2) + rubocop-performance (1.19.1) + rubocop (>= 1.7.0, < 2.0) + rubocop-ast (>= 0.4.0) + rubocop-rails (2.22.1) + activesupport (>= 4.2.0) + rack (>= 1.1) + rubocop (>= 1.33.0, < 2.0) rubocop-rspec (2.25.0) rubocop (~> 1.40) rubocop-capybara (~> 2.17) rubocop-factory_bot (~> 2.22) ruby-progressbar (1.13.0) + ruby2_keywords (0.0.5) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) unicode-display_width (2.5.0) unparser (0.6.9) diff-lcs (~> 1.3) @@ -88,6 +127,7 @@ PLATFORMS DEPENDENCIES gitlab-secret_detection! + gitlab-styles (~> 10.1.0) rspec (~> 3.0) rspec-benchmark (~> 0.6.0) rspec-parameterized (~> 1.0) diff --git a/gems/gitlab-secret_detection/gitlab-secret_detection.gemspec b/gems/gitlab-secret_detection/gitlab-secret_detection.gemspec index 3baf59895f71aa..c9b32c2d29975e 100644 --- a/gems/gitlab-secret_detection/gitlab-secret_detection.gemspec +++ b/gems/gitlab-secret_detection/gitlab-secret_detection.gemspec @@ -24,6 +24,7 @@ Gem::Specification.new do |spec| spec.files = Dir['lib/**/*.rb'] spec.require_paths = ["lib"] + spec.add_development_dependency "gitlab-styles", "~> 10.1.0" spec.add_development_dependency "rspec", "~> 3.0" spec.add_development_dependency "rspec-benchmark", "~> 0.6.0" spec.add_development_dependency "rspec-parameterized", "~> 1.0" -- GitLab From 13adf07336b57d5967321384f3b180decdd17e2b Mon Sep 17 00:00:00 2001 From: Serena Fang Date: Thu, 9 Nov 2023 15:51:40 -0600 Subject: [PATCH 08/10] Change bundle version --- gems/gitlab-secret_detection/Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gems/gitlab-secret_detection/Gemfile.lock b/gems/gitlab-secret_detection/Gemfile.lock index 792b77b4af0b2a..035bf231454a38 100644 --- a/gems/gitlab-secret_detection/Gemfile.lock +++ b/gems/gitlab-secret_detection/Gemfile.lock @@ -135,4 +135,4 @@ DEPENDENCIES rubocop-rspec (~> 2.22) BUNDLED WITH - 2.4.21 + 2.4.14 -- GitLab From 124dcbc1f8e4b3476f9c12280c85107a96256658 Mon Sep 17 00:00:00 2001 From: Ross Fuhrman Date: Fri, 10 Nov 2023 14:46:27 -0600 Subject: [PATCH 09/10] Specify version 2.20.2 of rubocop-rails --- gems/gitlab-secret_detection/Gemfile.lock | 2 +- gems/gitlab-secret_detection/lib/gitlab/secret_detection.rb | 1 - .../spec/gitlab/secret_detection_spec.rb | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/gems/gitlab-secret_detection/Gemfile.lock b/gems/gitlab-secret_detection/Gemfile.lock index 035bf231454a38..9cec1d106d76ad 100644 --- a/gems/gitlab-secret_detection/Gemfile.lock +++ b/gems/gitlab-secret_detection/Gemfile.lock @@ -105,7 +105,7 @@ GEM rubocop-performance (1.19.1) rubocop (>= 1.7.0, < 2.0) rubocop-ast (>= 0.4.0) - rubocop-rails (2.22.1) + rubocop-rails (2.20.2) activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 1.33.0, < 2.0) diff --git a/gems/gitlab-secret_detection/lib/gitlab/secret_detection.rb b/gems/gitlab-secret_detection/lib/gitlab/secret_detection.rb index 8ba04b0bd5835b..54e0eb794a37f2 100644 --- a/gems/gitlab-secret_detection/lib/gitlab/secret_detection.rb +++ b/gems/gitlab-secret_detection/lib/gitlab/secret_detection.rb @@ -1,4 +1,3 @@ - # frozen_string_literal: true require_relative "secret_detection/version" diff --git a/gems/gitlab-secret_detection/spec/gitlab/secret_detection_spec.rb b/gems/gitlab-secret_detection/spec/gitlab/secret_detection_spec.rb index 3e9721cd7618ad..112ab8c7468c16 100644 --- a/gems/gitlab-secret_detection/spec/gitlab/secret_detection_spec.rb +++ b/gems/gitlab-secret_detection/spec/gitlab/secret_detection_spec.rb @@ -1,4 +1,3 @@ - # frozen_string_literal: true RSpec.describe Gitlab::SecretDetection do -- GitLab From 216471a79209a8403fe10df6f85dfb83a3f1ed0d Mon Sep 17 00:00:00 2001 From: Ross Fuhrman Date: Mon, 13 Nov 2023 13:51:56 -0600 Subject: [PATCH 10/10] Specify rubocop-rails in the gemspec --- gems/gitlab-secret_detection/Gemfile.lock | 5 +++-- gems/gitlab-secret_detection/gitlab-secret_detection.gemspec | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/gems/gitlab-secret_detection/Gemfile.lock b/gems/gitlab-secret_detection/Gemfile.lock index 9cec1d106d76ad..2f615b24d86a91 100644 --- a/gems/gitlab-secret_detection/Gemfile.lock +++ b/gems/gitlab-secret_detection/Gemfile.lock @@ -6,7 +6,7 @@ PATH GEM remote: https://rubygems.org/ specs: - activesupport (7.1.1) + activesupport (7.1.2) base64 bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) @@ -105,7 +105,7 @@ GEM rubocop-performance (1.19.1) rubocop (>= 1.7.0, < 2.0) rubocop-ast (>= 0.4.0) - rubocop-rails (2.20.2) + rubocop-rails (2.20.0) activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 1.33.0, < 2.0) @@ -132,6 +132,7 @@ DEPENDENCIES rspec-benchmark (~> 0.6.0) rspec-parameterized (~> 1.0) rubocop (~> 1.50) + rubocop-rails (<= 2.20) rubocop-rspec (~> 2.22) BUNDLED WITH diff --git a/gems/gitlab-secret_detection/gitlab-secret_detection.gemspec b/gems/gitlab-secret_detection/gitlab-secret_detection.gemspec index c9b32c2d29975e..ff5121846f4683 100644 --- a/gems/gitlab-secret_detection/gitlab-secret_detection.gemspec +++ b/gems/gitlab-secret_detection/gitlab-secret_detection.gemspec @@ -29,5 +29,6 @@ Gem::Specification.new do |spec| spec.add_development_dependency "rspec-benchmark", "~> 0.6.0" spec.add_development_dependency "rspec-parameterized", "~> 1.0" spec.add_development_dependency "rubocop", "~> 1.50" + spec.add_development_dependency "rubocop-rails", "<= 2.20" # https://github.com/rubocop/rubocop-rails/issues/1173 spec.add_development_dependency "rubocop-rspec", "~> 2.22" end -- GitLab