From 90e7ecf39ecce01d8cd4535de2fbfa0648a66180 Mon Sep 17 00:00:00 2001 From: Benedikt Bock Date: Wed, 15 Dec 2021 17:21:44 +0100 Subject: [PATCH] remove plaintext runner token from observation Signed-off-by: Benedikt Bock (external expert on behalf of DB Netz AG) --- apis/groups/v1alpha1/group_types.go | 1 - apis/projects/v1alpha1/project_types.go | 1 - .../crds/groups.gitlab.crossplane.io_groups.yaml | 2 -- .../projects.gitlab.crossplane.io_projects.yaml | 2 -- pkg/clients/groups/group.go | 13 ++++++------- pkg/clients/projects/project.go | 1 - pkg/controller/groups/group_test.go | 2 +- pkg/controller/projects/project_test.go | 2 +- 8 files changed, 8 insertions(+), 16 deletions(-) diff --git a/apis/groups/v1alpha1/group_types.go b/apis/groups/v1alpha1/group_types.go index fd226424..7759877e 100644 --- a/apis/groups/v1alpha1/group_types.go +++ b/apis/groups/v1alpha1/group_types.go @@ -216,7 +216,6 @@ type GroupObservation struct { FullPath string `json:"fullPath,omitempty"` Statistics *StorageStatistics `json:"statistics,omitempty"` CustomAttributes []CustomAttribute `json:"customAttributes,omitempty"` - RunnersToken string `json:"runnersToken,omitempty"` SharedWithGroups []SharedWithGroups `json:"sharedWithGroups,omitempty"` LDAPCN string `json:"ldapCn,omitempty"` LDAPAccess AccessLevelValue `json:"ldapAccess,omitempty"` diff --git a/apis/projects/v1alpha1/project_types.go b/apis/projects/v1alpha1/project_types.go index b3957b42..b604e915 100644 --- a/apis/projects/v1alpha1/project_types.go +++ b/apis/projects/v1alpha1/project_types.go @@ -530,7 +530,6 @@ type ProjectObservation struct { Permissions *Permissions `json:"permissions,omitempty"` Public bool `json:"public,omitempty"` ReadmeURL string `json:"readmeUrl,omitempty"` - RunnersToken string `json:"runnersToken,omitempty"` SSHURLToRepo string `json:"sshUrlToRepo,omitempty"` ServiceDeskAddress string `json:"serviceDeskAddress,omitempty"` SharedWithGroups []SharedWithGroups `json:"sharedWithGroups,omitempty"` diff --git a/package/crds/groups.gitlab.crossplane.io_groups.yaml b/package/crds/groups.gitlab.crossplane.io_groups.yaml index 66462533..3d00c279 100644 --- a/package/crds/groups.gitlab.crossplane.io_groups.yaml +++ b/package/crds/groups.gitlab.crossplane.io_groups.yaml @@ -224,8 +224,6 @@ spec: markedForDeletionOn: format: date-time type: string - runnersToken: - type: string sharedWithGroups: items: description: SharedWithGroups represents a GitLab Shared with groups. diff --git a/package/crds/projects.gitlab.crossplane.io_projects.yaml b/package/crds/projects.gitlab.crossplane.io_projects.yaml index b6b9481a..b8a4cce3 100644 --- a/package/crds/projects.gitlab.crossplane.io_projects.yaml +++ b/package/crds/projects.gitlab.crossplane.io_projects.yaml @@ -627,8 +627,6 @@ spec: type: boolean readmeUrl: type: string - runnersToken: - type: string serviceDeskAddress: type: string sharedWithGroups: diff --git a/pkg/clients/groups/group.go b/pkg/clients/groups/group.go index ebb33c6b..79686e7f 100644 --- a/pkg/clients/groups/group.go +++ b/pkg/clients/groups/group.go @@ -75,13 +75,12 @@ func GenerateObservation(grp *gitlab.Group) v1alpha1.GroupObservation { // nolin return v1alpha1.GroupObservation{} } group := v1alpha1.GroupObservation{ - ID: grp.ID, - AvatarURL: grp.AvatarURL, - WebURL: grp.WebURL, - FullName: grp.FullName, - FullPath: grp.FullPath, - RunnersToken: grp.RunnersToken, - LDAPCN: grp.LDAPCN, + ID: grp.ID, + AvatarURL: grp.AvatarURL, + WebURL: grp.WebURL, + FullName: grp.FullName, + FullPath: grp.FullPath, + LDAPCN: grp.LDAPCN, } if grp.CreatedAt != nil { diff --git a/pkg/clients/projects/project.go b/pkg/clients/projects/project.go index 69895f5c..072e934c 100644 --- a/pkg/clients/projects/project.go +++ b/pkg/clients/projects/project.go @@ -81,7 +81,6 @@ func GenerateObservation(prj *gitlab.Project) v1alpha1.ProjectObservation { // n Archived: prj.Archived, ForksCount: prj.ForksCount, StarCount: prj.StarCount, - RunnersToken: prj.RunnersToken, EmptyRepo: prj.EmptyRepo, AvatarURL: prj.AvatarURL, LicenseURL: prj.LicenseURL, diff --git a/pkg/controller/groups/group_test.go b/pkg/controller/groups/group_test.go index 6279f872..5ef25a33 100644 --- a/pkg/controller/groups/group_test.go +++ b/pkg/controller/groups/group_test.go @@ -277,7 +277,7 @@ func TestObserve(t *testing.T) { withConditions(xpv1.Available()), withPath(path), withAnnotations(extNameAnnotation), - withStatus(v1alpha1.GroupObservation{RunnersToken: "token"}), + withStatus(v1alpha1.GroupObservation{}), ), result: managed.ExternalObservation{ ResourceExists: true, diff --git a/pkg/controller/projects/project_test.go b/pkg/controller/projects/project_test.go index ce4cffef..731fd45d 100644 --- a/pkg/controller/projects/project_test.go +++ b/pkg/controller/projects/project_test.go @@ -282,7 +282,7 @@ func TestObserve(t *testing.T) { withConditions(xpv1.Available()), withPath(&path), withExternalName(extName), - withStatus(v1alpha1.ProjectObservation{RunnersToken: "token"}), + withStatus(v1alpha1.ProjectObservation{}), ), result: managed.ExternalObservation{ ResourceExists: true,