Repository: globocom/huskyCI
Pull request #424 (2019-11-18 10:50:42)

Adjustments to support data storage in Postgres and Postgres container image generation
This P.R. finishes PostgreSQL integration with HuskyCI.

All the adjustments made in code was necessary during integration tests with the DB so all data interactions could work appropriately.

Besides, the container image for Postgres is configured to be deployed together with all environment in `docker-compose`. The required configurations are inserted in `.sql` file for tables generations and definition of data types for each column which make the tables.

All the necessary integrations has been made.


Patch:
diff --git a/api/analysis/analysis.go b/api/analysis/analysis.go
index ec084df..a8142b1 100644
--- a/api/analysis/analysis.go
+++ b/api/analysis/analysis.go
@@ -84,16 +84,14 @@ func registerFinishedAnalysis(RID string, allScanResults *securitytest.RunAllInf
 		errorString = ""
 	}
 	updateAnalysisQuery := bson.M{
-		"$set": bson.M{
-			"status":         allScanResults.Status,
-			"commitAuthors":  allScanResults.CommitAuthors,
-			"result":         allScanResults.FinalResult,
-			"containers":     allScanResults.Containers,
-			"huskyciresults": allScanResults.HuskyCIResults,
-			"codes":          allScanResults.Codes,
-			"errorFound":     errorString,
-			"finishedAt":     time.Now(),
-		},
+		"status":         allScanResults.Status,
+		"commitAuthors":  allScanResults.CommitAuthors,
+		"result":         allScanResults.FinalResult,
+		"containers":     allScanResults.Containers,
+		"huskyciresults": allScanResults.HuskyCIResults,
+		"codes":          allScanResults.Codes,
+		"errorFound":     errorString,
+		"finishedAt":     time.Now(),
 	}
 
 	if err := apiContext.APIConfiguration.DBInstance.UpdateOneDBAnalysisContainer(analysisQuery, updateAnalysisQuery); err != nil {
diff --git a/api/config.yaml b/api/config.yaml
index 27facb7..adefbd1 100644
--- a/api/config.yaml
+++ b/api/config.yaml
@@ -1,7 +1,7 @@
 enry:
   name: enry
   image: huskyci/enry
-  imageTag: dev-fd3c31c
+  imageTag: dev-697929e
   cmd: |+
     mkdir -p ~/.ssh &&
     echo 'GIT_PRIVATE_SSH_KEY' > ~/.ssh/huskyci_id_rsa &&
@@ -52,7 +52,7 @@ gitauthors:
 gosec:
   name: gosec
   image: huskyci/gosec
-  imageTag: "2.0.0"
+  imageTag: v2.1.0
   cmd: |+
     mkdir -p ~/.ssh &&
     echo 'GIT_PRIVATE_SSH_KEY' > ~/.ssh/huskyci_id_rsa &&
@@ -102,7 +102,7 @@ bandit:
 brakeman:
   name: brakeman
   image: huskyci/brakeman
-  imageTag: "4.6.1"
+  imageTag: "4.7.1"
   cmd: |+
     mkdir -p ~/.ssh &&
     echo 'GIT_PRIVATE_SSH_KEY' > ~/.ssh/huskyci_id_rsa &&
@@ -172,7 +172,7 @@ safety:
 npmaudit:
   name: npmaudit
   image: huskyci/npmaudit
-  imageTag: "6.10.3"
+  imageTag: "6.12.1"
   cmd: |+
     mkdir -p ~/.ssh &&
     echo 'GIT_PRIVATE_SSH_KEY' > ~/.ssh/huskyci_id_rsa &&
@@ -200,7 +200,7 @@ npmaudit:
 yarnaudit:
   name: yarnaudit
   image: huskyci/yarnaudit
-  imageTag: "1.17.3"
+  imageTag: "1.19.1"
   cmd: |+
     mkdir -p ~/.ssh &&
     echo 'GIT_PRIVATE_SSH_KEY' > ~/.ssh/huskyci_id_rsa &&
@@ -210,9 +210,7 @@ yarnaudit:
     git clone -b %GIT_BRANCH% --single-branch %GIT_REPO% code --quiet 2> /tmp/errorGitCloneYarnAudit
     if [ $? -eq 0 ]; then
         cd code
-        pathLock=$(dirname "$(find . -name 'yarn.lock' | grep -v vendor)")
-        if [ $? -eq 0 ]; then
-            cd $pathLock
+        if [ -f yarn.lock ]; then
             yarn audit --json > /tmp/results.json 2> /tmp/errorYarnAudit
             if [ ! -s /tmp/errorYarnAudit ]; then
                 jq -c -M -j --slurp '{advisories: (. | map(select(.type == "auditAdvisory") | .data.advisory)), metadata: (. | map(select(.type == "auditSummary") | .data) | add)}' /tmp/results.json > /tmp/output.json
diff --git a/api/context/context.go b/api/context/context.go
index 3271276..28f245a 100644
--- a/api/context/context.go
+++ b/api/context/context.go
@@ -146,12 +146,12 @@ func (dF DefaultConfig) GetAPIPort() int {
 
 // GetAPIVersion returns current API version
 func (dF DefaultConfig) GetAPIVersion() string {
-	return "0.8.0"
+	return "0.10.0"
 }
 
 // GetAPIReleaseDate returns current API release date
 func (dF DefaultConfig) GetAPIReleaseDate() string {
-	return "2019-09-30"
+	return "2019-11-22"
 }
 
 // GetAllowOriginValue returns the allow origin value
@@ -369,6 +369,7 @@ func (dF DefaultConfig) GetDB() db.Requests {
 		}
 		postgres := db.PostgresRequests{
 			DataRetriever: &sqlJSONRetriever,
+			JSONHandler:   &jsonHandler,
 		}
 		return &postgres
 	}
diff --git a/api/db/huskydb.go b/api/db/huskydb.go
index e40818f..2e5d9cc 100644
--- a/api/db/huskydb.go
+++ b/api/db/huskydb.go
@@ -223,12 +223,15 @@ func (mR *MongoRequests) UpsertOneDBSecurityTest(mapParams map[string]interface{
 
 // UpdateOneDBAnalysis checks if a given analysis is present into AnalysisCollection and update it.
 func (mR *MongoRequests) UpdateOneDBAnalysis(mapParams map[string]interface{}, updatedAnalysis map[string]interface{}) error {
+	updatedQuery := bson.M{
+		"$set": updatedAnalysis,
+	}
 	analysisQuery := []bson.M{}
 	for k, v := range mapParams {
 		analysisQuery = append(analysisQuery, bson.M{k: v})
 	}
 	analysisFinalQuery := bson.M{"$and": analysisQuery}
-	err := mongoHuskyCI.Conn.Update(analysisFinalQuery, updatedAnalysis, mongoHuskyCI.AnalysisCollection)
+	err := mongoHuskyCI.Conn.Update(analysisFinalQuery, updatedQuery, mongoHuskyCI.AnalysisCollection)
 	return err
 }
 
@@ -245,12 +248,15 @@ func (mR *MongoRequests) UpdateOneDBUser(mapParams map[string]interface{}, updat
 
 // UpdateOneDBAnalysisContainer checks if a given analysis is present into AnalysisCollection and update the container associated in it.
 func (mR *MongoRequests) UpdateOneDBAnalysisContainer(mapParams, updateQuery map[string]interface{}) error {
+	updatedQuery := bson.M{
+		"$set": updateQuery,
+	}
 	analysisQuery := []bson.M{}
 	for k, v := range mapParams {
 		analysisQuery = append(analysisQuery, bson.M{k: v})
 	}
 	analysisFinalQuery := bson.M{"$and": analysisQuery}
-	err := mongoHuskyCI.Conn.Update(analysisFinalQuery, updateQuery, mongoHuskyCI.AnalysisCollection)
+	err := mongoHuskyCI.Conn.Update(analysisFinalQuery, updatedQuery, mongoHuskyCI.AnalysisCollection)
 	return err
 }
 
diff --git a/api/db/postgres.go b/api/db/postgres.go
index 5107230..680a6aa 100644
--- a/api/db/postgres.go
+++ b/api/db/postgres.go
@@ -25,9 +25,9 @@ func (pR *PostgresRequests) ConnectDB(
 	connMaxLifetime time.Duration) error {
 	return pR.DataRetriever.Connect(
 		address,
+		dbName,
 		username,
 		password,
-		dbName,
 		maxOpenConns,
 		maxIdleConns,
 		connMaxLifetime)
@@ -37,20 +37,9 @@ func (pR *PostgresRequests) ConnectDB(
 func (pR *PostgresRequests) FindOneDBRepository(
 	mapParams map[string]interface{}) (types.Repository, error) {
 	repositoryResponse := []types.Repository{}
-	repository, ok := mapParams["repositoryURL"]
-	if !ok {
-		return types.Repository{}, errors.New("Could not find repository URL")
-	}
-	repositoryQuery := `SELECT 
-					repositoryURL,
-					createdAt
-				FROM
-					repository
-				WHERE
-					repositoryURL = $1`
-
+	query, params := ConfigureQuery(`SELECT * FROM "repository"`, mapParams)
 	if err := pR.DataRetriever.RetrieveFromDB(
-		repositoryQuery, &repositoryResponse, repository); err != nil {
+		query, &repositoryResponse, []string{}, params...); err != nil {
 		return types.Repository{}, err
 	}
 	return repositoryResponse[0], nil
@@ -60,25 +49,9 @@ func (pR *PostgresRequests) FindOneDBRepository(
 func (pR *PostgresRequests) FindOneDBSecurityTest(
 	mapParams map[string]interface{}) (types.SecurityTest, error) {
 	securityTestResponse := []types.SecurityTest{}
-	securityTest, ok := mapParams["name"]
-	if !ok {
-		return types.SecurityTest{}, errors.New("Could not find securityTest name field")
-	}
-	securityTestQuery := `SELECT
-					name,
-					image,
-					imageTag,
-					cmd,
-					type,
-					language,
-					default,
-					timeOutSeconds
-				FROM
-					securityTest
-				WHERE
-					name = $1`
+	query, params := ConfigureQuery(`SELECT * FROM "securityTest"`, mapParams)
 	if err := pR.DataRetriever.RetrieveFromDB(
-		securityTestQuery, &securityTestResponse, securityTest); err != nil {
+		query, &securityTestResponse, []string{}, params...); err != nil {
 		return types.SecurityTest{}, err
 	}
 	return securityTestResponse[0], nil
@@ -88,30 +61,9 @@ func (pR *PostgresRequests) FindOneDBSecurityTest(
 func (pR *PostgresRequests) FindOneDBAnalysis(
 	mapParams map[string]interface{}) (types.Analysis, error) {
 	analysisResponse := []types.Analysis{}
-	analysis, ok := mapParams["RID"]
-	if !ok {
-		return types.Analysis{}, errors.New("Could not find RID field")
-	}
-	analysisQuery := `SELECT
-					RID,
-					repositoryURL,
-					repositoryBranch,
-					commitAuthors,
-					status,
-					result,
-					errorFound,
-					containers,
-					startedAt,
-					finishedAt,
-					codes,
-					huskyciresults
-				FROM
-					analysis
-				WHERE
-					RID = $1`
-
+	query, params := ConfigureQuery(`SELECT * FROM "analysis"`, mapParams)
 	if err := pR.DataRetriever.RetrieveFromDB(
-		analysisQuery, &analysisResponse, analysis); err != nil {
+		query, &analysisResponse, []string{"commitAuthors"}, params...); err != nil {
 		return types.Analysis{}, err
 	}
 	return analysisResponse[0], nil
@@ -121,23 +73,9 @@ func (pR *PostgresRequests) FindOneDBAnalysis(
 func (pR *PostgresRequests) FindOneDBUser(
 	mapParams map[string]interface{}) (types.User, error) {
 	userResponse := []types.User{}
-	user, ok := mapParams["username"]
-	if !ok {
-		return types.User{}, errors.New("Could not find user in DB")
-	}
-	userQuery := `SELECT
-					username,
-					password,
-					salt,
-					iterations,
-					keylen,
-					hashfunction
-				FROM
-					user
-				WHERE
-					username = $1`
-
-	if err := pR.DataRetriever.RetrieveFromDB(userQuery, &userResponse, user); err != nil {
+	query, params := ConfigureQuery(`SELECT * FROM "user"`, mapParams)
+	if err := pR.DataRetriever.RetrieveFromDB(
+		query, &userResponse, []string{}, params...); err != nil {
 		return types.User{}, err
 	}
 	return userResponse[0], nil
@@ -147,22 +85,9 @@ func (pR *PostgresRequests) FindOneDBUser(
 func (pR *PostgresRequests) FindOneDBAccessToken(
 	mapParams map[string]interface{}) (types.DBToken, error) {
 	tokenResponse := []types.DBToken{}
-	token, ok := mapParams["uuid"]
-	if !ok {
-		return types.DBToken{}, errors.New("Could not find uuid parameter")
-	}
-	tokenQuery := `SELECT
-					huskytoken,
-					repositoryURL,
-					isValid,
-					createdAt,
-					salt,
-					uuid
-				FROM
-					accessToken
-				WHERE
-					uuid = $1`
-	if err := pR.DataRetriever.RetrieveFromDB(tokenQuery, &tokenResponse, token); err != nil {
+	query, params := ConfigureQuery(`SELECT * FROM "accessToken"`, mapParams)
+	if err := pR.DataRetriever.RetrieveFromDB(
+		query, &tokenResponse, []string{}, params...); err != nil {
 		return types.DBToken{}, err
 	}
 	return tokenResponse[0], nil
@@ -173,7 +98,8 @@ func (pR *PostgresRequests) FindAllDBRepository(
 	mapParams map[string]interface{}) ([]types.Repository, error) {
 	repositoryResponse := []types.Repository{}
 	query, params := ConfigureQuery(`SELECT * FROM repository`, mapParams)
-	if err := pR.DataRetriever.RetrieveFromDB(query, &repositoryResponse, params); err != nil {
+	if err := pR.DataRetriever.RetrieveFromDB(
+		query, &repositoryResponse, []string{}, params...); err != nil {
 		return repositoryResponse, err
 	}
 	return repositoryResponse, nil
@@ -184,8 +110,9 @@ func (pR *PostgresRequests) FindAllDBRepository(
 func (pR *PostgresRequests) FindAllDBSecurityTest(
 	mapParams map[string]interface{}) ([]types.SecurityTest, error) {
 	securityResponse := []types.SecurityTest{}
-	query, params := ConfigureQuery(`SELECT * FROM securityTest`, mapParams)
-	if err := pR.DataRetriever.RetrieveFromDB(query, &securityResponse, params); err != nil {
+	query, params := ConfigureQuery(`SELECT * FROM "securityTest"`, mapParams)
+	if err := pR.DataRetriever.RetrieveFromDB(
+		query, &securityResponse, []string{}, params...); err != nil {
 		return securityResponse, err
 	}
 	return securityResponse, nil
@@ -196,7 +123,8 @@ func (pR *PostgresRequests) FindAllDBAnalysis(
 	mapParams map[string]interface{}) ([]types.Analysis, error) {
 	analysisResponse := []types.Analysis{}
 	query, params := ConfigureQuery(`SELECT * FROM analysis`, mapParams)
-	if err := pR.DataRetriever.RetrieveFromDB(query, &analysisResponse, params); err != nil {
+	if err := pR.DataRetriever.RetrieveFromDB(
+		query, &analysisResponse, []string{}, params...); err != nil {
 		return analysisResponse, err
 	}
 	return analysisResponse, nil
@@ -213,7 +141,7 @@ func (pR *PostgresRequests) InsertDBRepository(repository types.Repository) erro
 	}
 	finalQuery, values := ConfigureInsertQuery(
 		`INSERT into repository`, repositoryMap)
-	rowsAff, err := pR.DataRetriever.WriteInDB(finalQuery, values)
+	rowsAff, err := pR.DataRetriever.WriteInDB(finalQuery, values...)
 	if err != nil {
 		return err
 	}
@@ -239,8 +167,8 @@ func (pR *PostgresRequests) InsertDBSecurityTest(securityTest types.SecurityTest
 		"timeOutSeconds": securityTest.TimeOutInSeconds,
 	}
 	finalQuery, values := ConfigureInsertQuery(
-		`INSERT into securityTest`, securityTestMap)
-	rowsAff, err := pR.DataRetriever.WriteInDB(finalQuery, values)
+		`INSERT into "securityTest"`, securityTestMap)
+	rowsAff, err := pR.DataRetriever.WriteInDB(finalQuery, values...)
 	if err != nil {
 		return err
 	}
@@ -260,13 +188,15 @@ func (pR *PostgresRequests) InsertDBAnalysis(analysis types.Analysis) error {
 		"repositoryURL":    analysis.URL,
 		"repositoryBranch": analysis.Branch,
 		"status":           analysis.Status,
-		"result":           analysis.Result,
-		"containers":       analysis.Containers,
 		"startedAt":        analysis.StartedAt,
 	}
+	analysisMap, err := pR.ConfigureAnalysisData(analysisMap)
+	if err != nil {
+		return err
+	}
 	finalQuery, values := ConfigureInsertQuery(
 		`INSERT into analysis`, analysisMap)
-	rowsAff, err := pR.DataRetriever.WriteInDB(finalQuery, values)
+	rowsAff, err := pR.DataRetriever.WriteInDB(finalQuery, values...)
 	if err != nil {
 		return err
 	}
@@ -290,8 +220,8 @@ func (pR *PostgresRequests) InsertDBUser(user types.User) error {
 		"hashfunction": user.HashFunction,
 	}
 	finalQuery, values := ConfigureInsertQuery(
-		`INSERT into user`, userMap)
-	rowsAff, err := pR.DataRetriever.WriteInDB(finalQuery, values)
+		`INSERT into "user"`, userMap)
+	rowsAff, err := pR.DataRetriever.WriteInDB(finalQuery, values...)
 	if err != nil {
 		return err
 	}
@@ -315,8 +245,8 @@ func (pR *PostgresRequests) InsertDBAccessToken(accessToken types.DBToken) error
 		"uuid":          accessToken.UUID,
 	}
 	finalQuery, values := ConfigureInsertQuery(
-		`INSERT into accessToken`, accessTokenMap)
-	rowsAff, err := pR.DataRetriever.WriteInDB(finalQuery, values)
+		`INSERT into "accessToken"`, accessTokenMap)
+	rowsAff, err := pR.DataRetriever.WriteInDB(finalQuery, values...)
 	if err != nil {
 		return err
 	}
@@ -338,7 +268,7 @@ func (pR *PostgresRequests) UpdateOneDBRepository(
 	}
 	finalQuery, values := ConfigureUpdateQuery(
 		`UPDATE repository`, mapParams, updateQuery)
-	rowsAff, err := pR.DataRetriever.WriteInDB(finalQuery, values)
+	rowsAff, err := pR.DataRetriever.WriteInDB(finalQuery, values...)
 	if err != nil {
 		return err
 	}
@@ -369,8 +299,8 @@ func (pR *PostgresRequests) UpsertOneDBSecurityTest(
 		"timeOutSeconds": updatedSecurityTest.TimeOutInSeconds,
 	}
 	finalQuery, values := ConfigureUpsertQuery(
-		`INSERT into securityTest`, mapParams, updatedSecurityMap)
-	rowsAff, err := pR.DataRetriever.WriteInDB(finalQuery, values)
+		`INSERT into "securityTest"`, mapParams, updatedSecurityMap)
+	rowsAff, err := pR.DataRetriever.WriteInDB(finalQuery, values...)
 	if err != nil {
 		return nil, err
 	}
@@ -389,9 +319,15 @@ func (pR *PostgresRequests) UpdateOneDBAnalysis(
 	if len(mapParams) == 0 {
 		return errors.New("Empty fields to search")
 	}
+	// Convert commitAuthors to a valid type for psql
+	// understand that it is an array.
+	updatedAnalysis, err := pR.ConfigureAnalysisData(updatedAnalysis)
+	if err != nil {
+		return err
+	}
 	finalQuery, values := ConfigureUpdateQuery(
 		`UPDATE analysis`, mapParams, updatedAnalysis)
-	rowsAff, err := pR.DataRetriever.WriteInDB(finalQuery, values)
+	rowsAff, err := pR.DataRetriever.WriteInDB(finalQuery, values...)
 	if err != nil {
 		return err
 	}
@@ -419,8 +355,8 @@ func (pR *PostgresRequests) UpdateOneDBUser(
 		"hashfunction": updatedUser.HashFunction,
 	}
 	finalQuery, values := ConfigureUpdateQuery(
-		`UPDATE user`, mapParams, updatedUserMap)
-	rowsAff, err := pR.DataRetriever.WriteInDB(finalQuery, values)
+		`UPDATE "user"`, mapParams, updatedUserMap)
+	rowsAff, err := pR.DataRetriever.WriteInDB(finalQuery, values...)
 	if err != nil {
 		return err
 	}
@@ -440,9 +376,13 @@ func (pR *PostgresRequests) UpdateOneDBAnalysisContainer(
 	if len(mapParams) == 0 {
 		return errors.New("Empty fields to search")
 	}
+	updateQuery, err := pR.ConfigureAnalysisData(updateQuery)
+	if err != nil {
+		return err
+	}
 	finalQuery, values := ConfigureUpdateQuery(
 		`UPDATE analysis`, mapParams, updateQuery)
-	rowsAff, err := pR.DataRetriever.WriteInDB(finalQuery, values)
+	rowsAff, err := pR.DataRetriever.WriteInDB(finalQuery, values...)
 	if err != nil {
 		return err
 	}
@@ -470,8 +410,8 @@ func (pR *PostgresRequests) UpdateOneDBAccessToken(
 		"uuid":          updatedAccessToken.UUID,
 	}
 	finalQuery, values := ConfigureUpdateQuery(
-		`UPDATE accessToken`, mapParams, updatedAccessTokenMap)
-	rowsAff, err := pR.DataRetriever.WriteInDB(finalQuery, values)
+		`UPDATE "accessToken"`, mapParams, updatedAccessTokenMap)
+	rowsAff, err := pR.DataRetriever.WriteInDB(finalQuery, values...)
 	if err != nil {
 		return err
 	}
@@ -502,7 +442,7 @@ func ConfigureUpdateQuery(
 		if strings.Contains(searchQuery, "=") {
 			searchQuery = fmt.Sprintf("%s AND", searchQuery)
 		}
-		searchQuery = fmt.Sprintf("%s %s = $%d", searchQuery, k, i)
+		searchQuery = fmt.Sprintf(`%s "%s" = $%d`, searchQuery, k, i)
 		i++
 		values = append(values, v)
 	}
@@ -513,7 +453,7 @@ func ConfigureUpdateQuery(
 		if strings.Contains(valuesQuery, "=") {
 			valuesQuery = fmt.Sprintf("%s,", valuesQuery)
 		}
-		valuesQuery = fmt.Sprintf("%s %s = $%d", valuesQuery, k, i)
+		valuesQuery = fmt.Sprintf(`%s "%s" = $%d`, valuesQuery, k, i)
 		i++
 		values = append(values, v)
 	}
@@ -535,10 +475,10 @@ func ConfigureInsertQuery(query string, params map[string]interface{}) (string,
 	valuesQuery := `VALUES (`
 	for k, v := range params {
 		if i == len(params) {
-			argsQuery = fmt.Sprintf("%s%s)", argsQuery, k)
+			argsQuery = fmt.Sprintf(`%s"%s")`, argsQuery, k)
 			valuesQuery = fmt.Sprintf("%s$%d)", valuesQuery, i)
 		} else {
-			argsQuery = fmt.Sprintf("%s%s, ", argsQuery, k)
+			argsQuery = fmt.Sprintf(`%s"%s", `, argsQuery, k)
 			valuesQuery = fmt.Sprintf("%s$%d, ", valuesQuery, i)
 		}
 		values = append(values, v)
@@ -562,9 +502,9 @@ func ConfigureUpsertQuery(
 			conflictQuery = `ON CONFLICT (`
 		}
 		if index == len(searchValues) {
-			conflictQuery = fmt.Sprintf("%s%s)", conflictQuery, key)
+			conflictQuery = fmt.Sprintf(`%s"%s")`, conflictQuery, key)
 		} else {
-			conflictQuery = fmt.Sprintf("%s%s, ", conflictQuery, key)
+			conflictQuery = fmt.Sprintf(`%s"%s", `, conflictQuery, key)
 		}
 		index++
 	}
@@ -576,7 +516,7 @@ func ConfigureUpsertQuery(
 		if strings.Contains(updateQuery, "=") {
 			updateQuery = fmt.Sprintf("%s,", updateQuery)
 		}
-		updateQuery = fmt.Sprintf("%s %s = EXCLUDED.%s", updateQuery, key, key)
+		updateQuery = fmt.Sprintf(`%s "%s" = EXCLUDED."%s"`, updateQuery, key, key)
 	}
 	if conflictQuery != "" {
 		insertQuery = fmt.Sprintf("%s %s", insertQuery, conflictQuery)
@@ -599,9 +539,44 @@ func ConfigureQuery(query string, params map[string]interface{}) (string, []inte
 		if strings.Contains(query, "=") {
 			query = fmt.Sprintf("%s AND", query)
 		}
-		query = fmt.Sprintf("%s %s = $%d", query, k, i)
+		query = fmt.Sprintf(`%s "%s" = $%d`, query, k, i)
 		values = append(values, v)
 		i++
 	}
 	return query, values
 }
+
+// ConfigureAnalysisData will convert slice and struct data types
+// to a valid type to Postgres. For slices, it will use PqArray
+// function that convert slices to a valid array format in Postgres.
+// All the structs mapped in a JSON will be converted to a []byte
+// data type so it could be stored in correctly in a raw JSON
+// format. If any convertions fail, it will return an error.
+func (pR *PostgresRequests) ConfigureAnalysisData(
+	updatedAnalysis map[string]interface{}) (map[string]interface{}, error) {
+	if authors, ok := updatedAnalysis["commitAuthors"].([]string); ok {
+		updatedAnalysis["commitAuthors"] = pR.DataRetriever.PqArray(authors)
+	}
+	if containers, ok := updatedAnalysis["containers"].([]types.Container); ok {
+		containerJSON, err := pR.JSONHandler.Marshal(containers)
+		if err != nil {
+			return updatedAnalysis, err
+		}
+		updatedAnalysis["containers"] = containerJSON
+	}
+	if huskyciresults, ok := updatedAnalysis["huskyciresults"].(types.HuskyCIResults); ok {
+		huskyJSON, err := pR.JSONHandler.Marshal(huskyciresults)
+		if err != nil {
+			return updatedAnalysis, err
+		}
+		updatedAnalysis["huskyciresults"] = huskyJSON
+	}
+	if myCodes, ok := updatedAnalysis["codes"].([]types.Code); ok {
+		codeJSON, err := pR.JSONHandler.Marshal(myCodes)
+		if err != nil {
+			return updatedAnalysis, err
+		}
+		updatedAnalysis["codes"] = codeJSON
+	}
+	return updatedAnalysis, nil
+}
diff --git a/api/db/postgres/sql.go b/api/db/postgres/sql.go
index 6b5f008..9fd9c55 100644
--- a/api/db/postgres/sql.go
+++ b/api/db/postgres/sql.go
@@ -83,7 +83,7 @@ func (sqlConfig *SQLConfig) GetValuesFromDB(query string,
 // to DB and return the number of rows affected
 // during query process.
 func (sqlConfig *SQLConfig) WriteInDB(query string, args ...interface{}) (int64, error) {
-	err := sqlConfig.Postgres.Exec(query, args)
+	err := sqlConfig.Postgres.Exec(query, args...)
 	if err != nil {
 		return 0, err
 	}
diff --git a/api/db/psqlretriever.go b/api/db/psqlretriever.go
index 419f5f2..73182bc 100644
--- a/api/db/psqlretriever.go
+++ b/api/db/psqlretriever.go
@@ -1,9 +1,39 @@
 package db
 
 import (
+	"fmt"
+	"regexp"
+	"strings"
 	"time"
+
+	"github.com/lib/pq"
 )
 
+// ConvertStringToSlice parses the output string from the array type.
+// Regex used: (((?P<value>(([^",\\{}\s(NULL)])+|"([^"\\]|\\"|\\\\)*")))(,)?)
+func ConvertStringToSlice(array string) []string {
+	unquotedChar := `[^",\\{}\s(NULL)]`
+	unquotedValue := fmt.Sprintf("(%s)+", unquotedChar)
+	quotedChar := `[^"\\]|\\"|\\\\`
+	quotedValue := fmt.Sprintf("\"(%s)*\"", quotedChar)
+	arrayValue := fmt.Sprintf("(?P<value>(%s|%s))", unquotedValue, quotedValue)
+	arrayExp := regexp.MustCompile(fmt.Sprintf("((%s)(,)?)", arrayValue))
+	var valueIndex int
+	results := make([]string, 0)
+	matches := arrayExp.FindAllStringSubmatch(array, -1)
+	fmt.Println("The matches:", matches)
+	for _, match := range matches {
+		s := match[valueIndex]
+		fmt.Println("Values:", s)
+		// the string _might_ be wrapped in quotes, so trim them:
+		s = strings.Trim(s, "\"")
+		// trim the comma if it is more than on element:
+		s = strings.Trim(s, ",")
+		results = append(results, s)
+	}
+	return results
+}
+
 // Connect will establish and a connection with Postgres DB based on the received arguments
 func (sR *SQLJSONRetrieve) Connect(
 	address string,
@@ -28,11 +58,39 @@ func (sR *SQLJSONRetrieve) Connect(
 // returned values. The params passed are the ones that will be listed in WHERE argument of the
 // query if it exists.
 func (sR *SQLJSONRetrieve) RetrieveFromDB(
-	query string, response interface{}, params ...interface{}) error {
-	values, err := sR.Psql.GetValuesFromDB(query, params)
+	query string, response interface{}, arrayColumns []string, params ...interface{}) error {
+	values, err := sR.Psql.GetValuesFromDB(query, params...)
 	if err != nil {
 		return err
 	}
+	// Verifying if a column with array strings exists. In this case,
+	// should convert the entry to a slice type
+	for _, column := range arrayColumns {
+		if column != "" {
+			for _, row := range values {
+				convertedRow, ok := row[column].([]uint8)
+				if !ok {
+					continue
+				}
+				arrayValue := ConvertStringToSlice(string(convertedRow))
+				row[column] = arrayValue
+			}
+		}
+	}
+	// Converting all other []uint8 entries to an interface{}.
+	// If they are JSON objects, it should be mapped in the struct
+	// inside response variable.
+	for _, row := range values {
+		for k, v := range row {
+			if val, ok := v.([]uint8); ok {
+				var newJSON interface{}
+				if err = sR.JSONHandler.Unmarshal([]byte(string(val)), &newJSON); err != nil {
+					continue
+				}
+				row[k] = newJSON
+			}
+		}
+	}
 	jsonValues, err := sR.JSONHandler.Marshal(values)
 	if err != nil {
 		return err
@@ -46,5 +104,12 @@ func (sR *SQLJSONRetrieve) RetrieveFromDB(
 // WriteInDB will call Postgres with INSERT and UPDATE queries. The values to be inserted or
 // updated are passed in args variable.
 func (sR *SQLJSONRetrieve) WriteInDB(query string, args ...interface{}) (int64, error) {
-	return sR.Psql.WriteInDB(query, args)
+	return sR.Psql.WriteInDB(query, args...)
+}
+
+// PqArray will get the array passed as argument and return
+// an interface with the right format to store an array in
+// Postgres.
+func (sR *SQLJSONRetrieve) PqArray(values []string) interface{} {
+	return pq.Array(values)
 }
diff --git a/api/db/types.go b/api/db/types.go
index 549d683..94bdc1e 100644
--- a/api/db/types.go
+++ b/api/db/types.go
@@ -52,8 +52,9 @@ type JSON interface {
 // with DB functions. It abstracts the database functions
 type DataGenerator interface {
 	Connect(address string, username string, password string, dbName string, maxOpenConns int, maxIdleConns int, connLT time.Duration) error
-	RetrieveFromDB(query string, response interface{}, params ...interface{}) error
+	RetrieveFromDB(query string, response interface{}, arrayColumns []string, params ...interface{}) error
 	WriteInDB(query string, args ...interface{}) (int64, error)
+	PqArray(values []string) interface{}
 }
 
 // JSONCaller implements JSON interface calling functions
@@ -71,4 +72,5 @@ type SQLJSONRetrieve struct {
 // for Postgres, a relational DB.
 type PostgresRequests struct {
 	DataRetriever DataGenerator
+	JSONHandler   JSON
 }
diff --git a/api/routes/analysis.go b/api/routes/analysis.go
index 010a2b8..1c73fad 100644
--- a/api/routes/analysis.go
+++ b/api/routes/analysis.go
@@ -55,7 +55,7 @@ func GetAnalysis(c echo.Context) error {
 		return c.JSON(http.StatusUnauthorized, reply)
 	}
 	if err != nil {
-		if err == mgo.ErrNotFound {
+		if err == mgo.ErrNotFound || err.Error() == "No data found" {
 			log.Warning(logActionGetAnalysis, logInfoAnalysis, 106, RID)
 			reply := map[string]interface{}{"success": false, "error": "analysis not found"}
 			return c.JSON(http.StatusNotFound, reply)
@@ -96,31 +96,35 @@ func ReceiveRequest(c echo.Context) error {
 	// step-02: is this repository already in MongoDB?
 	repositoryQuery := map[string]interface{}{"repositoryURL": repository.URL}
 	_, err = apiContext.APIConfiguration.DBInstance.FindOneDBRepository(repositoryQuery)
-	if err == mgo.ErrNotFound {
-		// step-02-o1: repository not found! insert it into MongoDB
-		repository.CreatedAt = time.Now()
-		err = apiContext.APIConfiguration.DBInstance.InsertDBRepository(repository)
-		if err != nil {
-			log.Error(logActionReceiveRequest, logInfoAnalysis, 1010, err)
+	if err != nil {
+		if err == mgo.ErrNotFound || err.Error() == "No data found" {
+			// step-02-o1: repository not found! insert it into MongoDB
+			repository.CreatedAt = time.Now()
+			err = apiContext.APIConfiguration.DBInstance.InsertDBRepository(repository)
+			if err != nil {
+				log.Error(logActionReceiveRequest, logInfoAnalysis, 1010, err)
+				reply := map[string]interface{}{"success": false, "error": "internal error"}
+				return c.JSON(http.StatusInternalServerError, reply)
+			}
+		} else {
+			// step-02-o2: another error searching for repositoryQuery
+			log.Error(logActionReceiveRequest, logInfoAnalysis, 1013, err)
 			reply := map[string]interface{}{"success": false, "error": "internal error"}
 			return c.JSON(http.StatusInternalServerError, reply)
 		}
-	} else if err != nil {
-		// step-02-o2: another error searching for repositoryQuery
-		log.Error(logActionReceiveRequest, logInfoAnalysis, 1013, err)
-		reply := map[string]interface{}{"success": false, "error": "internal error"}
-		return c.JSON(http.StatusInternalServerError, reply)
 	} else { // err == nil
 		// step-03: repository found! does it have a running status analysis?
 		analysisQuery := map[string]interface{}{"repositoryURL": repository.URL, "repositoryBranch": repository.Branch}
 		analysisResult, err := apiContext.APIConfiguration.DBInstance.FindOneDBAnalysis(analysisQuery)
-		if err == mgo.ErrNotFound {
-			// nice! we can start this analysis!
-		} else if err != nil {
-			// step-03-err: another error searching for analysisQuery
-			log.Error(logActionReceiveRequest, logInfoAnalysis, 1009, err)
-			reply := map[string]interface{}{"success": false, "error": "internal error"}
-			return c.JSON(http.StatusInternalServerError, reply)
+		if err != nil {
+			if err == mgo.ErrNotFound || err.Error() == "No data found" {
+				// nice! we can start this analysis!
+			} else {
+				// step-03-err: another error searching for analysisQuery
+				log.Error(logActionReceiveRequest, logInfoAnalysis, 1009, err)
+				reply := map[string]interface{}{"success": false, "error": "internal error"}
+				return c.JSON(http.StatusInternalServerError, reply)
+			}
 		} else { // err == nil
 			// step 03-a: Ops, this analysis is already running!
 			if analysisResult.Status == "running" {
diff --git a/api/routes/user.go b/api/routes/user.go
index caca89f..229be39 100644
--- a/api/routes/user.go
+++ b/api/routes/user.go
@@ -49,7 +49,7 @@ func UpdateUser(c echo.Context) error {
 	userQuery := map[string]interface{}{"username": attemptUser.Username}
 	user, err := apiContext.APIConfiguration.DBInstance.FindOneDBUser(userQuery)
 	if err != nil {
-		if err == mgo.ErrNotFound {
+		if err == mgo.ErrNotFound || err.Error() == "No data found" {
 			reply := map[string]interface{}{"success": false, "error": "user not found"}
 			return c.JSON(http.StatusNotFound, reply)
 		}
@@ -92,7 +92,7 @@ func UpdateUser(c echo.Context) error {
 
 	// step 5.2: update user
 	if err := apiContext.APIConfiguration.DBInstance.UpdateOneDBUser(userQuery, updatedUser); err != nil {
-		if err == mgo.ErrNotFound {
+		if err == mgo.ErrNotFound || err.Error() == "No data found" {
 			reply := map[string]interface{}{"success": false, "error": "user not found"}
 			return c.JSON(http.StatusNotFound, reply)
 		}
diff --git a/api/types/types.go b/api/types/types.go
index 83ee7dd..e9a741f 100644
--- a/api/types/types.go
+++ b/api/types/types.go
@@ -6,34 +6,29 @@ package types
 
 import (
 	"time"
-
-	"gopkg.in/mgo.v2/bson"
 )
 
 // Repository is the struct that stores all data from repository to be analyzed.
 type Repository struct {
-	ID        bson.ObjectId `bson:"_id,omitempty"`
-	URL       string        `bson:"repositoryURL" json:"repositoryURL"`
-	Branch    string        `json:"repositoryBranch"`
-	CreatedAt time.Time     `bson:"createdAt" json:"createdAt"`
+	URL       string    `bson:"repositoryURL" json:"repositoryURL"`
+	Branch    string    `json:"repositoryBranch"`
+	CreatedAt time.Time `bson:"createdAt" json:"createdAt"`
 }
 
 // SecurityTest is the struct that stores all data from the security tests to be executed.
 type SecurityTest struct {
-	ID               bson.ObjectId `bson:"_id,omitempty"`
-	Name             string        `bson:"name" json:"name"`
-	Image            string        `bson:"image" json:"image"`
-	ImageTag         string        `bson:"imageTag" json:"imageTag"`
-	Cmd              string        `bson:"cmd" json:"cmd"`
-	Type             string        `bson:"type" json:"type"`
-	Language         string        `bson:"language" json:"language"`
-	Default          bool          `bson:"default" json:"default"`
-	TimeOutInSeconds int           `bson:"timeOutSeconds" json:"timeOutSeconds"`
+	Name             string `bson:"name" json:"name"`
+	Image            string `bson:"image" json:"image"`
+	ImageTag         string `bson:"imageTag" json:"imageTag"`
+	Cmd              string `bson:"cmd" json:"cmd"`
+	Type             string `bson:"type" json:"type"`
+	Language         string `bson:"language" json:"language"`
+	Default          bool   `bson:"default" json:"default"`
+	TimeOutInSeconds int    `bson:"timeOutSeconds" json:"timeOutSeconds"`
 }
 
 // Analysis is the struct that stores all data from analysis performed.
 type Analysis struct {
-	ID             bson.ObjectId  `bson:"_id,omitempty"`
 	RID            string         `bson:"RID" json:"RID"`
 	URL            string         `bson:"repositoryURL" json:"repositoryURL"`
 	Branch         string         `bson:"repositoryBranch" json:"repositoryBranch"`
@@ -68,15 +63,14 @@ type Code struct {
 
 // User is the struct that holds all data from a huskyCI API user
 type User struct {
-	ID                 bson.ObjectId `bson:"_id,omitempty"`
-	Username           string        `bson:"username" json:"username"`
-	Password           string        `bson:"password" json:"password"`
-	Salt               string        `bson:"salt,omitempty" json:"salt"`
-	Iterations         int           `bson:"iterations,omitempty" json:"iterations"`
-	KeyLen             int           `bson:"keylen,omitempty" json:"keylen"`
-	HashFunction       string        `bson:"hashfunction,omitempty" json:"hashfunction"`
-	NewPassword        string        `bson:"newPassword,omitempty" json:"newPassword"`
-	ConfirmNewPassword string        `bson:"confirmNewPassword,omitempty" json:"confirmNewPassword"`
+	Username           string `bson:"username" json:"username"`
+	Password           string `bson:"password" json:"password"`
+	Salt               string `bson:"salt,omitempty" json:"salt"`
+	Iterations         int    `bson:"iterations,omitempty" json:"iterations"`
+	KeyLen             int    `bson:"keylen,omitempty" json:"keylen"`
+	HashFunction       string `bson:"hashfunction,omitempty" json:"hashfunction"`
+	NewPassword        string `bson:"newPassword,omitempty" json:"newPassword"`
+	ConfirmNewPassword string `bson:"confirmNewPassword,omitempty" json:"confirmNewPassword"`
 }
 
 // HuskyCIVulnerability is the struct that stores vulnerability information.
@@ -159,11 +153,10 @@ type AccessToken struct {
 // DBToken defines the struct that stores husky access token
 // for a repository URL
 type DBToken struct {
-	ID         bson.ObjectId `bson:"_id,omitempty"`
-	HuskyToken string        `bson:"huskytoken" json:"huskytoken"`
-	URL        string        `bson:"repositoryURL" json:"repositoryURL"`
-	IsValid    bool          `bson:"isValid" json:"isValid"`
-	CreatedAt  time.Time     `bson:"createdAt" json:"createdAt"`
-	Salt       string        `bson:"salt" json:"salt"`
-	UUID       string        `bson:"uuid" json:"uuid"`
+	HuskyToken string    `bson:"huskytoken" json:"huskytoken"`
+	URL        string    `bson:"repositoryURL" json:"repositoryURL"`
+	IsValid    bool      `bson:"isValid" json:"isValid"`
+	CreatedAt  time.Time `bson:"createdAt" json:"createdAt"`
+	Salt       string    `bson:"salt" json:"salt"`
+	UUID       string    `bson:"uuid" json:"uuid"`
 }
diff --git a/api/util/api/api.go b/api/util/api/api.go
index d0625ea..40d52c3 100644
--- a/api/util/api/api.go
+++ b/api/util/api/api.go
@@ -16,6 +16,7 @@ import (
 const logActionCheckReqs = "CheckHuskyRequirements"
 const logInfoAPIUtil = "API-UTIL"
 
+
 // CheckHuskyRequirements checks for all requirements needed before starting huskyCI.
 func (hU HuskyUtils) CheckHuskyRequirements(configAPI *apiContext.APIConfig) error {
 
@@ -164,7 +165,7 @@ func (cH *CheckUtils) checkDefaultUser(configAPI *apiContext.APIConfig) error {
 	defaultUserQuery := map[string]interface{}{"username": user.DefaultAPIUser}
 	_, err := configAPI.DBInstance.FindOneDBUser(defaultUserQuery)
 	if err != nil {
-		if err == mgo.ErrNotFound {
+		if err == mgo.ErrNotFound || err.Error() == "No data found" {
 			// user not found, add default user
 			if err := user.InsertDefaultUser(); err != nil {
 				return err
diff --git a/client/analysis/analysis.go b/client/analysis/analysis.go
index cb6a100..8dce21d 100644
--- a/client/analysis/analysis.go
+++ b/client/analysis/analysis.go
@@ -119,7 +119,7 @@ func GetAnalysis(RID string) (types.Analysis, error) {
 func MonitorAnalysis(RID string) (types.Analysis, error) {
 
 	analysis := types.Analysis{}
-	timeout := time.After(15 * time.Minute)
+	timeout := time.After(60 * time.Minute)
 	retryTick := time.NewTicker(60 * time.Second)
 
 	for {
diff --git a/client/cmd/main.go b/client/cmd/main.go
index c4a56ca..bd25a14 100644
--- a/client/cmd/main.go
+++ b/client/cmd/main.go
@@ -92,5 +92,5 @@ func main() {
 		fmt.Printf("[HUSKYCI][*] Some HIGH/MEDIUM issues were found :(\n")
 	}
 
-	os.Exit(1)
+	os.Exit(190)
 }
diff --git a/client/integration/sonarqube/sonarqube.go b/client/integration/sonarqube/sonarqube.go
index 1480cec..65e7f19 100644
--- a/client/integration/sonarqube/sonarqube.go
+++ b/client/integration/sonarqube/sonarqube.go
@@ -25,7 +25,7 @@ or is not associated with any specific file, i.e.: vulnerable dependency version
 // GenerateOutputFile prints the analysis output in a JSON format
 func GenerateOutputFile(analysis types.Analysis, outputPath, outputFileName string) error {
 
-	var allVulns []types.HuskyCIVulnerability
+	allVulns := make([]types.HuskyCIVulnerability, 0)
 
 	// gosec
 	allVulns = append(allVulns, analysis.HuskyCIResults.GoResults.HuskyCIGosecOutput.LowVulns...)
@@ -69,6 +69,7 @@ func GenerateOutputFile(analysis types.Analysis, outputPath, outputFileName stri
 	allVulns = append(allVulns, analysis.HuskyCIResults.JavaResults.HuskyCISpotBugsOutput.HighVulns...)
 
 	var sonarOutput HuskyCISonarOutput
+	sonarOutput.Issues = make([]SonarIssue, 0)
 
 	for _, vuln := range allVulns {
 		var issue SonarIssue
diff --git a/deployments/docker-compose.yml b/deployments/docker-compose.yml
index 9be965b..a25c1d2 100644
--- a/deployments/docker-compose.yml
+++ b/deployments/docker-compose.yml
@@ -20,7 +20,9 @@ services:
         environment:
             GOPATH: /go/
             # required envs
+            HUSKYCI_DATABASE_TYPE: mongodb
             HUSKYCI_DATABASE_DB_ADDR: mongodb
+            HUSKYCI_DATABASE_DB_PORT: "27017"
             HUSKYCI_DATABASE_DB_NAME: huskyCIDB
             HUSKYCI_DATABASE_DB_USERNAME: huskyCIUser
             HUSKYCI_DATABASE_DB_PASSWORD: huskyCIPassword
@@ -80,7 +82,21 @@ services:
         environment:
             REACT_APP_HUSKYCI_FE_API_ADDRESS: "http://127.0.0.1:8888"
         ports:
-          - "8080:80"
+          - "10080:80"
+        networks:
+            - huskyCI_net
+
+    postgres:
+        container_name: huskyCI_Postgres
+        environment:
+            POSTGRES_USER: huskyCIUser
+            POSTGRES_PASSWORD: huskyCIPassword
+            POSTGRES_DB: huskyCIDB
+        build:
+            context: ../
+            dockerfile: deployments/dockerfiles/postgres.Dockerfile
+        ports:
+            - "5432:5432"
         networks:
             - huskyCI_net
     
diff --git a/deployments/dockerfiles/postgres.Dockerfile b/deployments/dockerfiles/postgres.Dockerfile
new file mode 100644
index 0000000..fb6c552
--- /dev/null
+++ b/deployments/dockerfiles/postgres.Dockerfile
@@ -0,0 +1,2 @@
+FROM postgres:latest
+ADD deployments/huskyci.sql /docker-entrypoint-initdb.d/
\ No newline at end of file
diff --git a/deployments/huskyci.sql b/deployments/huskyci.sql
new file mode 100644
index 0000000..2554b50
--- /dev/null
+++ b/deployments/huskyci.sql
@@ -0,0 +1,252 @@
+--
+-- PostgreSQL database dump
+--
+
+-- Dumped from database version 11.5
+-- Dumped by pg_dump version 11.5
+
+SET statement_timeout = 0;
+SET lock_timeout = 0;
+SET idle_in_transaction_session_timeout = 0;
+SET client_encoding = 'UTF8';
+SET standard_conforming_strings = on;
+SELECT pg_catalog.set_config('search_path', '', false);
+SET check_function_bodies = false;
+SET xmloption = content;
+SET client_min_messages = warning;
+SET row_security = off;
+
+--
+-- Name: uuid-ossp; Type: EXTENSION; Schema: -; Owner: 
+--
+
+CREATE EXTENSION IF NOT EXISTS "uuid-ossp" WITH SCHEMA public;
+
+
+--
+-- Name: EXTENSION "uuid-ossp"; Type: COMMENT; Schema: -; Owner: 
+--
+
+COMMENT ON EXTENSION "uuid-ossp" IS 'generate universally unique identifiers (UUIDs)';
+
+
+SET default_tablespace = '';
+
+SET default_with_oids = false;
+
+--
+-- Name: accessToken; Type: TABLE; Schema: public; Owner: huskyCIUser
+--
+
+CREATE TABLE public."accessToken" (
+    id uuid DEFAULT public.uuid_generate_v4() NOT NULL,
+    huskytoken text NOT NULL,
+    "repositoryURL" text NOT NULL,
+    "isValid" boolean NOT NULL,
+    "createdAt" timestamp without time zone NOT NULL,
+    salt text NOT NULL,
+    uuid text NOT NULL
+);
+
+
+ALTER TABLE public."accessToken" OWNER TO "huskyCIUser";
+
+--
+-- Name: analysis; Type: TABLE; Schema: public; Owner: huskyCIUser
+--
+
+CREATE TABLE public.analysis (
+    id uuid DEFAULT public.uuid_generate_v4() NOT NULL,
+    "RID" text NOT NULL,
+    "repositoryURL" text NOT NULL,
+    "repositoryBranch" text NOT NULL,
+    "commitAuthors" text[],
+    status text NOT NULL,
+    result text,
+    "errorFound" text,
+    containers jsonb,
+    "startedAt" timestamp without time zone,
+    "finishedAt" timestamp without time zone,
+    codes jsonb,
+    huskyciresults jsonb
+);
+
+
+ALTER TABLE public.analysis OWNER TO "huskyCIUser";
+
+--
+-- Name: repository; Type: TABLE; Schema: public; Owner: huskyCIUser
+--
+
+CREATE TABLE public.repository (
+    id uuid DEFAULT public.uuid_generate_v4() NOT NULL,
+    "repositoryURL" text NOT NULL,
+    "repositoryBranch" text,
+    "createdAt" timestamp without time zone NOT NULL
+);
+
+
+ALTER TABLE public.repository OWNER TO "huskyCIUser";
+
+--
+-- Name: securityTest; Type: TABLE; Schema: public; Owner: huskyCIUser
+--
+
+CREATE TABLE public."securityTest" (
+    id uuid DEFAULT public.uuid_generate_v4() NOT NULL,
+    name text NOT NULL,
+    image text NOT NULL,
+    "imageTag" text,
+    cmd text NOT NULL,
+    type text NOT NULL,
+    language text NOT NULL,
+    "default" boolean NOT NULL,
+    "timeOutSeconds" integer NOT NULL
+);
+
+
+ALTER TABLE public."securityTest" OWNER TO "huskyCIUser";
+
+--
+-- Name: user; Type: TABLE; Schema: public; Owner: huskyCIUser
+--
+
+CREATE TABLE public."user" (
+    id uuid DEFAULT public.uuid_generate_v4() NOT NULL,
+    username text NOT NULL,
+    password text NOT NULL,
+    salt text,
+    iterations integer,
+    keylen integer,
+    hashfunction text,
+    "newPassword" text,
+    "confirmNewPassword" text
+);
+
+
+ALTER TABLE public."user" OWNER TO "huskyCIUser";
+
+--
+-- Data for Name: accessToken; Type: TABLE DATA; Schema: public; Owner: huskyCIUser
+--
+
+COPY public."accessToken" (id, huskytoken, "repositoryURL", "isValid", "createdAt", salt, uuid) FROM stdin;
+\.
+
+
+--
+-- Data for Name: analysis; Type: TABLE DATA; Schema: public; Owner: huskyCIUser
+--
+
+COPY public.analysis (id, "RID", "repositoryURL", "repositoryBranch", "commitAuthors", status, result, "errorFound", containers, "startedAt", "finishedAt", codes, huskyciresults) FROM stdin;
+\.
+
+
+--
+-- Data for Name: repository; Type: TABLE DATA; Schema: public; Owner: huskyCIUser
+--
+
+COPY public.repository (id, "repositoryURL", "repositoryBranch", "createdAt") FROM stdin;
+\.
+
+
+--
+-- Data for Name: securityTest; Type: TABLE DATA; Schema: public; Owner: huskyCIUser
+--
+
+COPY public."securityTest" (id, name, image, "imageTag", cmd, type, language, "default", "timeOutSeconds") FROM stdin;
+\.
+
+
+--
+-- Data for Name: user; Type: TABLE DATA; Schema: public; Owner: huskyCIUser
+--
+
+COPY public."user" (id, username, password, salt, iterations, keylen, hashfunction, "newPassword", "confirmNewPassword") FROM stdin;
+\.
+
+
+--
+-- Name: accessToken accessToken_huskytoken_key; Type: CONSTRAINT; Schema: public; Owner: huskyCIUser
+--
+
+ALTER TABLE ONLY public."accessToken"
+    ADD CONSTRAINT "accessToken_huskytoken_key" UNIQUE (huskytoken);
+
+
+--
+-- Name: accessToken accessToken_pkey; Type: CONSTRAINT; Schema: public; Owner: huskyCIUser
+--
+
+ALTER TABLE ONLY public."accessToken"
+    ADD CONSTRAINT "accessToken_pkey" PRIMARY KEY (id);
+
+
+--
+-- Name: analysis analysis_RID_key; Type: CONSTRAINT; Schema: public; Owner: huskyCIUser
+--
+
+ALTER TABLE ONLY public.analysis
+    ADD CONSTRAINT "analysis_RID_key" UNIQUE ("RID");
+
+
+--
+-- Name: analysis analysis_pkey; Type: CONSTRAINT; Schema: public; Owner: huskyCIUser
+--
+
+ALTER TABLE ONLY public.analysis
+    ADD CONSTRAINT analysis_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: repository repository_pkey; Type: CONSTRAINT; Schema: public; Owner: huskyCIUser
+--
+
+ALTER TABLE ONLY public.repository
+    ADD CONSTRAINT repository_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: repository repository_repositoryURL_key; Type: CONSTRAINT; Schema: public; Owner: huskyCIUser
+--
+
+ALTER TABLE ONLY public.repository
+    ADD CONSTRAINT "repository_repositoryURL_key" UNIQUE ("repositoryURL");
+
+
+--
+-- Name: securityTest securityTest_name_key; Type: CONSTRAINT; Schema: public; Owner: huskyCIUser
+--
+
+ALTER TABLE ONLY public."securityTest"
+    ADD CONSTRAINT "securityTest_name_key" UNIQUE (name);
+
+
+--
+-- Name: securityTest securityTest_pkey; Type: CONSTRAINT; Schema: public; Owner: huskyCIUser
+--
+
+ALTER TABLE ONLY public."securityTest"
+    ADD CONSTRAINT "securityTest_pkey" PRIMARY KEY (id);
+
+
+--
+-- Name: user user_pkey; Type: CONSTRAINT; Schema: public; Owner: huskyCIUser
+--
+
+ALTER TABLE ONLY public."user"
+    ADD CONSTRAINT user_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: user user_username_key; Type: CONSTRAINT; Schema: public; Owner: huskyCIUser
+--
+
+ALTER TABLE ONLY public."user"
+    ADD CONSTRAINT user_username_key UNIQUE (username);
+
+
+--
+-- PostgreSQL database dump complete
+--
+
diff --git a/deployments/scripts/generate-env.sh b/deployments/scripts/generate-env.sh
index 39db81c..471c9ee 100755
--- a/deployments/scripts/generate-env.sh
+++ b/deployments/scripts/generate-env.sh
@@ -9,7 +9,7 @@
 
 # huskyCI client default environment variables
 HUSKYCI_CLIENT_REPO_URL="https://github.com/globocom/huskyCI.git"
-HUSKYCI_CLIENT_REPO_BRANCH="vulns-Golang"
+HUSKYCI_CLIENT_REPO_BRANCH="poc-golang-gosec"
 HUSKYCI_CLIENT_API_ADDR="http://localhost:8888"
 HUSKYCI_CLIENT_API_USE_HTTPS="false"
 
diff --git a/go.mod b/go.mod
index 4304108..7e8d1ef 100644
--- a/go.mod
+++ b/go.mod
@@ -27,12 +27,11 @@ require (
 	github.com/labstack/echo v3.3.10+incompatible
 	github.com/labstack/gommon v0.2.8 // indirect
 	github.com/lib/pq v1.2.0
-	github.com/magiconair/properties v1.8.1 // indirect
-	github.com/mattn/goveralls v0.0.3 // indirect
+	github.com/mattn/goveralls v0.0.4 // indirect
 	github.com/mitchellh/go-homedir v1.1.0
 	github.com/nightlyone/lockfile v0.0.0-20180618180623-0ad87eef1443 // indirect
-	github.com/onsi/gomega v1.7.1
 	github.com/onsi/ginkgo v1.10.3
+	github.com/onsi/gomega v1.7.1
 	github.com/opencontainers/go-digest v1.0.0-rc1 // indirect
 	github.com/pelletier/go-toml v1.5.0 // indirect
 	github.com/sdboyer/constext v0.0.0-20170321163424-836a14457353 // indirect
@@ -46,13 +45,14 @@ require (
 	github.com/valyala/fasttemplate v1.0.1 // indirect
 	golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392
 	golang.org/x/lint v0.0.0-20190930215403-16217165b5de // indirect
-	golang.org/x/net v0.0.0-20191014212845-da9a3fd4c582
+	golang.org/x/net v0.0.0-20191119073136-fc4aabc6c914
 	golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e // indirect
-	golang.org/x/sys v0.0.0-20191018095205-727590c5006e // indirect
-	golang.org/x/tools v0.0.0-20191018000036-341939e08647 // indirect
+	golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e // indirect
+	golang.org/x/tools v0.0.0-20191122080028-f774e2e2e5be // indirect
 	gopkg.in/Graylog2/go-gelf.v2 v2.0.0-20180326133423-4dbb9d721348 // indirect
 	gopkg.in/fsnotify/fsnotify.v1 v1.4.7 // indirect
 	gopkg.in/mgo.v2 v2.0.0-20180705113604-9856a29383ce
+	gopkg.in/yaml.v2 v2.2.7 // indirect
 	mvdan.cc/unparam v0.0.0-20190917161559-b83a221c10a2 // indirect
 	sourcegraph.com/sqs/pbtypes v1.0.0 // indirect
 )
diff --git a/go.sum b/go.sum
index 0b2d6a1..ee1e291 100644
--- a/go.sum
+++ b/go.sum
@@ -213,6 +213,8 @@ github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcME
 github.com/mattn/goveralls v0.0.2/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw=
 github.com/mattn/goveralls v0.0.3 h1:GnFhBAK0wJmxZBum88FqDzcDPLjAk9sL0HzhmW+9bo8=
 github.com/mattn/goveralls v0.0.3/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw=
+github.com/mattn/goveralls v0.0.4 h1:/mdWfiU2y8kZ48EtgByYev/XT3W4dkTuKLOJJsh/r+o=
+github.com/mattn/goveralls v0.0.4/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw=
 github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
 github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
 github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
@@ -384,6 +386,8 @@ golang.org/x/net v0.0.0-20191009170851-d66e71096ffb h1:TR699M2v0qoKTOHxeLgp6zPqa
 golang.org/x/net v0.0.0-20191009170851-d66e71096ffb/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
 golang.org/x/net v0.0.0-20191014212845-da9a3fd4c582 h1:p9xBe/w/OzkeYVKm234g55gMdD1nSIooTir5kV11kfA=
 golang.org/x/net v0.0.0-20191014212845-da9a3fd4c582/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20191119073136-fc4aabc6c914 h1:MlY3mEfbnWGmUi4rtHOtNnnnN4UJRGSyLPx+DXA5Sq4=
+golang.org/x/net v0.0.0-20191119073136-fc4aabc6c914/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
 golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
 golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA=
 golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -415,6 +419,8 @@ golang.org/x/sys v0.0.0-20191010194322-b09406accb47 h1:/XfQ9z7ib8eEJX2hdgFTZJ/nt
 golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 golang.org/x/sys v0.0.0-20191018095205-727590c5006e h1:ZtoklVMHQy6BFRHkbG6JzK+S6rX82//Yeok1vMlizfQ=
 golang.org/x/sys v0.0.0-20191018095205-727590c5006e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e h1:N7DeIrjYszNmSW409R3frPPwglRwMkXSBzwVbkOjLLA=
+golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
 golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
 golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@@ -449,6 +455,8 @@ golang.org/x/tools v0.0.0-20191015211201-9c6d90b5a7d0 h1:KPtnBRFVP7cXAlZnb0bT/go
 golang.org/x/tools v0.0.0-20191015211201-9c6d90b5a7d0/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
 golang.org/x/tools v0.0.0-20191018000036-341939e08647 h1:kfteFQIbFl9R5RwgjPgqDtpdeSnP/IfGo1R0ngom5vs=
 golang.org/x/tools v0.0.0-20191018000036-341939e08647/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
+golang.org/x/tools v0.0.0-20191122080028-f774e2e2e5be h1:6d2MOtryvuMarrCTOqjhCZCVONST5uq4zNzBWKxzOls=
+golang.org/x/tools v0.0.0-20191122080028-f774e2e2e5be/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
 golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
 google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
 google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
@@ -481,6 +489,8 @@ gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
 gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
 gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I=
 gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v2 v2.2.7 h1:VUgggvou5XRW9mHwD/yXxIYSMtY0zoKQf/v226p2nyo=
+gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
 honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
 honnef.co/go/tools v0.0.1-2019.2.3 h1:3JgtbtFHMiCmsznwGVTUWbgGov+pVqnlf1dEJTNAXeM=
 honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=


Test patch:
diff --git a/api/context/context_test.go b/api/context/context_test.go
index 17c8f12..fe342d1 100644
--- a/api/context/context_test.go
+++ b/api/context/context_test.go
@@ -322,8 +322,8 @@ var _ = Describe("Context", func() {
 				apiConfig, err := config.GetAPIConfig()
 				expectedConfig := &APIConfig{
 					Port:             fakeCaller.expectedIntegerValue,
-					Version:          "0.8.0",
-					ReleaseDate:      "2019-09-30",
+					Version:          "0.10.0",
+					ReleaseDate:      "2019-11-22",
 					AllowOriginValue: fakeCaller.expectedEnvVar,
 					UseTLS:           true,
 					GitPrivateSSHKey: fakeCaller.expectedEnvVar,
diff --git a/api/db/postgres_test.go b/api/db/postgres_test.go
index d979869..5e9a480 100644
--- a/api/db/postgres_test.go
+++ b/api/db/postgres_test.go
@@ -20,6 +20,7 @@ type FakeRetriever struct {
 	expectedWriteError    error
 	expectedNumberRows    int64
 	expectedConnectError  error
+	expectedPqArray       interface{}
 }
 
 func (fR *FakeRetriever) Connect(
@@ -34,7 +35,7 @@ func (fR *FakeRetriever) Connect(
 }
 
 func (fR *FakeRetriever) RetrieveFromDB(
-	query string, response interface{}, params ...interface{}) error {
+	query string, response interface{}, arrayColumns []string, params ...interface{}) error {
 	if fR.expectedRetrieveError == nil {
 		switch r := response.(type) {
 		case *[]types.Repository:
@@ -61,6 +62,23 @@ func (fR *FakeRetriever) WriteInDB(query string, args ...interface{}) (int64, er
 	return fR.expectedNumberRows, fR.expectedWriteError
 }
 
+func (fR *FakeRetriever) PqArray(values []string) interface{} {
+	return fR.expectedPqArray
+}
+
+type FakeJson struct {
+	expectedMarshalData  []byte
+	expectedMarshalError error
+}
+
+func (fJ *FakeJson) Marshal(v interface{}) ([]byte, error) {
+	return fJ.expectedMarshalData, fJ.expectedMarshalError
+}
+
+func (fJ *FakeJson) Unmarshal(data []byte, v interface{}) error {
+	return nil
+}
+
 var _ = Describe("Postgres", func() {
 
 	var (
@@ -100,7 +118,8 @@ var _ = Describe("Postgres", func() {
 			IsValid:    true,
 		}
 		validParams = map[string]interface{}{"id": "teste"}
-		validUpdate = map[string]interface{}{"changeField": "changeValue"}
+		validUpdate = map[string]interface{}{"changeField": "changeValue",
+			"containers": []types.Container{}}
 	})
 
 	Describe("ConnectDB", func() {
@@ -119,15 +138,6 @@ var _ = Describe("Postgres", func() {
 	})
 
 	Describe("FindOneDBRepository", func() {
-		Context("When key map verification returns false", func() {
-			It("Should return an empty Repository with the expected error", func() {
-				postgres := PostgresRequests{}
-				repo, err := postgres.FindOneDBRepository(
-					map[string]interface{}{"Wrong Key": "Failed"})
-				Expect(repo).To(Equal(types.Repository{}))
-				Expect(err).To(Equal(errors.New("Could not find repository URL")))
-			})
-		})
 		Context("When RetrieveFromDB returns an error", func() {
 			It("Should return an empty Repository with the same error", func() {
 				fakeRetriever := FakeRetriever{
@@ -163,15 +173,6 @@ var _ = Describe("Postgres", func() {
 		})
 	})
 	Describe("FindOneDBSecurityTest", func() {
-		Context("When key map verification returns false", func() {
-			It("Should return an empty SecurityTest with the expected error", func() {
-				postgres := PostgresRequests{}
-				repo, err := postgres.FindOneDBSecurityTest(
-					map[string]interface{}{"Wrong Key": "Failed"})
-				Expect(repo).To(Equal(types.SecurityTest{}))
-				Expect(err).To(Equal(errors.New("Could not find securityTest name field")))
-			})
-		})
 		Context("When RetrieveFromDB returns an error", func() {
 			It("Should return an empty SecurityTest with the same error", func() {
 				fakeRetriever := FakeRetriever{
@@ -207,15 +208,6 @@ var _ = Describe("Postgres", func() {
 		})
 	})
 	Describe("FindOneDBAnalysis", func() {
-		Context("When key map verification returns false", func() {
-			It("Should return an empty Analysis with the expected error", func() {
-				postgres := PostgresRequests{}
-				repo, err := postgres.FindOneDBAnalysis(
-					map[string]interface{}{"Wrong Key": "Failed"})
-				Expect(repo).To(Equal(types.Analysis{}))
-				Expect(err).To(Equal(errors.New("Could not find RID field")))
-			})
-		})
 		Context("When RetrieveFromDB returns an error", func() {
 			It("Should return an empty Analysis with the same error", func() {
 				fakeRetriever := FakeRetriever{
@@ -251,15 +243,6 @@ var _ = Describe("Postgres", func() {
 		})
 	})
 	Describe("FindOneDBUser", func() {
-		Context("When key map verification returns false", func() {
-			It("Should return an empty User with the expected error", func() {
-				postgres := PostgresRequests{}
-				repo, err := postgres.FindOneDBUser(
-					map[string]interface{}{"Wrong Key": "Failed"})
-				Expect(repo).To(Equal(types.User{}))
-				Expect(err).To(Equal(errors.New("Could not find user in DB")))
-			})
-		})
 		Context("When RetrieveFromDB returns an error", func() {
 			It("Should return an empty User with the same error", func() {
 				fakeRetriever := FakeRetriever{
@@ -296,15 +279,6 @@ var _ = Describe("Postgres", func() {
 		})
 	})
 	Describe("FindOneDBAccessToken", func() {
-		Context("When key map verification returns false", func() {
-			It("Should return an empty DBToken with the expected error", func() {
-				postgres := PostgresRequests{}
-				repo, err := postgres.FindOneDBAccessToken(
-					map[string]interface{}{"Wrong Key": "Failed"})
-				Expect(repo).To(Equal(types.DBToken{}))
-				Expect(err).To(Equal(errors.New("Could not find uuid parameter")))
-			})
-		})
 		Context("When RetrieveFromDB returns an error", func() {
 			It("Should return an empty DBToken with the same error", func() {
 				fakeRetriever := FakeRetriever{
@@ -355,12 +329,12 @@ var _ = Describe("Postgres", func() {
 				params := map[string]interface{}{"teste1": "myTest", "teste2": 1}
 				query, vals := ConfigureQuery(`SELECT * FROM test`, params)
 				if _, ok := vals[0].(string); ok {
-					expectedQuery := `SELECT * FROM test WHERE teste1 = $1 AND teste2 = $2`
+					expectedQuery := `SELECT * FROM test WHERE "teste1" = $1 AND "teste2" = $2`
 					expectedVals := []interface{}{"myTest", 1}
 					Expect(query).To(Equal(expectedQuery))
 					Expect(vals).To(Equal(expectedVals))
 				} else {
-					expectedQuery := `SELECT * FROM test WHERE teste2 = $1 AND teste1 = $2`
+					expectedQuery := `SELECT * FROM test WHERE "teste2" = $1 AND "teste1" = $2`
 					expectedVals := []interface{}{1, "myTest"}
 					Expect(query).To(Equal(expectedQuery))
 					Expect(vals).To(Equal(expectedVals))
@@ -369,7 +343,7 @@ var _ = Describe("Postgres", func() {
 		})
 		Context("When a query is passed with only one parameter", func() {
 			It("Should return the expected final query with just one argument", func() {
-				expectedQuery := `SELECT * FROM test WHERE teste1 = $1`
+				expectedQuery := `SELECT * FROM test WHERE "teste1" = $1`
 				expectedVals := []interface{}{"myTest"}
 				params := map[string]interface{}{"teste1": "myTest"}
 				query, vals := ConfigureQuery(`SELECT * FROM test`, params)
@@ -604,8 +578,12 @@ var _ = Describe("Postgres", func() {
 				fakeRetriever := FakeRetriever{
 					expectedWriteError: errors.New("Failed to write data in DB"),
 				}
+				fakeJson := FakeJson{
+					expectedMarshalData: nil,
+				}
 				postgres := PostgresRequests{
 					DataRetriever: &fakeRetriever,
+					JSONHandler:   &fakeJson,
 				}
 				Expect(
 					postgres.InsertDBAnalysis(analysis)).To(
@@ -618,8 +596,12 @@ var _ = Describe("Postgres", func() {
 					expectedWriteError: nil,
 					expectedNumberRows: 0,
 				}
+				fakeJson := FakeJson{
+					expectedMarshalData: nil,
+				}
 				postgres := PostgresRequests{
 					DataRetriever: &fakeRetriever,
+					JSONHandler:   &fakeJson,
 				}
 				Expect(postgres.InsertDBAnalysis(analysis)).To(
 					Equal(errors.New("No data was inserted")))
@@ -631,8 +613,12 @@ var _ = Describe("Postgres", func() {
 					expectedWriteError: nil,
 					expectedNumberRows: 1,
 				}
+				fakeJson := FakeJson{
+					expectedMarshalData: nil,
+				}
 				postgres := PostgresRequests{
 					DataRetriever: &fakeRetriever,
+					JSONHandler:   &fakeJson,
 				}
 				Expect(postgres.InsertDBAnalysis(analysis)).To(BeNil())
 			})
@@ -815,13 +801,29 @@ var _ = Describe("Postgres", func() {
 					Equal(errors.New("Empty fields to search")))
 			})
 		})
+		Context("When ConfigureAnalysisData returns an error", func() {
+			It("Should return the same error", func() {
+				fakeJson := FakeJson{
+					expectedMarshalError: errors.New("Failed to Marshal data"),
+				}
+				postgres := PostgresRequests{
+					JSONHandler: &fakeJson,
+				}
+				Expect(postgres.UpdateOneDBAnalysis(validParams, validUpdate)).To(
+					Equal(fakeJson.expectedMarshalError))
+			})
+		})
 		Context("When WriteInDB returns an error", func() {
 			It("Should return the same error", func() {
+				fakeJson := FakeJson{
+					expectedMarshalError: nil,
+				}
 				fakeRetriever := FakeRetriever{
 					expectedWriteError: errors.New("Failed to write in DB"),
 				}
 				postgres := PostgresRequests{
 					DataRetriever: &fakeRetriever,
+					JSONHandler:   &fakeJson,
 				}
 				Expect(postgres.UpdateOneDBAnalysis(validParams, validUpdate)).To(
 					Equal(fakeRetriever.expectedWriteError))
@@ -829,12 +831,16 @@ var _ = Describe("Postgres", func() {
 		})
 		Context("When WriteInDB returns 0 rows affected", func() {
 			It("Should return the expected error", func() {
+				fakeJson := FakeJson{
+					expectedMarshalError: nil,
+				}
 				fakeRetriever := FakeRetriever{
 					expectedWriteError: nil,
 					expectedNumberRows: 0,
 				}
 				postgres := PostgresRequests{
 					DataRetriever: &fakeRetriever,
+					JSONHandler:   &fakeJson,
 				}
 				Expect(postgres.UpdateOneDBAnalysis(validParams, validUpdate)).To(
 					Equal(errors.New("No data was updated")))
@@ -842,12 +848,16 @@ var _ = Describe("Postgres", func() {
 		})
 		Context("When WriteInDB returns a number of rows affected", func() {
 			It("Should return a nil error", func() {
+				fakeJson := FakeJson{
+					expectedMarshalError: nil,
+				}
 				fakeRetriever := FakeRetriever{
 					expectedWriteError: nil,
 					expectedNumberRows: 1,
 				}
 				postgres := PostgresRequests{
 					DataRetriever: &fakeRetriever,
+					JSONHandler:   &fakeJson,
 				}
 				Expect(postgres.UpdateOneDBAnalysis(validParams, validUpdate)).To(
 					BeNil())
@@ -932,13 +942,29 @@ var _ = Describe("Postgres", func() {
 					Equal(errors.New("Empty fields to search")))
 			})
 		})
+		Context("When ConfigureAnalysisData returns an error", func() {
+			It("Should return the same error", func() {
+				fakeJson := FakeJson{
+					expectedMarshalError: errors.New("Failed trying to Marshal data"),
+				}
+				postgres := PostgresRequests{
+					JSONHandler: &fakeJson,
+				}
+				Expect(postgres.UpdateOneDBAnalysisContainer(validParams, validUpdate)).To(
+					Equal(fakeJson.expectedMarshalError))
+			})
+		})
 		Context("When WriteInDB returns an error", func() {
 			It("Should return the same error", func() {
+				fakeJson := FakeJson{
+					expectedMarshalError: nil,
+				}
 				fakeRetriever := FakeRetriever{
 					expectedWriteError: errors.New("Failed to write in DB"),
 				}
 				postgres := PostgresRequests{
 					DataRetriever: &fakeRetriever,
+					JSONHandler:   &fakeJson,
 				}
 				Expect(postgres.UpdateOneDBAnalysisContainer(validParams, validUpdate)).To(
 					Equal(fakeRetriever.expectedWriteError))
@@ -946,12 +972,16 @@ var _ = Describe("Postgres", func() {
 		})
 		Context("When WriteInDB returns 0 rows affected", func() {
 			It("Should return the expected error", func() {
+				fakeJson := FakeJson{
+					expectedMarshalError: nil,
+				}
 				fakeRetriever := FakeRetriever{
 					expectedWriteError: nil,
 					expectedNumberRows: 0,
 				}
 				postgres := PostgresRequests{
 					DataRetriever: &fakeRetriever,
+					JSONHandler:   &fakeJson,
 				}
 				Expect(postgres.UpdateOneDBAnalysisContainer(validParams, validUpdate)).To(
 					Equal(errors.New("No data was updated")))
@@ -959,12 +989,16 @@ var _ = Describe("Postgres", func() {
 		})
 		Context("When WriteInDB returns a number of rows affected", func() {
 			It("Should return a nil error", func() {
+				fakeJson := FakeJson{
+					expectedMarshalError: nil,
+				}
 				fakeRetriever := FakeRetriever{
 					expectedWriteError: nil,
 					expectedNumberRows: 1,
 				}
 				postgres := PostgresRequests{
 					DataRetriever: &fakeRetriever,
+					JSONHandler:   &fakeJson,
 				}
 				Expect(postgres.UpdateOneDBAnalysisContainer(validParams, validUpdate)).To(
 					BeNil())
@@ -1100,12 +1134,12 @@ var _ = Describe("Postgres", func() {
 				}
 				finalQuery, values := ConfigureInsertQuery(query, params)
 				if _, ok := values[0].(string); ok {
-					expectedQuery := `INSERT into test (test1, test2) VALUES ($1, $2)`
+					expectedQuery := `INSERT into test ("test1", "test2") VALUES ($1, $2)`
 					expectedValues := []interface{}{"value1", 3}
 					Expect(finalQuery).To(Equal(expectedQuery))
 					Expect(values).To(Equal(expectedValues))
 				} else {
-					expectedQuery := `INSERT into test (test2, test1) VALUES ($1, $2)`
+					expectedQuery := `INSERT into test ("test2", "test1") VALUES ($1, $2)`
 					expectedValues := []interface{}{3, "value1"}
 					Expect(finalQuery).To(Equal(expectedQuery))
 					Expect(values).To(Equal(expectedValues))
@@ -1118,7 +1152,7 @@ var _ = Describe("Postgres", func() {
 				params := map[string]interface{}{
 					"test1": "value1",
 				}
-				expectedQuery := `INSERT into test (test1) VALUES ($1)`
+				expectedQuery := `INSERT into test ("test1") VALUES ($1)`
 				expectedValues := []interface{}{"value1"}
 				finalQuery, values := ConfigureInsertQuery(query, params)
 				Expect(finalQuery).To(Equal(expectedQuery))
@@ -1132,7 +1166,7 @@ var _ = Describe("Postgres", func() {
 				query := `UPDATE test`
 				searchValues := map[string]interface{}{"id": 1}
 				newValues := map[string]interface{}{"teste1": "newVal"}
-				expectedQuery := `UPDATE test SET teste1 = $2 WHERE id = $1`
+				expectedQuery := `UPDATE test SET "teste1" = $2 WHERE "id" = $1`
 				expectedValues := []interface{}{1, "newVal"}
 				finalQuery, values := ConfigureUpdateQuery(query, searchValues, newValues)
 				Expect(finalQuery).To(Equal(expectedQuery))
@@ -1147,24 +1181,24 @@ var _ = Describe("Postgres", func() {
 				finalQuery, values := ConfigureUpdateQuery(query, searchValues, newValues)
 				if _, ok := values[2].(string); ok {
 					if values[0].(int) == 1 {
-						expectedQuery := `UPDATE test SET teste1 = $3, teste2 = $4 WHERE id = $1 AND id2 = $2`
+						expectedQuery := `UPDATE test SET "teste1" = $3, "teste2" = $4 WHERE "id" = $1 AND "id2" = $2`
 						expectedValues := []interface{}{1, 2, "newVal", 3}
 						Expect(finalQuery).To(Equal(expectedQuery))
 						Expect(values).To(Equal(expectedValues))
 					} else {
-						expectedQuery := `UPDATE test SET teste1 = $3, teste2 = $4 WHERE id2 = $1 AND id = $2`
+						expectedQuery := `UPDATE test SET "teste1" = $3, "teste2" = $4 WHERE "id2" = $1 AND "id" = $2`
 						expectedValues := []interface{}{2, 1, "newVal", 3}
 						Expect(finalQuery).To(Equal(expectedQuery))
 						Expect(values).To(Equal(expectedValues))
 					}
 				} else {
 					if values[0].(int) == 1 {
-						expectedQuery := `UPDATE test SET teste2 = $3, teste1 = $4 WHERE id = $1 AND id2 = $2`
+						expectedQuery := `UPDATE test SET "teste2" = $3, "teste1" = $4 WHERE "id" = $1 AND "id2" = $2`
 						expectedValues := []interface{}{1, 2, 3, "newVal"}
 						Expect(finalQuery).To(Equal(expectedQuery))
 						Expect(values).To(Equal(expectedValues))
 					} else {
-						expectedQuery := `UPDATE test SET teste2 = $3, teste1 = $4 WHERE id2 = $1 AND id = $2`
+						expectedQuery := `UPDATE test SET "teste2" = $3, "teste1" = $4 WHERE "id2" = $1 AND "id" = $2`
 						expectedValues := []interface{}{2, 1, 3, "newVal"}
 						Expect(finalQuery).To(Equal(expectedQuery))
 						Expect(values).To(Equal(expectedValues))
@@ -1179,7 +1213,7 @@ var _ = Describe("Postgres", func() {
 				query := `INSERT into test`
 				newValues := map[string]interface{}{"value1": "teste1"}
 				columnsConflict := map[string]interface{}{"unique": "existed"}
-				expectedQuery := `INSERT into test (value1) VALUES ($1) ON CONFLICT (unique) DO UPDATE SET value1 = EXCLUDED.value1`
+				expectedQuery := `INSERT into test ("value1") VALUES ($1) ON CONFLICT ("unique") DO UPDATE SET "value1" = EXCLUDED."value1"`
 				expectedValues := []interface{}{"teste1"}
 				finalQuery, values := ConfigureUpsertQuery(query, columnsConflict, newValues)
 				Expect(finalQuery).To(Equal(expectedQuery))
@@ -1187,4 +1221,104 @@ var _ = Describe("Postgres", func() {
 			})
 		})
 	})
+	Describe("ConfigureAnalysisData", func() {
+		Context("When updatedAnalysis has containers and Marshal function returns an error", func() {
+			It("Should return the same error and the map variable passed in the argument", func() {
+				myCommits := []string{"author1", "author2"}
+				updatedAnalysis := map[string]interface{}{
+					"commitAuthors": myCommits,
+					"containers":    []types.Container{},
+				}
+				fakeJson := FakeJson{
+					expectedMarshalError: errors.New("Failed trying to Marshal data"),
+				}
+				fakeRetriever := FakeRetriever{
+					expectedPqArray: myCommits,
+				}
+				postgres := PostgresRequests{
+					JSONHandler:   &fakeJson,
+					DataRetriever: &fakeRetriever,
+				}
+				newUpdatedData, err := postgres.ConfigureAnalysisData(updatedAnalysis)
+				Expect(err).To(Equal(fakeJson.expectedMarshalError))
+				Expect(newUpdatedData).To(Equal(updatedAnalysis))
+			})
+		})
+		Context("When updatedAnalysis has huskyciresults and Marshal function returns an error ", func() {
+			It("Should return the same error and the map variable passed in the argument", func() {
+				myCommits := []string{"author1", "author2"}
+				updatedAnalysis := map[string]interface{}{
+					"commitAuthors":  myCommits,
+					"huskyciresults": types.HuskyCIResults{},
+				}
+				fakeJson := FakeJson{
+					expectedMarshalError: errors.New("Failed trying to Marshal data"),
+				}
+				fakeRetriever := FakeRetriever{
+					expectedPqArray: myCommits,
+				}
+				postgres := PostgresRequests{
+					JSONHandler:   &fakeJson,
+					DataRetriever: &fakeRetriever,
+				}
+				newUpdatedData, err := postgres.ConfigureAnalysisData(updatedAnalysis)
+				Expect(err).To(Equal(fakeJson.expectedMarshalError))
+				Expect(newUpdatedData).To(Equal(updatedAnalysis))
+			})
+		})
+		Context("When updatedAnalysis has codes and Marshal function returns an error ", func() {
+			It("Should return the same error and the map variable passed in the argument", func() {
+				myCommits := []string{"author1", "author2"}
+				updatedAnalysis := map[string]interface{}{
+					"commitAuthors": myCommits,
+					"codes":         []types.Code{},
+				}
+				fakeJson := FakeJson{
+					expectedMarshalError: errors.New("Failed trying to Marshal data"),
+				}
+				fakeRetriever := FakeRetriever{
+					expectedPqArray: myCommits,
+				}
+				postgres := PostgresRequests{
+					JSONHandler:   &fakeJson,
+					DataRetriever: &fakeRetriever,
+				}
+				newUpdatedData, err := postgres.ConfigureAnalysisData(updatedAnalysis)
+				Expect(err).To(Equal(fakeJson.expectedMarshalError))
+				Expect(newUpdatedData).To(Equal(updatedAnalysis))
+			})
+		})
+		Context("When updatedAnalysis has all expected data with valid JSON returned in Marshal", func() {
+			It("Should return an nil error and the map variable passed in the argument", func() {
+				myCommits := []string{"author1", "author2"}
+				marshalData := []byte("ok")
+				updatedAnalysis := map[string]interface{}{
+					"commitAuthors":  myCommits,
+					"codes":          []types.Code{},
+					"containers":     []types.Container{},
+					"huskyciresults": types.HuskyCIResults{},
+				}
+				expectedAnalysis := map[string]interface{}{
+					"commitAuthors":  myCommits,
+					"codes":          marshalData,
+					"containers":     marshalData,
+					"huskyciresults": marshalData,
+				}
+				fakeJson := FakeJson{
+					expectedMarshalError: nil,
+					expectedMarshalData:  marshalData,
+				}
+				fakeRetriever := FakeRetriever{
+					expectedPqArray: myCommits,
+				}
+				postgres := PostgresRequests{
+					JSONHandler:   &fakeJson,
+					DataRetriever: &fakeRetriever,
+				}
+				newUpdatedData, err := postgres.ConfigureAnalysisData(updatedAnalysis)
+				Expect(err).To(BeNil())
+				Expect(newUpdatedData).To(Equal(expectedAnalysis))
+			})
+		})
+	})
 })
diff --git a/api/securitytest/enry.go b/api/securitytest/enry.go
index ea4712a..b755ce6 100644
--- a/api/securitytest/enry.go
+++ b/api/securitytest/enry.go
@@ -10,17 +10,12 @@ import (
 	"reflect"
 
 	"github.com/globocom/huskyCI/api/log"
+	"github.com/globocom/huskyCI/api/types"
 )
 
 // EnryOutput is the struct that holds all data from Gosec output.
 type EnryOutput struct {
-	Codes []Code
-}
-
-// Code is the struct that stores all data from code found in a repository.
-type Code struct {
-	Language string   `bson:"language" json:"language"`
-	Files    []string `bson:"files" json:"files"`
+	Codes []types.Code
 }
 
 func analyzeEnry(enryScan *SecTestScanInfo) error {
@@ -39,7 +34,7 @@ func analyzeEnry(enryScan *SecTestScanInfo) error {
 }
 
 func (enryScan *SecTestScanInfo) prepareEnryOutput() error {
-	repositoryLanguages := []Code{}
+	repositoryLanguages := []types.Code{}
 	mapLanguages := make(map[string][]interface{})
 	err := json.Unmarshal([]byte(enryScan.Container.COutput), &mapLanguages)
 	if err != nil {
@@ -57,7 +52,7 @@ func (enryScan *SecTestScanInfo) prepareEnryOutput() error {
 				return errMsg
 			}
 		}
-		newLanguage := Code{
+		newLanguage := types.Code{
 			Language: name,
 			Files:    fs,
 		}
diff --git a/api/securitytest/run.go b/api/securitytest/run.go
index 8f95a12..4c080dc 100644
--- a/api/securitytest/run.go
+++ b/api/securitytest/run.go
@@ -14,7 +14,7 @@ type RunAllInfo struct {
 	Status         string
 	Containers     []types.Container
 	CommitAuthors  []string
-	Codes          []Code
+	Codes          []types.Code
 	FinalResult    string
 	ErrorFound     error
 	HuskyCIResults types.HuskyCIResults
@@ -334,6 +334,9 @@ func getAllDefaultSecurityTests(typeOf, language string) ([]types.SecurityTest,
 	}
 	securityTests, err := apiContext.APIConfiguration.DBInstance.FindAllDBSecurityTest(securityTestQuery)
 	if err != nil {
+		if err.Error() == "No data found" {
+			return securityTests, nil
+		}
 		log.Error("getAllDefaultSecurityTests", "SECURITYTEST", 2009, err)
 		return securityTests, err
 	}
diff --git a/api/securitytest/securitytest.go b/api/securitytest/securitytest.go
index f046428..809b55e 100644
--- a/api/securitytest/securitytest.go
+++ b/api/securitytest/securitytest.go
@@ -40,7 +40,7 @@ type SecTestScanInfo struct {
 	YarnErrorRunning      bool
 	CommitAuthorsNotFound bool
 	CommitAuthors         GitAuthorsOutput
-	Codes                 []Code
+	Codes                 []types.Code
 	Container             types.Container
 	FinalOutput           interface{}
 	Vulnerabilities       types.HuskyCISecurityTestOutput
diff --git a/client/integration/sonarqube/sonarqube_test.go b/client/integration/sonarqube/sonarqube_test.go
index 4419493..524c641 100644
--- a/client/integration/sonarqube/sonarqube_test.go
+++ b/client/integration/sonarqube/sonarqube_test.go
@@ -52,6 +52,7 @@ var _ = Describe("SonarQube", func() {
 			Entry("Vulnerable python project", "vulnerable_python_project.json", testOutputFilesPath, "sonarqube_python_test.json", "vulnerable_python_output.json"),
 			Entry("Vulnerable ruby project", "vulnerable_ruby_project.json", testOutputFilesPath, "sonarqube_ruby_test.json", "vulnerable_ruby_output.json"),
 			Entry("Vulnerable js project", "vulnerable_js_project.json", testOutputFilesPath, "sonarqube_js_test.json", "vulnerable_js_output.json"),
+			Entry("Not Vulnerable project", "not_vulnerable_project.json", testOutputFilesPath, "sonarqube_not_vulnerable_test.json", "not_vulnerable_output.json"),
 		)
 	})
 })
diff --git a/client/integration/sonarqube/testdata/analysis/not_vulnerable_project.json b/client/integration/sonarqube/testdata/analysis/not_vulnerable_project.json
new file mode 100644
index 0000000..038d04c
--- /dev/null
+++ b/client/integration/sonarqube/testdata/analysis/not_vulnerable_project.json
@@ -0,0 +1,93 @@
+{
+    "_id" : "5ddd34734570ce1f149b3506",
+    "result" : "passed",
+    "containers" : [ 
+        {
+            "CID" : "f16680321512487dde9823b0ef21c0ab38bff7e1828be69408b6dee68f409564",
+            "securityTest" : {
+                "_id" : "5ddd31ba4570ce1f149b315d",
+                "name" : "gitauthors",
+                "image" : "huskyci/gitauthors",
+                "imageTag" : "2.18.1",
+                "cmd" : "mkdir -p ~/.ssh &&\necho 'GIT_PRIVATE_SSH_KEY' > ~/.ssh/huskyci_id_rsa &&\nchmod 600 ~/.ssh/huskyci_id_rsa &&\necho \"IdentityFile ~/.ssh/huskyci_id_rsa\" >> /etc/ssh/ssh_config &&\necho \"StrictHostKeyChecking no\" >> /etc/ssh/ssh_config &&\ngit clone %GIT_REPO% code --quiet 2> /tmp/errorGitCloneEnry\ncd code\ngit checkout %GIT_BRANCH% --quiet\nif [ $? -eq 0 ]; then\n  for i in $(git log origin/master.. --pretty=\"%ae\" | sort -u); do\n    jsonMiddle=\"\\\"$i\\\",$jsonMiddle\"\n  done\n  length=${#jsonMiddle}\n  endindex=$(expr $length - 1)\n  authors=\"${jsonMiddle:0:$endindex}\"\n  echo \"{\\\"authors\\\":[$authors]}\"\nelse\n  echo \"ERROR_CLONING\"\n  cat /tmp/errorGitCloneEnry\nfi\n",
+                "type" : "Generic",
+                "language" : "",
+                "default" : true,
+                "timeOutSeconds" : 60
+            },
+            "cStatus" : "finished",
+            "cOutput" : "{\"authors\":[]}\r\n",
+            "cResult" : "passed",
+            "cInfo" : "Could not get authors. Probably master branch is being analyzed.",
+            "startedAt" : "2019-11-26T11:19:38.755-03:00",
+            "finishedAt" : "2019-11-26T11:19:45.934-03:00"
+        }, 
+        {
+            "CID" : "50a7ae3bd99bc62eb3814b964dde1a51cf0019b077cbddf7cdb1c4feeb70a5ac",
+            "securityTest" : {
+                "_id" : "5ddd31ba4570ce1f149b316b",
+                "name" : "gitleaks",
+                "image" : "huskyci/gitleaks",
+                "imageTag" : "2.1.0",
+                "cmd" : "mkdir -p ~/.ssh &&\necho 'GIT_PRIVATE_SSH_KEY' > ~/.ssh/huskyci_id_rsa &&\nchmod 600 ~/.ssh/huskyci_id_rsa &&\necho \"IdentityFile ~/.ssh/huskyci_id_rsa\" >> /etc/ssh/ssh_config &&\necho \"StrictHostKeyChecking no\" >> /etc/ssh/ssh_config &&\ngit clone -b %GIT_BRANCH% --single-branch %GIT_REPO% code --quiet 2> /tmp/errorGitCloneGitleaks\nif [ $? -eq 0 ]; then\n    touch /tmp/results.json\n    $(which gitleaks) --log=warn --report=/tmp/results.json --repo-path=./code --repo-config > /tmp/errorGitleaks\n    if [ $? -eq 2 ]; then\n        echo -n 'ERROR_RUNNING_GITLEAKS'\n        cat /tmp/errorGitleaks\n    else\n        jq -j -M -c . /tmp/results.json\n    fi\nelse\n    echo \"ERROR_CLONING\"\n    cat /tmp/errorGitCloneGitleaks\nfi\n",
+                "type" : "Generic",
+                "language" : "",
+                "default" : true,
+                "timeOutSeconds" : 360
+            },
+            "cStatus" : "finished",
+            "cOutput" : "",
+            "cResult" : "passed",
+            "cInfo" : "No issues found.",
+            "startedAt" : "2019-11-26T11:19:38.755-03:00",
+            "finishedAt" : "2019-11-26T11:20:17.714-03:00"
+        }, 
+        {
+            "CID" : "096faa812028a53bc9eabc5df44d30cdf72ff615ceb758df81bbdb0276449241",
+            "securityTest" : {
+                "_id" : "5ddd31ba4570ce1f149b315f",
+                "name" : "gosec",
+                "image" : "huskyci/gosec",
+                "imageTag" : "v2.1.0",
+                "cmd" : "mkdir -p ~/.ssh &&\necho 'GIT_PRIVATE_SSH_KEY' > ~/.ssh/huskyci_id_rsa &&\nchmod 600 ~/.ssh/huskyci_id_rsa &&\necho \"IdentityFile ~/.ssh/huskyci_id_rsa\" >> /etc/ssh/ssh_config &&\necho \"StrictHostKeyChecking no\" >> /etc/ssh/ssh_config &&\ncd src\ngit clone -b %GIT_BRANCH% --single-branch %GIT_REPO% code --quiet 2> /tmp/errorGitCloneGosec\nif [ $? -eq 0 ]; then\n  cd code\n  touch results.json\n  $(which gosec) -quiet -fmt=json -log=log.txt -out=results.json ./... 2> /dev/null\n  jq -j -M -c . results.json\nelse\n  echo \"ERROR_CLONING\"\n  cat /tmp/errorGitCloneGosec\nfi\n",
+                "type" : "Language",
+                "language" : "Go",
+                "default" : true,
+                "timeOutSeconds" : 360
+            },
+            "cStatus" : "finished",
+            "cOutput" : "",
+            "cResult" : "passed",
+            "cInfo" : "No issues found.",
+            "startedAt" : "2019-11-26T11:19:38.764-03:00",
+            "finishedAt" : "2019-11-26T11:20:31.350-03:00"
+        }
+    ],
+    "startedAt" : "2019-11-26T11:19:31.987-03:00",
+    "RID" : "PHqtSLeYbz4yH92ub39JvGp1t7vlJIG1",
+    "repositoryURL" : "https://gitlab.com/rafaveira3/appsec-defcon27-huskyci.git",
+    "repositoryBranch" : "master",
+    "status" : "finished",
+    "codes" : [ 
+        {
+            "language" : "Go",
+            "files" : [ 
+                "api/routes/healthcheck.go", 
+                "api/server.go", 
+                "api/util/util.go", 
+                "api/util/util_suite_test.go", 
+                "api/util/util_test.go"
+            ]
+        }, 
+        {
+            "language" : "Makefile",
+            "files" : [ 
+                "Makefile"
+            ]
+        }
+    ],
+    "commitAuthors" : [],
+    "errorFound" : "",
+    "finishedAt" : "2019-11-26T11:20:31.351-03:00",
+    "huskyciresults" : {}
+}
\ No newline at end of file
diff --git a/client/integration/sonarqube/testdata/sonarqube/not_vulnerable_output.json b/client/integration/sonarqube/testdata/sonarqube/not_vulnerable_output.json
new file mode 100644
index 0000000..34ad1a3
--- /dev/null
+++ b/client/integration/sonarqube/testdata/sonarqube/not_vulnerable_output.json
@@ -0,0 +1,1 @@
+{"issues":[]}
\ No newline at end of file