Cron syntax in a SEP is modified when switching from yaml to rule mode
Summary
When a user is creating a scan execution policy (SEP), the yaml inputed into yaml mode is modified when switching to rule mode
Steps to reproduce
- Upload an GitLab Ultimate license
- Navigate to https://staging.gitlab.com/govern-team-test/cnp-alert-demo/-/security/policies/new?type=scan_execution_policy\
- Navigate to yaml mode
- Paste in the below policy, which has valid cron syntax
type: scan_execution_policy
name: Test
description: ''
enabled: true
rules:
- type: schedule
branches: []
cadence: */5 0 * * *
actions:
- scan: dast
site_profile: ''
scanner_profile: ''
tags: []
- Navigate to rule mode
- Navigate back to yaml mode
Example Project
What is the current bug behavior?
When a user navigates from yaml mode to rule mode, the cron syntax is changed. When the user navigates back to yaml mode, the syntax highlighting complains about the modified yaml.
What is the expected correct behavior?
When a user navigates from yaml mode to rule mode, the cron syntax is not changed. When the user navigates back to yaml mode, the syntax highlighting does not indicate there is a problem with valid cron syntax
Possible fixes
-
frontend ensure the cron syntax is always wrapped in single quotes ( '), which is required for valid yaml syntax as per the schema (security_orchestration_policy.json#L74)
Edited by Alexander Turinske