Model changes for vulnerability_reads.owasp_top_10
What does this MR do and why?
Vulnerabilities::Read
model addition to support owasp_top_10
column introduced via !138039 (merged)
Related to #419092 (closed)
How to set up and validate locally
In rails console we should observe the validation errors and for AR save it populates correct enum map value like below on PostGres.
> vulnerability_read = Vulnerabilities::Read.last
> vulnerability_read.owasp_top_10 = 'A1:2021-Injection'
> vulnerability_read.save!
pry(main)> vulnerability_read.owasp_top_10 = 'A1:2021-Injection'
ArgumentError: 'A1:2021-Injection' is not a valid owasp_top_10
> vulnerability_read = Vulnerabilities::Read.last
> vulnerability_read.owasp_top_10 = 'A10:2017-Insufficient Logging & Monitoring'
> vulnerability_read.save!
> gdk psql
gitlabhq_development=# select owasp_top_10 from vulnerability_reads order by id desc limit 1;
owasp_top_10
--------------
10
(1 row)
# reset the value
> vulnerability_read = Vulnerabilities::Read.last
> vulnerability_read.update!(:owasp_top_10 => nil)
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 #419092 (closed)
Edited by Bala Kumar