Skip to content

Add send code with prompt checkbox to Explain Vulnerability

Daniel Tian requested to merge 418855-add-send-code-with-prompt-checkbox into master

What does this MR do and why?

This MR adds a Send code with prompt checkbox on the vulnerability details page for the Explain Vulnerability feature:

ksnip_20230723-114714

On page load while the prompt is still loading, the checkbox will be indeterminate and disabled, and the Try it out button will be disabled:

ksnip_20230723-114927

Once the prompt is loaded, if there is a prompt with source code, the checkbox is checked by default. If there is no prompt with source code or if there was an error loading the prompt, the checkbox is unchecked and disabled:

With source code prompt Without source code prompt
ksnip_20230723-115038 ksnip_20230723-115057

Note that disabling the checkbox is temporary until we complete #417078 (closed) and #417079 (closed).

Checking and unchecking the checkbox will toggle between showing the source code prompt and non-source code prompt in the Show prompt accordion:

Peek_2023-07-23_12-27

Hovering over or clicking the i icon will show a popover tooltip with no delay. The tooltip can be hidden by hovering out, clicking off, or clicking the close icon:

Peek_2023-07-23_12-26

How to verify locally

  • Enable the openai_experimentation, explain_vulnerability, and explain_vulnerability_vertex feature flags.
  • Clone this project locally: https://gitlab.com/gitlab-org/security-products/tests/webgoat.net
  • Run a pipeline against the master branch.
  • Go to Security & Compliance -> Vulnerability Report.
  • Click on any vulnerability to go to the vulnerability details page (they are all SAST vulnerabilities). Verify that the Explain this vulnerability section has the Send code with prompt checkbox.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #418855 (closed)

Edited by Daniel Tian

Merge request reports

Loading