Add security policy yml validation
What does this MR do and why?
Add security policy yml validation for .gitlab/security-policies/policy.yml
file
- for single file editor
- conditionally register security policy schema for single file editor
- do not toggle security policy schema on/off dynamically for if a user changes a filepath because it is an unlikely scenario
- rename security policy schema for the policy editor to
SecurityPolicyEditorSchema
to prevent namespace collisions - pass up
project.full_path
from the backend - move shared util methods from
ee/...
to~/editor/utils
and update their names - condense security policy extension for CE and EE into one CE file
- use fileMatch
field to apply a schema to a file at a particular path (e.g. /.gitlab/security-policies/policy.yml
) and nowhere else (examples in monaco-yaml and the description of fileMatch
in the docs)
Changelog: added
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
File | Screenshots |
---|---|
.gitlab/security-policies/policy.yml file |
|
other yml file |
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
- Navigate to a project/group => Security => Policies => New policy => Create a new policy of any type => Merge the MR
- Navigate to the project created by creating the new policy => .gitlab/security-policies/policy.yml
- Verify the schema has been applied (e.g. hover over some properties, modify others)
- Navigate to another yml file
- Verify the schema has not been applied
- Navigate to another non-yml file
- Verify the schema has not been applied
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #369006 (closed)
Edited by Alexander Turinske