diff --git a/.gitlab/ci/rules.gitlab-ci.yml b/.gitlab/ci/rules.gitlab-ci.yml index ccdc2c1b90a..22e4b181c0e 100644 --- a/.gitlab/ci/rules.gitlab-ci.yml +++ b/.gitlab/ci/rules.gitlab-ci.yml @@ -1456,6 +1456,24 @@ - <<: *if-merge-request changes: *ci-patterns +.semgrep-appsec-custom-rules:rules: + rules: + - <<: *if-not-ee + when: never + - <<: *if-merge-request + changes: *code-backstage-qa-patterns + +.ping-appsec-for-sast-findings:rules: + rules: + # Requiring $CUSTOM_SAST_RULES_BOT_PAT prevents the bot from running on forks or CE + # Without it the script would fail too. + - if: "$CUSTOM_SAST_RULES_BOT_PAT == null" + when: never + - <<: *if-not-ee + when: never + - <<: *if-merge-request + changes: *code-backstage-qa-patterns + ####################### # Vendored gems rules # ####################### diff --git a/.gitlab/ci/static-analysis.gitlab-ci.yml b/.gitlab/ci/static-analysis.gitlab-ci.yml index e1257e778bd..0fda3872500 100644 --- a/.gitlab/ci/static-analysis.gitlab-ci.yml +++ b/.gitlab/ci/static-analysis.gitlab-ci.yml @@ -152,3 +152,39 @@ feature-flags-usage: when: always paths: - tmp/feature_flags/ + +semgrep-appsec-custom-rules: + stage: lint + extends: + - .semgrep-appsec-custom-rules:rules + image: returntocorp/semgrep + needs: [] + script: + # Required to avoid a timeout https://github.com/returntocorp/semgrep/issues/5395 + - git fetch origin master + # Include/exclude list isn't ideal https://github.com/returntocorp/semgrep/issues/5399 + - | + semgrep ci --gitlab-sast --metrics off --config $CUSTOM_RULES_URL \ + --include app --include lib --include workhorse \ + --exclude '*_test.go' --exclude spec --exclude qa > gl-sast-report.json || true + variables: + CUSTOM_RULES_URL: https://gitlab.com/gitlab-com/gl-security/appsec/sast-custom-rules/-/raw/main/appsec-pings/rules.yml + artifacts: + paths: + - gl-sast-report.json + reports: + sast: gl-sast-report.json + +ping-appsec-for-sast-findings: + stage: lint + image: alpine:latest + extends: + - .ping-appsec-for-sast-findings:rules + variables: + # Project Access Token bot ID for /gitlab-com/gl-security/appsec/sast-custom-rules + BOT_USER_ID: 11727358 + needs: + - semgrep-appsec-custom-rules + script: + - apk add jq curl + - scripts/process_custom_semgrep_results.sh diff --git a/.rubocop.yml b/.rubocop.yml index 47c7e5b5e35..e4b46121df6 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -779,3 +779,6 @@ Migration/BackgroundMigrationBaseClass: Style/ClassAndModuleChildren: Enabled: true + +Fips/OpenSSL: + Enabled: false diff --git a/.rubocop_todo/fips/open_ssl.yml b/.rubocop_todo/fips/open_ssl.yml deleted file mode 100644 index 03a551112ab..00000000000 --- a/.rubocop_todo/fips/open_ssl.yml +++ /dev/null @@ -1,222 +0,0 @@ ---- -# Cop supports --auto-correct. -Fips/OpenSSL: - Exclude: - - 'app/controllers/application_controller.rb' - - 'app/controllers/concerns/authenticates_with_two_factor.rb' - - 'app/controllers/projects/merge_requests/diffs_controller.rb' - - 'app/controllers/projects/merge_requests_controller.rb' - - 'app/helpers/application_helper.rb' - - 'app/models/ci/artifact_blob.rb' - - 'app/models/concerns/analytics/cycle_analytics/stage.rb' - - 'app/models/concerns/checksummable.rb' - - 'app/models/concerns/token_authenticatable_strategies/encryption_helper.rb' - - 'app/models/diff_discussion.rb' - - 'app/models/discussion.rb' - - 'app/models/legacy_diff_note.rb' - - 'app/models/namespace.rb' - - 'app/models/note.rb' - - 'app/models/performance_monitoring/prometheus_panel.rb' - - 'app/models/protected_branch.rb' - - 'app/models/release_highlight.rb' - - 'app/models/repository.rb' - - 'app/models/resource_event.rb' - - 'app/models/snippet.rb' - - 'app/models/storage/hashed.rb' - - 'app/models/token_with_iv.rb' - - 'app/presenters/packages/composer/packages_presenter.rb' - - 'app/services/ci/build_report_result_service.rb' - - 'app/services/metrics/dashboard/transient_embed_service.rb' - - 'app/services/packages/debian/generate_distribution_service.rb' - - 'app/services/packages/go/create_package_service.rb' - - 'app/services/packages/maven/metadata/append_package_file_service.rb' - - 'app/services/packages/rubygems/create_gemspec_service.rb' - - 'app/services/pages/migrate_legacy_storage_to_deployment_service.rb' - - 'app/services/projects/lfs_pointers/lfs_download_service.rb' - - 'app/uploaders/ci/secure_file_uploader.rb' - - 'config/initializers/doorkeeper_openid_connect.rb' - - 'config/initializers/session_store.rb' - - 'config/settings.rb' - - 'db/post_migrate/20210731132939_backfill_stage_event_hash.rb' - - 'ee/app/models/storage_shard.rb' - - 'ee/app/services/elastic/bookkeeping_shard_service.rb' - - 'ee/app/services/security/track_scan_service.rb' - - 'ee/app/services/vulnerabilities/create_service_base.rb' - - 'ee/app/services/vulnerabilities/manually_create_service.rb' - - 'ee/app/services/vulnerabilities/starboard_vulnerability_create_service.rb' - - 'ee/lib/ee/gitlab/background_migration/populate_latest_pipeline_ids.rb' - - 'ee/lib/ee/gitlab/background_migration/populate_resolved_on_default_branch_column.rb' - - 'ee/lib/ee/gitlab/background_migration/recalculate_vulnerability_finding_signatures_for_findings.rb' - - 'ee/lib/gitlab/analytics/cycle_analytics/stage_events/label_based_stage_event.rb' - - 'ee/lib/gitlab/ci/reports/dependency_list/dependency.rb' - - 'ee/lib/gitlab/ci/reports/security/remediation.rb' - - 'ee/lib/gitlab/geo/replication/blob_downloader.rb' - - 'ee/spec/factories/vulnerabilities/feedback.rb' - - 'ee/spec/factories/vulnerabilities/finding_signatures.rb' - - 'ee/spec/factories/vulnerabilities/remediations.rb' - - 'ee/spec/finders/security/pipeline_vulnerabilities_finder_spec.rb' - - 'ee/spec/lib/ee/gitlab/alert_management/payload/generic_spec.rb' - - 'ee/spec/lib/ee/gitlab/background_migration/populate_uuids_for_security_findings_spec.rb' - - 'ee/spec/lib/ee/gitlab/background_migration/recalculate_vulnerability_finding_signatures_for_findings_spec.rb' - - 'ee/spec/lib/ee/gitlab/background_migration/update_vulnerability_occurrences_location_spec.rb' - - 'ee/spec/lib/gitlab/analytics/cycle_analytics/stage_events/issue_label_added_spec.rb' - - 'ee/spec/lib/gitlab/analytics/cycle_analytics/stage_events/issue_label_removed_spec.rb' - - 'ee/spec/lib/gitlab/analytics/cycle_analytics/stage_events/merge_request_label_added_spec.rb' - - 'ee/spec/lib/gitlab/analytics/cycle_analytics/stage_events/merge_request_label_removed_spec.rb' - - 'ee/spec/lib/gitlab/ci/reports/security/locations/cluster_image_scanning_spec.rb' - - 'ee/spec/lib/gitlab/ci/reports/security/locations/container_scanning_spec.rb' - - 'ee/spec/lib/gitlab/ci/reports/security/locations/dast_spec.rb' - - 'ee/spec/lib/gitlab/ci/reports/security/locations/dependency_scanning_spec.rb' - - 'ee/spec/migrations/update_vulnerability_occurrences_location_spec.rb' - - 'ee/spec/models/merge_train_spec.rb' - - 'ee/spec/models/resource_weight_event_spec.rb' - - 'ee/spec/models/vulnerabilities/finding_signature_spec.rb' - - 'ee/spec/models/vulnerabilities/finding_spec.rb' - - 'ee/spec/services/alert_management/process_prometheus_alert_service_spec.rb' - - 'ee/spec/services/merge_trains/check_status_service_spec.rb' - - 'ee/spec/services/projects/alerting/notify_service_spec.rb' - - 'ee/spec/services/security/ingestion/tasks/ingest_identifiers_spec.rb' - - 'ee/spec/services/security/ingestion/tasks/ingest_remediations_spec.rb' - - 'ee/spec/services/security/override_uuids_service_spec.rb' - - 'ee/spec/services/security/track_scan_service_spec.rb' - - 'ee/spec/services/vulnerabilities/manually_create_service_spec.rb' - - 'ee/spec/support/matchers/locked_schema.rb' - - 'lib/api/files.rb' - - 'lib/api/maven_packages.rb' - - 'lib/atlassian/jira_connect/serializers/branch_entity.rb' - - 'lib/container_registry/client.rb' - - 'lib/extracts_path.rb' - - 'lib/gitlab/alert_management/fingerprint.rb' - - 'lib/gitlab/analytics/cycle_analytics/stage_events/stage_event.rb' - - 'lib/gitlab/background_migration/backfill_note_discussion_id.rb' - - 'lib/gitlab/background_migration/backfill_project_repositories.rb' - - 'lib/gitlab/ci/pipeline/seed/build/cache.rb' - - 'lib/gitlab/ci/reports/security/finding.rb' - - 'lib/gitlab/ci/reports/security/finding_signature.rb' - - 'lib/gitlab/ci/reports/security/identifier.rb' - - 'lib/gitlab/ci/reports/security/locations/base.rb' - - 'lib/gitlab/ci/reports/test_case.rb' - - 'lib/gitlab/color.rb' - - 'lib/gitlab/composer/version_index.rb' - - 'lib/gitlab/crypto_helper.rb' - - 'lib/gitlab/database/migration_helpers.rb' - - 'lib/gitlab/database/migration_helpers/v2.rb' - - 'lib/gitlab/database/partitioning_migration_helpers/foreign_key_helpers.rb' - - 'lib/gitlab/database/schema_helpers.rb' - - 'lib/gitlab/database/schema_migrations/migrations.rb' - - 'lib/gitlab/database/unidirectional_copy_trigger.rb' - - 'lib/gitlab/diff/file.rb' - - 'lib/gitlab/diff/formatters/base_formatter.rb' - - 'lib/gitlab/diff/position.rb' - - 'lib/gitlab/experimentation/controller_concern.rb' - - 'lib/gitlab/git.rb' - - 'lib/gitlab/git/branch.rb' - - 'lib/gitlab/git/lfs_pointer_file.rb' - - 'lib/gitlab/git/tag.rb' - - 'lib/gitlab/hashed_path.rb' - - 'lib/gitlab/insecure_key_fingerprint.rb' - - 'lib/gitlab/sidekiq_middleware/duplicate_jobs/duplicate_job.rb' - - 'lib/gitlab/slug/environment.rb' - - 'lib/gitlab/verify/job_artifacts.rb' - - 'lib/json_web_token/rsa_token.rb' - - 'lib/tasks/gitlab/assets.rake' - - 'lib/tasks/tanuki_emoji.rake' - - 'qa/qa/service/praefect_manager.rb' - - 'qa/qa/specs/features/browser_ui/6_release/deploy_key/clone_using_deploy_key_spec.rb' - - 'qa/qa/specs/features/ee/browser_ui/1_manage/group/group_saml_non_enforced_sso_spec.rb' - - 'scripts/security-harness' - - 'spec/components/diffs/stats_component_spec.rb' - - 'spec/controllers/projects/blob_controller_spec.rb' - - 'spec/factories/ci/job_artifacts.rb' - - 'spec/factories/ci/reports/security/finding_keys.rb' - - 'spec/factories/ci/unit_test.rb' - - 'spec/factories/commit_signature/gpg_signature.rb' - - 'spec/factories/commit_signature/ssh_signature.rb' - - 'spec/factories/commit_signature/x509_commit_signature.rb' - - 'spec/factories/design_management/designs.rb' - - 'spec/factories/diff_position.rb' - - 'spec/factories/gitaly/commit.rb' - - 'spec/factories/merge_request_context_commit.rb' - - 'spec/factories/merge_request_context_commit_diff_file.rb' - - 'spec/factories/merge_request_diff_commits.rb' - - 'spec/factories/merge_request_diffs.rb' - - 'spec/factories/pages_deployments.rb' - - 'spec/factories/sequences.rb' - - 'spec/factories/token_with_ivs.rb' - - 'spec/features/file_uploads/git_lfs_spec.rb' - - 'spec/features/merge_request/user_sees_diff_spec.rb' - - 'spec/features/merge_request/user_suggests_changes_on_diff_spec.rb' - - 'spec/finders/merge_requests/oldest_per_commit_finder_spec.rb' - - 'spec/lib/gitlab/alert_management/fingerprint_spec.rb' - - 'spec/lib/gitlab/alert_management/payload/base_spec.rb' - - 'spec/lib/gitlab/alert_management/payload/generic_spec.rb' - - 'spec/lib/gitlab/alert_management/payload/prometheus_spec.rb' - - 'spec/lib/gitlab/background_migration/backfill_note_discussion_id_spec.rb' - - 'spec/lib/gitlab/background_migration/populate_vulnerability_reads_spec.rb' - - 'spec/lib/gitlab/ci/reports/security/finding_signature_spec.rb' - - 'spec/lib/gitlab/ci/reports/security/locations/sast_spec.rb' - - 'spec/lib/gitlab/ci/reports/security/locations/secret_detection_spec.rb' - - 'spec/lib/gitlab/ci/reports/test_case_spec.rb' - - 'spec/lib/gitlab/crypto_helper_spec.rb' - - 'spec/lib/gitlab/database/migration_helpers_spec.rb' - - 'spec/lib/gitlab/database/schema_migrations/migrations_spec.rb' - - 'spec/lib/gitlab/diff/file_spec.rb' - - 'spec/lib/gitlab/diff/position_spec.rb' - - 'spec/lib/gitlab/diff/position_tracer/image_strategy_spec.rb' - - 'spec/lib/gitlab/diff/position_tracer/line_strategy_spec.rb' - - 'spec/lib/gitlab/experimentation/controller_concern_spec.rb' - - 'spec/lib/gitlab/git/branch_spec.rb' - - 'spec/lib/gitlab/git/tag_spec.rb' - - 'spec/lib/gitlab/sidekiq_middleware/duplicate_jobs/duplicate_job_spec.rb' - - 'spec/lib/gitlab/slug/environment_spec.rb' - - 'spec/migrations/20220107064845_populate_vulnerability_reads_spec.rb' - - 'spec/migrations/20220524074947_finalize_backfill_null_note_discussion_ids_spec.rb' - - 'spec/migrations/delete_security_findings_without_uuid_spec.rb' - - 'spec/migrations/schedule_recalculate_vulnerability_finding_signatures_for_findings_spec.rb' - - 'spec/models/ci/artifact_blob_spec.rb' - - 'spec/models/ci/job_artifact_spec.rb' - - 'spec/models/ci/pipeline_spec.rb' - - 'spec/models/ci/secure_file_spec.rb' - - 'spec/models/ci/unit_test_spec.rb' - - 'spec/models/concerns/checksummable_spec.rb' - - 'spec/models/concerns/token_authenticatable_strategies/encryption_helper_spec.rb' - - 'spec/models/design_management/version_spec.rb' - - 'spec/models/diff_discussion_spec.rb' - - 'spec/models/discussion_spec.rb' - - 'spec/models/lfs_object_spec.rb' - - 'spec/models/merge_request_diff_spec.rb' - - 'spec/models/merge_request_spec.rb' - - 'spec/models/note_spec.rb' - - 'spec/models/pages_deployment_spec.rb' - - 'spec/models/performance_monitoring/prometheus_panel_spec.rb' - - 'spec/models/project_spec.rb' - - 'spec/models/release_highlight_spec.rb' - - 'spec/models/repository_spec.rb' - - 'spec/models/token_with_iv_spec.rb' - - 'spec/models/upload_spec.rb' - - 'spec/requests/api/ci/runner/jobs_artifacts_spec.rb' - - 'spec/requests/api/ci/secure_files_spec.rb' - - 'spec/requests/openid_connect_spec.rb' - - 'spec/services/dependency_proxy/find_cached_manifest_service_spec.rb' - - 'spec/services/dependency_proxy/head_manifest_service_spec.rb' - - 'spec/services/dependency_proxy/request_token_service_spec.rb' - - 'spec/services/import_export_clean_up_service_spec.rb' - - 'spec/services/pages/migrate_legacy_storage_to_deployment_service_spec.rb' - - 'spec/services/projects/after_rename_service_spec.rb' - - 'spec/services/projects/create_service_spec.rb' - - 'spec/services/projects/lfs_pointers/lfs_download_service_spec.rb' - - 'spec/support/helpers/workhorse_helpers.rb' - - 'spec/support/migrations_helpers/vulnerabilities_findings_helper.rb' - - 'spec/support/shared_examples/lib/gitlab/ci/ci_trace_shared_examples.rb' - - 'spec/support/shared_examples/lib/gitlab/cycle_analytics/event_shared_examples.rb' - - 'spec/support/shared_examples/lib/gitlab/position_formatters_shared_examples.rb' - - 'spec/support/shared_examples/services/alert_management/alert_processing/alert_firing_shared_examples.rb' - - 'spec/support/shared_examples/services/alert_management/alert_processing/alert_recovery_shared_examples.rb' - - 'spec/support/shared_examples/services/metrics/dashboard_shared_examples.rb' - - 'spec/support/shared_examples/services/packages/debian/generate_distribution_shared_examples.rb' - - 'spec/support/shared_examples/uploaders/object_storage_shared_examples.rb' - - 'spec/support/trace/trace_helpers.rb' - - 'spec/uploaders/ci/secure_file_uploader_spec.rb' - - 'spec/uploaders/job_artifact_uploader_spec.rb' - - 'spec/validators/sha_validator_spec.rb' - - 'spec/workers/update_head_pipeline_for_merge_request_worker_spec.rb' diff --git a/GITALY_SERVER_VERSION b/GITALY_SERVER_VERSION index 7144b774b05..b60ef3d1d5d 100644 --- a/GITALY_SERVER_VERSION +++ b/GITALY_SERVER_VERSION @@ -1 +1 @@ -5caf724a8305ea04370dc49f0d9a7d5f3bc8dd4a +2b069d8536df98547acba92719b7554d1c7f2262 diff --git a/Gemfile b/Gemfile index 195a4b2861b..aad6cbc551d 100644 --- a/Gemfile +++ b/Gemfile @@ -407,7 +407,7 @@ group :development, :test do end group :development, :test, :danger do - gem 'gitlab-dangerfiles', '~> 3.4.0', require: false + gem 'gitlab-dangerfiles', '~> 3.3.0', require: false end group :development, :test, :coverage do diff --git a/Gemfile.lock b/Gemfile.lock index dab51a0803c..de2646f7d9c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -475,7 +475,7 @@ GEM terminal-table (~> 1.5, >= 1.5.1) gitlab-chronic (0.10.5) numerizer (~> 0.2) - gitlab-dangerfiles (3.4.0) + gitlab-dangerfiles (3.3.0) danger (>= 8.4.5) danger-gitlab (>= 8.0.0) rake @@ -1534,7 +1534,7 @@ DEPENDENCIES gitaly (~> 15.1.0.pre.rc1) github-markup (~> 1.7.0) gitlab-chronic (~> 0.10.5) - gitlab-dangerfiles (~> 3.4.0) + gitlab-dangerfiles (~> 3.3.0) gitlab-experiment (~> 0.7.1) gitlab-fog-azure-rm (~> 1.3.0) gitlab-labkit (~> 0.23.0) diff --git a/app/assets/javascripts/diffs/components/commit_item.vue b/app/assets/javascripts/diffs/components/commit_item.vue index 54b648e8d03..ad163a2a615 100644 --- a/app/assets/javascripts/diffs/components/commit_item.vue +++ b/app/assets/javascripts/diffs/components/commit_item.vue @@ -134,7 +134,9 @@ export default { class="avatar-cell d-none d-sm-block" /> -