Add corpus create mutation and service
What does this MR do and why?
This MR will allow the frontend to create the corpus record for a package. This MR is the part of the epic &5017 (closed)
FE will have to supply package_id and an associated corpus record will be created for the package. We are going to show the corpus packages in the next screen. Design can be viewed here.
Steps to test and screenshots of dev testing
- Enable flag ee/config/feature_flags/development/corpus_management.yml
- Run the following mutation with a valid project path and package. The
package.project_id
andpackageID
should be same.
Create Mutation
mutation CorpusCreate($input: CorpusCreateInput!) {
corpusCreate(input: $input) {
errors
}
}
{
"input": {
"packageId": "gid://gitlab/Packages::Package/2",
"fullPath": "gitlab-org/gitlab-test"
}
}
- Response should not contain an error and you can check in rails console the corpus record
[42] pry(main)> AppSec::Fuzzing::Coverage::Corpus.last
AppSec::Fuzzing::Coverage::Corpus Load (0.4ms) SELECT "coverage_fuzzing_corpuses".* FROM "coverage_fuzzing_corpuses" ORDER BY "coverage_fuzzing_corpuses"."id" DESC LIMIT 1
=> #<AppSec::Fuzzing::Coverage::Corpus:0x00007fc6505cee78
id: 9,
project_id: 1,
user_id: 1,
package_id: 1,
file_updated_at: Fri, 08 Oct 2021 11:12:36.685846000 UTC +00:00,
created_at: Fri, 08 Oct 2021 11:12:36.693666000 UTC +00:00,
updated_at: Fri, 08 Oct 2021 11:12:36.693666000 UTC +00:00>
These are strongly recommended to assist reviewers and reduce the time to merge your change.
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 #341485 (closed)
Edited by Aditya Tiwari