Add securityAiFlowFeedbackCreate mutation for AI flow feedback

What does this MR do and why?

The feedback component in the frontend needs an API to send feedback to. This MR exposes the feedback service from !265540 (merged) through GraphQL:

  • Adds an experimental securityAiFlowFeedbackCreate mutation that takes a vulnerability ID, a sentiment and optional reasons. It calls Vulnerabilities::SecurityAiFlowFeedbacks::CreateService.
  • Access follows the vulnerability's project. A missing vulnerability, a project the user can't read, and a disabled feature flag all return the same error.
  • Adds the fine-grained token permission create_security_ai_flow_feedback.
  • About 290 lines are generated docs and introspection_result.json.

The design and decisions are in #636350 (closed).

References

How to set up and validate locally

  1. In the Rails console, enable the flag: Feature.enable(:security_ai_flow_feedback, project).

  2. Make sure the Duo Agent Platform is available for the project.

  3. Pick a SAST vulnerability whose latest flag has origin ai_sast_fp_detection.

  4. In GraphiQL (/-/graphql-explorer), run:

    mutation {
      securityAiFlowFeedbackCreate(input: { vulnerabilityId: "gid://gitlab/Vulnerability/<id>", sentiment: DISAGREE, reasons: [VERDICT_WRONG] }) {
        errors
      }
    }
  5. Watch for the event with bundle exec rake gitlab:internal_events:monitor[submit_security_ai_flow_feedback].

  6. Try AGREE with reasons, or six reasons. Both return an error and emit no event.

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.

Edited by AJ Biton

Merge request reports

Loading
Loading