Skip to content

Commit

Permalink
Avoid to return the secret text from API (#530)
Browse files Browse the repository at this point in the history
  • Loading branch information
LinuxSuRen authored Apr 15, 2022
1 parent 7b0c6f3 commit 84316c7
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions pkg/models/devops/devops.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ func (d devopsOperator) ListPipelineObj(projectName string, query *query.Query)
return *resourcesV1alpha3.DefaultList(result, query, resourcesV1alpha3.DefaultCompare(), resourcesV1alpha3.DefaultFilter()), nil
}

//credentialobj in crd
// CreateCredentialObj creates a secret
func (d devopsOperator) CreateCredentialObj(projectName string, secret *v1.Secret) (*v1.Secret, error) {
projectObj, err := d.ksclient.DevopsV1alpha3().DevOpsProjects().Get(d.context, projectName, metav1.GetOptions{})
if err != nil {
Expand All @@ -342,9 +342,7 @@ func (d devopsOperator) GetCredentialObj(projectName string, secretName string)
if secret, err := d.k8sclient.CoreV1().Secrets(projectObj.Status.AdminNamespace).Get(d.context, secretName, metav1.GetOptions{}); err != nil {
return nil, err
} else {
// TODO Mask the secret if there is no place to use plain secret.
// return secretutil.MaskCredential(secret), nil
return secret, nil
return secretutil.MaskCredential(secret), nil
}
}

Expand Down

0 comments on commit 84316c7

Please sign in to comment.