Gal Katz activity https://gitlab.com/gkatz1 2026-03-19T14:01:47Z tag:gitlab.com,2026-03-19:5222351915 Gal Katz pushed to project branch master at GitLab.org / GitLab 2026-03-19T14:01:47Z gkatz1 Gal Katz

Gal Katz (4ed20a6f) at 19 Mar 14:01

Merge branch 'vpedak-fix-assigned-feature-categories-metrics' into ...

... and 1 more commit

tag:gitlab.com,2026-03-19:5222334973 Gal Katz accepted merge request !227953: Fix feature category in scan profiles metrics at GitLab.org / GitLab 2026-03-19T13:58:20Z gkatz1 Gal Katz

What does this MR do and why?

Fix feature category in the metrics related to Security Scan Profiles

Earlier we identified that scan profiles related components were incorrectly assigned wrong feature category ( #592069 ). This commit assigns the correct feature category to the corresponding metrics.

Fixes: #592069

Discussion: !227536 (comment 3164478674)

We have confirmed with product manager and product analyst.

References

Screenshots or screen recordings

N/A non functional maintenance change.

How to set up and validate locally

N/A non functional maintenance change.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

tag:gitlab.com,2026-03-19:5222328032 Gal Katz approved merge request !227953: Fix feature category in scan profiles metrics at GitLab.org / GitLab 2026-03-19T13:56:53Z gkatz1 Gal Katz

What does this MR do and why?

Fix feature category in the metrics related to Security Scan Profiles

Earlier we identified that scan profiles related components were incorrectly assigned wrong feature category ( #592069 ). This commit assigns the correct feature category to the corresponding metrics.

Fixes: #592069

Discussion: !227536 (comment 3164478674)

We have confirmed with product manager and product analyst.

References

Screenshots or screen recordings

N/A non functional maintenance change.

How to set up and validate locally

N/A non functional maintenance change.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

tag:gitlab.com,2026-03-19:5222328014 Gal Katz commented on merge request !227953 at GitLab.org / GitLab 2026-03-19T13:56:52Z gkatz1 Gal Katz

LGTM 🚀

tag:gitlab.com,2026-03-19:5220109857 Gal Katz commented on merge request !222292 at GitLab.org / GitLab 2026-03-19T02:07:11Z gkatz1 Gal Katz

@mbenayoun Looks much better. I added two small comments, and I agree with @tigerwnz's point about a potential additional N+1, similar to my previous comment in !222292 (comment 3156191644)

tag:gitlab.com,2026-03-19:5220109855 Gal Katz commented on merge request !222292 at GitLab.org / GitLab 2026-03-19T02:07:11Z gkatz1 Gal Katz

Suggestion: This method is doing too much. It's mixing validation, authorization, record lookups, and the actual business logic all in one place.
I usually prefer having basic validation like params[:guidelines].size > MAX_GUIDELINES, Component not found in this project in the mutation level, together with raise_resource_not_available_error! and graphql validation errors.
If you think this service will be reused, we can structure it like:

      def execute
        validation_error = validate
        return validation_error if validation_error

        create_security_context
      rescue ActiveRecord::RecordInvalid => e
        ServiceResponse.error(...)
      end

      def validate
        validate_permission ||
          validate_component ||
          validate_scan || 
          ...
      end

      def validate_permission
        return if Ability.allowed?(current_user, :create_ascp_security_context, project)
        ServiceResponse.error(message: 'Insufficient permissions', reason: :forbidden)
      end
      ...

Might also apply to create_component_service.rb

tag:gitlab.com,2026-03-19:5220109829 Gal Katz commented on merge request !222292 at GitLab.org / GitLab 2026-03-19T02:07:11Z gkatz1 Gal Katz
      def validate_guidelines
        params[:guidelines].each_with_index do |guideline, i|
          error = guideline_error(guideline, i)
          return error if error
        end
      end
tag:gitlab.com,2026-03-18:5219712536 Gal Katz commented on merge request !222292 at GitLab.org / GitLab 2026-03-18T22:42:24Z gkatz1 Gal Katz

Did you consider using BaseService in this MR?
This will allow you to get initialize(project, user = nil, params = {}) and UnauthorizedError = ServiceResponse.error(message: 'You are not authorized to perform this action') for free, and will be consistent with other errors.

tag:gitlab.com,2026-03-18:5219537491 Gal Katz commented on merge request !227565 at GitLab.org / GitLab 2026-03-18T21:22:30Z gkatz1 Gal Katz

Thanks @nrotaru!

Hi @rossfuhrman 👋 Could you please take the maintainer review? Thank you

tag:gitlab.com,2026-03-18:5218417191 Gal Katz commented on merge request !227536 at GitLab.org / GitLab 2026-03-18T16:07:18Z gkatz1 Gal Katz

LGTM! 🚀

tag:gitlab.com,2026-03-18:5218416258 Gal Katz approved merge request !227536: Fix feature category for scan profiles backend components at GitLab.org / GitLab 2026-03-18T16:07:08Z gkatz1 Gal Katz

What does this MR do and why?

The scan profile related components were incorrectly categorised under the security_asset_inventories feature category, wheres they should be under the security_testing_configuration.

Fix the assigned feature category for scan profile backend components

  • Updated the feature category assignment for all scan profile related backend components from security_asset_inventories to security_testing_configuration to properly reflect their functionality and purpose
  • Updated the auto-generated docs by running bundle exec rake gitlab:custom_roles:compile_docs
  • Updated workers definitions but running a rake task as linter suggested

Fixes: #592069

References

Screenshots or screen recordings

N/A. It is a maintenance backend change.

How to set up and validate locally

N/A. It is a maintenance backend change.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

tag:gitlab.com,2026-03-18:5218261550 Gal Katz approved merge request !227103: Create security_scan_profile_project_statuses table and model at GitLab.org / GitLab 2026-03-18T15:34:23Z gkatz1 Gal Katz

What does this MR do and why?

Adds the security_scan_profile_project_statuses table and Security::ScanProfileProjectStatus model to persist profile-specific scan status per project per scan type.

The existing analyzer_project_statuses table tracks inventory-level status across all enablement methods and must not be modified. This new table stores profile-scoped status separately, enabling scanner health indicators for security profiles.

Closes #593131

Implementation details

  • Migration creates security_scan_profile_project_statuses on the gitlab_sec database with:
    • Unique index on [project_id, scan_type] (upsert target for future status update service)
    • Index on security_scan_profile_id (FK lookup)
    • Index on build_id (required for loose FK cleanup)
    • Direct FK to security_scan_profiles with cascade delete (same database)
    • Loose FKs for project_id (async_delete) and build_id (async_nullify) for cross-database references, matching the pattern used by analyzer_project_statuses
  • Model inherits from SecApplicationRecord and provides three computed helpers:
    • stale? — true when status is not not_configured, last_scan_at is present, and older than 90 days
    • active? — true when success? and not stale
    • profile_failed? — true when failed? and consecutive_failure_count >= 3
  • Associations added:
    • Security::ScanProfilehas_many :security_scan_profile_project_statuses
    • EE::Projecthas_many :security_scan_profile_project_statuses
  • Import/Export — registered security_scan_profile_project_statuses in all_models.yml (not exported, status is runtime data)

Cross-database considerations

Column Target DB Strategy
project_id gitlab_main Loose FK with async_delete
build_id gitlab_ci Loose FK with async_nullify (via CiPipelinesBuildsCleanupCronWorker)
security_scan_profile_id gitlab_sec Direct FK with on_delete: :cascade

MR acceptance checklist

  • Tests added for model validations, enums, scopes, computed helpers, and loose FK cleanup
  • Migration is safe (single create_table, no data migration, no locks on existing tables)
  • Loose FK configuration validated (spec/lib/gitlab/database/loose_foreign_keys_spec.rb passes)
  • All loose FK columns have indexes (build_id, project_id, security_scan_profile_id)
  • Model registered in all_models.yml for Import/Export awareness
  • No changes to existing analyzer_project_statuses or inventory behavior
  • RuboCop passes on all changed files

Changelog: added
EE: true

tag:gitlab.com,2026-03-18:5218150111 Gal Katz commented on merge request !227028 at GitLab.org / GitLab 2026-03-18T15:11:53Z gkatz1 Gal Katz

Thanks @nrotaru! Looks better. I added two small comments 🏓

tag:gitlab.com,2026-03-18:5218150083 Gal Katz commented on merge request !227028 at GitLab.org / GitLab 2026-03-18T15:11:52Z gkatz1 Gal Katz

Looks much better!

tag:gitlab.com,2026-03-18:5218150065 Gal Katz commented on merge request !227028 at GitLab.org / GitLab 2026-03-18T15:11:52Z gkatz1 Gal Katz
      it 'sets security_scan_profiles source for non-policy jobs' do
        pipeline = execute.payload
        sources = pipeline.builds.map do |build|
          Ci::BuildSource.find_by!(build_id: build.id, project_id: project.id).source
        end

        non_policy_sources = sources - %w[pipeline_execution_policy scan_execution_policy]
        expect(non_policy_sources).to be_present
        expect(non_policy_sources).to all(eq('security_scan_profiles'))
      end
tag:gitlab.com,2026-03-18:5218150049 Gal Katz commented on merge request !227028 at GitLab.org / GitLab 2026-03-18T15:11:52Z gkatz1 Gal Katz

Suggestion: Can be removed as this feature is already enabled by default.

tag:gitlab.com,2026-03-18:5218150022 Gal Katz commented on merge request !227028 at GitLab.org / GitLab 2026-03-18T15:11:52Z gkatz1 Gal Katz

Suggestion: What do you think about moving the service initialization into the context? I believe it will be cleaner and make things easier to extend in the future

tag:gitlab.com,2026-03-18:5217711928 Gal Katz commented on merge request !227028 at GitLab.org / GitLab 2026-03-18T13:48:54Z gkatz1 Gal Katz

Question: Why do we need attr_accessor :scan_profile_eligibility_service? scan_profile_context holds the eligibility service now

tag:gitlab.com,2026-03-18:5217369751 Gal Katz commented on merge request !227536 at GitLab.org / GitLab 2026-03-18T12:39:20Z gkatz1 Gal Katz

Thanks for the input @rossfuhrman! Sounds good.