Concatenated Scan names on gitlabCI #41
                
     Open
            
            
          
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Problem Explanation:
The current implementation of the integration between Checkmarx Scan via ast/cli Docker image inside a gitlab CICD pipeline does not take consideration about projects that are called the same, but they are located in differents "PATH" on Gitlab. ex. Organizations might have use cases like this:
As you might notice, the complete PATH of the repo is quite a bit different in terms of naming, but the repository name is the same, causing potential overwrite of the scan results on the Checkmarx web interface, crashing the metrics.
Solution proposal
As a posible solution we have implemented a manipulation of the flag "--project-name", concatenating the value of the Gitlab predefined variable "CI_PROJECT_NAMESPACE", and defining a new variable on the CI file wich is a number of the position that you want to choose to be correlated. ex:
New var:
Now inside the "script" sentence, we add new "export" definition to manipulate the new value via a new variable
This allow you to select the position number 1, 2, 3....n, as you wish, where tha value will became "/subgroup2" for example.
So this gives you the change to call the "--project-name" flag with a custom name and be able to have unique scan results for each repository in gitlab CICD pipelines.
Retrieving a resulta like this:
"ProjectName":"subgroup2-repo-abc","Status":"Running","CreatedAt"
Hope this works and you find any use for it, otherwise feel free to close the PR.
Best,