From ba6edb55b5b3f0b21f915d0733ad71b2ef943c2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Gryglicki?= Date: Wed, 6 Aug 2025 08:09:42 +0200 Subject: [PATCH] Revert "Remove non-inclusive language (#4738)" --- .github/ISSUE_TEMPLATE/docs_update.md | 4 +- .github/workflows/codeql-analysis.yml | 4 +- .gitignore | 1 - README.md | 4 +- cla-backend-go/approval_list/handlers.go | 52 +++---- cla-backend-go/approval_list/helpers.go | 10 +- cla-backend-go/approval_list/models.go | 4 +- cla-backend-go/approval_list/repository.go | 12 +- cla-backend-go/approval_list/service.go | 12 +- .../cmd/repositories/repositories.go | 6 +- cla-backend-go/events/repository.go | 2 +- cla-backend-go/github/github-schema.graphql | 4 +- cla-backend-go/projects_cla_groups/service.go | 2 +- cla-backend-go/signatures/constants.go | 8 +- cla-backend-go/signatures/handlers.go | 28 ++-- .../signatures/mocks/mock_service.go | 4 +- cla-backend-go/signatures/repository.go | 4 +- cla-backend-go/signatures/service.go | 8 +- cla-backend-go/swagger/cla.v1.yaml | 50 +++---- cla-backend-go/swagger/cla.v2.yaml | 14 +- ...g-allowlist.yaml => gh-org-whitelist.yaml} | 4 +- cla-backend-go/swagger/common/github-org.yaml | 2 +- cla-backend-go/swagger/common/health.yaml | 2 +- cla-backend-go/swagger/common/version.yaml | 2 +- cla-backend-go/users/repository.go | 2 +- cla-backend-go/users/service.go | 2 +- cla-backend-go/v2/dynamo_events/signatures.go | 8 +- cla-backend-go/v2/signatures/handlers.go | 44 +++--- cla-backend/.pylintrc | 4 +- cla-backend/cla/controllers/company.py | 12 +- cla-backend/cla/controllers/signature.py | 96 ++++++------ cla-backend/cla/controllers/signing.py | 4 +- cla-backend/cla/controllers/user.py | 42 +++--- cla-backend/cla/models/docusign_models.py | 4 +- cla-backend/cla/models/dynamo_models.py | 140 ++++++++---------- cla-backend/cla/models/event_types.py | 4 +- cla-backend/cla/models/github_models.py | 10 +- cla-backend/cla/models/model_interfaces.py | 64 ++++---- cla-backend/cla/routes.py | 26 ++-- .../tests/unit/test_email_approval_list.py | 6 +- cla-backend/cla/tests/unit/test_github.py | 12 +- .../cla/tests/unit/test_github_controller.py | 10 +- .../tests/unit/test_signature_controller.py | 26 ++-- cla-backend/cla/tests/unit/test_user_event.py | 12 +- cla-backend/cla/tests/unit/test_utils.py | 22 +-- cla-backend/cla/utils.py | 50 +++---- ..._allowlist.py => add_company_whitelist.py} | 8 +- cla-backend/helpers/create_company.py | 4 +- cla-backend/helpers/create_data.py | 8 +- cla-next.md | 4 +- dev.md | 2 +- schema.md | 2 - tests/functional/cypress/e2e/signatures.cy.ts | 4 +- utils/check_unique.sh | 1 - utils/get_oauth_token.sh | 3 - utils/get_oauth_token_prod.sh | 3 - utils/lookup_sf.sh | 1 - utils/scan.sh | 1 - utils/search_aws_log_group.sh | 19 +-- 59 files changed, 432 insertions(+), 471 deletions(-) rename cla-backend-go/swagger/common/{gh-org-allowlist.yaml => gh-org-whitelist.yaml} (73%) rename cla-backend/helpers/{add_company_allowlist.py => add_company_whitelist.py} (70%) delete mode 100755 utils/get_oauth_token.sh delete mode 100755 utils/get_oauth_token_prod.sh diff --git a/.github/ISSUE_TEMPLATE/docs_update.md b/.github/ISSUE_TEMPLATE/docs_update.md index 1cc4d6328..e8d2f6059 100644 --- a/.github/ISSUE_TEMPLATE/docs_update.md +++ b/.github/ISSUE_TEMPLATE/docs_update.md @@ -10,7 +10,7 @@ assignees: '' Describe what has changed and which documents need updating -* [/docs/doc-to-update.md](https://github.com/linuxfoundation/easycla/blob/main/docs/) +* [/docs/doc-to-update.md](https://github.com/linuxfoundation/easycla/blob/master/docs/) ## Tasks @@ -29,7 +29,7 @@ The "done" criteria when this feature or problem is resolved. Such as: 1. Documentation changes submitted as a Pull Request 1. Pull Request Reviewed and Approved by Product Owner -1. Documentation changes merged to 'main' branch +1. Documentation changes merged to 'master' branch ## Images diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 8f512f781..23442df53 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -5,10 +5,10 @@ name: "CodeQL" on: push: - branches: [main, ] + branches: [master, ] pull_request: # The branches below must be a subset of the branches above - branches: [main] + branches: [master] schedule: - cron: '0 5 * * 4' diff --git a/.gitignore b/.gitignore index a2291b9ac..8d4eb5fcc 100755 --- a/.gitignore +++ b/.gitignore @@ -246,7 +246,6 @@ cla-backend/run-python-test-example-*.py out *.secret *log*.json -cover.out # Cypress test outputs **/cypress/screenshots/ diff --git a/README.md b/README.md index 94abdcd65..dfcafd989 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Introduction to EasyCLA -[![Build Status](https://github.com/linuxfoundation/easycla/actions/workflows/deploy-prod.yml/badge.svg)](https://github.com/linuxfoundation/easycla/actions/workflows/deploy-prod.yml) +[![CircleCI](https://circleci.com/gh/communitybridge/easycla.svg?style=svg)](https://circleci.com/gh/communitybridge/easycla) The Contributor License Agreement \(CLA\) service of the Linux Foundation lets project contributors read, sign, and submit contributor license agreements easily. @@ -10,7 +10,7 @@ This platform supports both GitHub and Gerrit source code repositories. Addition ## Announcements -- 8/2025 - We have replaced code references from whitelist to Approved List. This includes package names, code comments, swagger specifications, API endpoints, variable names, and UI components. +- 06/10/2020 - We have replaced code references from whitelist to Approved List. This includes package names, code comments, swagger specifications, API endpoints, variable names, and UI components. ## Third-party Services diff --git a/cla-backend-go/approval_list/handlers.go b/cla-backend-go/approval_list/handlers.go index ff926f607..069399e08 100644 --- a/cla-backend-go/approval_list/handlers.go +++ b/cla-backend-go/approval_list/handlers.go @@ -23,13 +23,13 @@ import ( // Configure setups handlers on api with service func Configure(api *operations.ClaAPI, service IService, sessionStore *dynastore.Store, signatureService signatures.SignatureService, eventsService events.Service) { - api.CompanyAddCclaAllowlistRequestHandler = company.AddCclaAllowlistRequestHandlerFunc( - func(params company.AddCclaAllowlistRequestParams) middleware.Responder { + api.CompanyAddCclaWhitelistRequestHandler = company.AddCclaWhitelistRequestHandlerFunc( + func(params company.AddCclaWhitelistRequestParams) middleware.Responder { reqID := utils.GetRequestID(params.XREQUESTID) ctx := context.WithValue(context.Background(), utils.XREQUESTID, reqID) // nolint requestID, err := service.AddCclaApprovalListRequest(ctx, params.CompanyID, params.ProjectID, params.Body) if err != nil { - return company.NewAddCclaAllowlistRequestBadRequest().WithXRequestID(reqID).WithPayload(errorResponse(err)) + return company.NewAddCclaWhitelistRequestBadRequest().WithXRequestID(reqID).WithPayload(errorResponse(err)) } eventsService.LogEventWithContext(ctx, &events.LogEventArgs{ @@ -40,16 +40,16 @@ func Configure(api *operations.ClaAPI, service IService, sessionStore *dynastore EventData: &events.CCLAApprovalListRequestCreatedEventData{RequestID: requestID}, }) - return company.NewAddCclaAllowlistRequestOK().WithXRequestID(reqID) + return company.NewAddCclaWhitelistRequestOK().WithXRequestID(reqID) }) - api.CompanyApproveCclaAllowlistRequestHandler = company.ApproveCclaAllowlistRequestHandlerFunc( - func(params company.ApproveCclaAllowlistRequestParams, claUser *user.CLAUser) middleware.Responder { + api.CompanyApproveCclaWhitelistRequestHandler = company.ApproveCclaWhitelistRequestHandlerFunc( + func(params company.ApproveCclaWhitelistRequestParams, claUser *user.CLAUser) middleware.Responder { reqID := utils.GetRequestID(params.XREQUESTID) ctx := context.WithValue(context.Background(), utils.XREQUESTID, reqID) // nolint err := service.ApproveCclaApprovalListRequest(ctx, claUser, params.CompanyID, params.ProjectID, params.RequestID) if err != nil { - return company.NewApproveCclaAllowlistRequestBadRequest().WithXRequestID(reqID).WithPayload(errorResponse(err)) + return company.NewApproveCclaWhitelistRequestBadRequest().WithXRequestID(reqID).WithPayload(errorResponse(err)) } eventsService.LogEventWithContext(ctx, &events.LogEventArgs{ @@ -60,16 +60,16 @@ func Configure(api *operations.ClaAPI, service IService, sessionStore *dynastore EventData: &events.CCLAApprovalListRequestApprovedEventData{RequestID: params.RequestID}, }) - return company.NewApproveCclaAllowlistRequestOK().WithXRequestID(reqID) + return company.NewApproveCclaWhitelistRequestOK().WithXRequestID(reqID) }) - api.CompanyRejectCclaAllowlistRequestHandler = company.RejectCclaAllowlistRequestHandlerFunc( - func(params company.RejectCclaAllowlistRequestParams, claUser *user.CLAUser) middleware.Responder { + api.CompanyRejectCclaWhitelistRequestHandler = company.RejectCclaWhitelistRequestHandlerFunc( + func(params company.RejectCclaWhitelistRequestParams, claUser *user.CLAUser) middleware.Responder { reqID := utils.GetRequestID(params.XREQUESTID) ctx := context.WithValue(context.Background(), utils.XREQUESTID, reqID) // nolint err := service.RejectCclaApprovalListRequest(ctx, params.CompanyID, params.ProjectID, params.RequestID) if err != nil { - return company.NewRejectCclaAllowlistRequestBadRequest().WithXRequestID(reqID).WithPayload(errorResponse(err)) + return company.NewRejectCclaWhitelistRequestBadRequest().WithXRequestID(reqID).WithPayload(errorResponse(err)) } eventsService.LogEventWithContext(ctx, &events.LogEventArgs{ @@ -80,33 +80,33 @@ func Configure(api *operations.ClaAPI, service IService, sessionStore *dynastore EventData: &events.CCLAApprovalListRequestRejectedEventData{RequestID: params.RequestID}, }) - return company.NewRejectCclaAllowlistRequestOK().WithXRequestID(reqID) + return company.NewRejectCclaWhitelistRequestOK().WithXRequestID(reqID) }) - api.CompanyListCclaAllowlistRequestsHandler = company.ListCclaAllowlistRequestsHandlerFunc( - func(params company.ListCclaAllowlistRequestsParams, claUser *user.CLAUser) middleware.Responder { + api.CompanyListCclaWhitelistRequestsHandler = company.ListCclaWhitelistRequestsHandlerFunc( + func(params company.ListCclaWhitelistRequestsParams, claUser *user.CLAUser) middleware.Responder { reqID := utils.GetRequestID(params.XREQUESTID) ctx := context.WithValue(context.Background(), utils.XREQUESTID, reqID) // nolint f := logrus.Fields{ - "functionName": "CompanyListCclaAllowlistRequestsHandler", + "functionName": "CompanyListCclaWhitelistRequestsHandler", utils.XREQUESTID: ctx.Value(utils.XREQUESTID), } log.WithFields(f).Debugf("Invoking ListCclaApprovalListRequests with Company ID: %+v, Project ID: %+v, Status: %+v", params.CompanyID, params.ProjectID, params.Status) result, err := service.ListCclaApprovalListRequest(params.CompanyID, params.ProjectID, params.Status) if err != nil { - return company.NewListCclaAllowlistRequestsBadRequest().WithXRequestID(reqID).WithPayload(errorResponse(err)) + return company.NewListCclaWhitelistRequestsBadRequest().WithXRequestID(reqID).WithPayload(errorResponse(err)) } - return company.NewListCclaAllowlistRequestsOK().WithXRequestID(reqID).WithPayload(result) + return company.NewListCclaWhitelistRequestsOK().WithXRequestID(reqID).WithPayload(result) }) - api.CompanyListCclaAllowlistRequestsByCompanyAndProjectHandler = company.ListCclaAllowlistRequestsByCompanyAndProjectHandlerFunc( - func(params company.ListCclaAllowlistRequestsByCompanyAndProjectParams, claUser *user.CLAUser) middleware.Responder { + api.CompanyListCclaWhitelistRequestsByCompanyAndProjectHandler = company.ListCclaWhitelistRequestsByCompanyAndProjectHandlerFunc( + func(params company.ListCclaWhitelistRequestsByCompanyAndProjectParams, claUser *user.CLAUser) middleware.Responder { reqID := utils.GetRequestID(params.XREQUESTID) ctx := context.WithValue(context.Background(), utils.XREQUESTID, reqID) // nolint f := logrus.Fields{ - "functionName": "v1.approval_list.handlers.CompanyListCclaAllowlistRequestsByCompanyAndProjectHandler", + "functionName": "v1.approval_list.handlers.CompanyListCclaWhitelistRequestsByCompanyAndProjectHandler", utils.XREQUESTID: ctx.Value(utils.XREQUESTID), "companyID": params.CompanyID, "projectID": params.ProjectID, @@ -120,22 +120,22 @@ func Configure(api *operations.ClaAPI, service IService, sessionStore *dynastore params.CompanyID, params.ProjectID, params.Status) result, err := service.ListCclaApprovalListRequestByCompanyProjectUser(params.CompanyID, ¶ms.ProjectID, params.Status, nil) if err != nil { - return company.NewListCclaAllowlistRequestsByCompanyAndProjectBadRequest().WithPayload(errorResponse(err)) + return company.NewListCclaWhitelistRequestsByCompanyAndProjectBadRequest().WithPayload(errorResponse(err)) } - return company.NewListCclaAllowlistRequestsByCompanyAndProjectOK().WithPayload(result) + return company.NewListCclaWhitelistRequestsByCompanyAndProjectOK().WithPayload(result) }) - api.CompanyListCclaAllowlistRequestsByCompanyAndProjectAndUserHandler = company.ListCclaAllowlistRequestsByCompanyAndProjectAndUserHandlerFunc( - func(params company.ListCclaAllowlistRequestsByCompanyAndProjectAndUserParams, claUser *user.CLAUser) middleware.Responder { + api.CompanyListCclaWhitelistRequestsByCompanyAndProjectAndUserHandler = company.ListCclaWhitelistRequestsByCompanyAndProjectAndUserHandlerFunc( + func(params company.ListCclaWhitelistRequestsByCompanyAndProjectAndUserParams, claUser *user.CLAUser) middleware.Responder { log.Debugf("Invoking ListCclaApprovalListRequestByCompanyProjectUser with Company ID: %+v, Project ID: %+v, Status: %+v, User: %+v", params.CompanyID, params.ProjectID, params.Status, claUser.LFUsername) result, err := service.ListCclaApprovalListRequestByCompanyProjectUser(params.CompanyID, ¶ms.ProjectID, params.Status, &claUser.LFUsername) if err != nil { - return company.NewListCclaAllowlistRequestsByCompanyAndProjectAndUserBadRequest().WithPayload(errorResponse(err)) + return company.NewListCclaWhitelistRequestsByCompanyAndProjectAndUserBadRequest().WithPayload(errorResponse(err)) } - return company.NewListCclaAllowlistRequestsByCompanyAndProjectAndUserOK().WithPayload(result) + return company.NewListCclaWhitelistRequestsByCompanyAndProjectAndUserOK().WithPayload(result) }) } diff --git a/cla-backend-go/approval_list/helpers.go b/cla-backend-go/approval_list/helpers.go index 3be86e3a5..2f159b852 100644 --- a/cla-backend-go/approval_list/helpers.go +++ b/cla-backend-go/approval_list/helpers.go @@ -12,11 +12,11 @@ import ( log "github.com/linuxfoundation/easycla/cla-backend-go/logging" ) -// buildCclaAllowlistRequestsModels builds the request models -func buildCclaAllowlistRequestsModels(results *dynamodb.QueryOutput) ([]models.CclaAllowlistRequest, error) { - requests := make([]models.CclaAllowlistRequest, 0) +// buildCclaWhitelistRequestsModels builds the request models +func buildCclaWhitelistRequestsModels(results *dynamodb.QueryOutput) ([]models.CclaWhitelistRequest, error) { + requests := make([]models.CclaWhitelistRequest, 0) - var itemRequests []CclaAllowlistRequest + var itemRequests []CclaWhitelistRequest err := dynamodbattribute.UnmarshalListOfMaps(results.Items, &itemRequests) if err != nil { @@ -25,7 +25,7 @@ func buildCclaAllowlistRequestsModels(results *dynamodb.QueryOutput) ([]models.C return nil, err } for _, r := range itemRequests { - requests = append(requests, models.CclaAllowlistRequest{ + requests = append(requests, models.CclaWhitelistRequest{ CompanyID: r.CompanyID, CompanyName: r.CompanyName, DateCreated: r.DateCreated, diff --git a/cla-backend-go/approval_list/models.go b/cla-backend-go/approval_list/models.go index 716bf4dd3..d1ba671ce 100644 --- a/cla-backend-go/approval_list/models.go +++ b/cla-backend-go/approval_list/models.go @@ -23,8 +23,8 @@ type CLARequestModel struct { Version string `dynamodbav:"version"` } -// CclaAllowlistRequest data model -type CclaAllowlistRequest struct { +// CclaWhitelistRequest data model +type CclaWhitelistRequest struct { RequestID string `dynamodbav:"request_id"` RequestStatus string `dynamodbav:"request_status"` CompanyID string `dynamodbav:"company_id"` diff --git a/cla-backend-go/approval_list/repository.go b/cla-backend-go/approval_list/repository.go index 49eee1920..bcd579356 100644 --- a/cla-backend-go/approval_list/repository.go +++ b/cla-backend-go/approval_list/repository.go @@ -24,9 +24,9 @@ import ( ) const ( - // Version is version of CclaAllowlistRequest + // Version is version of CclaWhitelistRequest Version = "v1" - // StatusPending is status of CclaAllowlistRequest + // StatusPending is status of CclaWhitelistRequest StatusPending = "pending" // ProjectIDIndex is the index for for the project_id secondary index @@ -39,7 +39,7 @@ type IRepository interface { GetCclaApprovalListRequest(requestID string) (*CLARequestModel, error) ApproveCclaApprovalListRequest(requestID string) error RejectCclaApprovalListRequest(requestID string) error - ListCclaApprovalListRequests(companyID string, projectID, status, userID *string) (*models.CclaAllowlistRequestList, error) + ListCclaApprovalListRequests(companyID string, projectID, status, userID *string) (*models.CclaWhitelistRequestList, error) GetRequestsByCLAGroup(claGroupID string) ([]CLARequestModel, error) UpdateRequestsByCLAGroup(model *models2.DBProjectModel) error } @@ -214,7 +214,7 @@ func (repo repository) RejectCclaApprovalListRequest(requestID string) error { } // ListCclaApprovalListRequests list the requests for the specified query parameters -func (repo repository) ListCclaApprovalListRequests(companyID string, projectID, status, userID *string) (*models.CclaAllowlistRequestList, error) { +func (repo repository) ListCclaApprovalListRequests(companyID string, projectID, status, userID *string) (*models.CclaWhitelistRequestList, error) { f := logrus.Fields{ "functionName": "v1.approval_list.repository.ListCclaApprovalListRequests", "companyID": companyID, @@ -282,13 +282,13 @@ func (repo repository) ListCclaApprovalListRequests(companyID string, projectID, return nil, queryErr } - list, err := buildCclaAllowlistRequestsModels(queryOutput) + list, err := buildCclaWhitelistRequestsModels(queryOutput) if err != nil { log.WithFields(f).WithError(err).Warnf("unmarshall requests error while decoding the response, error: %+v", err) return nil, err } - return &models.CclaAllowlistRequestList{List: list}, nil + return &models.CclaWhitelistRequestList{List: list}, nil } // GetRequestsByCLAGroup retrieves a list of requests for the specified CLA Group diff --git a/cla-backend-go/approval_list/service.go b/cla-backend-go/approval_list/service.go index 6d1bed4c4..ba8e2b3a6 100644 --- a/cla-backend-go/approval_list/service.go +++ b/cla-backend-go/approval_list/service.go @@ -42,11 +42,11 @@ const ( // IService interface defines the service methods/functions type IService interface { - AddCclaApprovalListRequest(ctx context.Context, companyID string, claGroupID string, args models.CclaAllowlistRequestInput) (string, error) + AddCclaApprovalListRequest(ctx context.Context, companyID string, claGroupID string, args models.CclaWhitelistRequestInput) (string, error) ApproveCclaApprovalListRequest(ctx context.Context, claUser *user.CLAUser, ClacompanyID, claGroupID, requestID string) error RejectCclaApprovalListRequest(ctx context.Context, companyID, claGroupID, requestID string) error - ListCclaApprovalListRequest(companyID string, claGroupID, status *string) (*models.CclaAllowlistRequestList, error) - ListCclaApprovalListRequestByCompanyProjectUser(companyID string, claGroupID, status, userID *string) (*models.CclaAllowlistRequestList, error) + ListCclaApprovalListRequest(companyID string, claGroupID, status *string) (*models.CclaWhitelistRequestList, error) + ListCclaApprovalListRequestByCompanyProjectUser(companyID string, claGroupID, status, userID *string) (*models.CclaWhitelistRequestList, error) } type service struct { @@ -78,7 +78,7 @@ func NewService(repo IRepository, projectsCLAGroupRepository projects_cla_groups } } -func (s service) AddCclaApprovalListRequest(ctx context.Context, companyID string, claGroupID string, args models.CclaAllowlistRequestInput) (string, error) { +func (s service) AddCclaApprovalListRequest(ctx context.Context, companyID string, claGroupID string, args models.CclaWhitelistRequestInput) (string, error) { f := logrus.Fields{ "functionName": "v1.approval_list.service.AddCclaApprovalListRequest", utils.XREQUESTID: ctx.Value(utils.XREQUESTID), @@ -302,12 +302,12 @@ func (s service) RejectCclaApprovalListRequest(ctx context.Context, companyID, c } // ListCclaApprovalListRequest is the handler for the list CLA request -func (s service) ListCclaApprovalListRequest(companyID string, claGroupID, status *string) (*models.CclaAllowlistRequestList, error) { +func (s service) ListCclaApprovalListRequest(companyID string, claGroupID, status *string) (*models.CclaWhitelistRequestList, error) { return s.repo.ListCclaApprovalListRequests(companyID, claGroupID, status, nil) } // ListCclaApprovalListRequestByCompanyProjectUser is the handler for the list CLA request -func (s service) ListCclaApprovalListRequestByCompanyProjectUser(companyID string, claGroupID, status, userID *string) (*models.CclaAllowlistRequestList, error) { +func (s service) ListCclaApprovalListRequestByCompanyProjectUser(companyID string, claGroupID, status, userID *string) (*models.CclaWhitelistRequestList, error) { return s.repo.ListCclaApprovalListRequests(companyID, claGroupID, status, userID) } diff --git a/cla-backend-go/cmd/repositories/repositories.go b/cla-backend-go/cmd/repositories/repositories.go index 2642c6560..f73d9cb30 100644 --- a/cla-backend-go/cmd/repositories/repositories.go +++ b/cla-backend-go/cmd/repositories/repositories.go @@ -146,8 +146,8 @@ func (t *TestBehaviour) RunGetProtectedBranch(assertBranchProtection *models.Git return } - if response.BranchName == nil || *response.BranchName != "main" { - F.AddError("Get Protected Branch - Default Branch Name expected : main") + if response.BranchName == nil || *response.BranchName != "master" { + F.AddError("Get Protected Branch - Default Branch Name expected : master") } if len(response.StatusChecks) == 0 { @@ -196,7 +196,7 @@ func (t *TestBehaviour) RunUpdateProtectionBranch(msg string, param *models.Gith }) t.RunGetProtectedBranch(&models.GithubRepositoryBranchProtection{ - BranchName: swag.String("main"), + BranchName: swag.String("master"), EnforceAdmin: *param.EnforceAdmin, ProtectionEnabled: true, StatusChecks: param.StatusChecks, diff --git a/cla-backend-go/events/repository.go b/cla-backend-go/events/repository.go index 071500124..ce00b83a1 100644 --- a/cla-backend-go/events/repository.go +++ b/cla-backend-go/events/repository.go @@ -111,7 +111,7 @@ func (repo *repository) CreateEvent(event *models.Event) error { } eventID, err := uuid.NewV4() if err != nil { - log.WithFields(f).WithError(err).Warnf("Unable to generate a UUID for a allowlist request, error: %v", err) + log.WithFields(f).WithError(err).Warnf("Unable to generate a UUID for a whitelist request, error: %v", err) return err } diff --git a/cla-backend-go/github/github-schema.graphql b/cla-backend-go/github/github-schema.graphql index 9e8973a9c..3ae15a1a7 100644 --- a/cla-backend-go/github/github-schema.graphql +++ b/cla-backend-go/github/github-schema.graphql @@ -11115,7 +11115,7 @@ A Git object ID. scalar GitObjectID """ -A fully qualified reference name (e.g. `refs/heads/main`). +A fully qualified reference name (e.g. `refs/heads/master`). """ scalar GitRefname @preview(toggledBy: "update-refs-preview") @@ -29928,7 +29928,7 @@ type Repository implements Node & PackageOwner & ProjectOwner & RepositoryInfo & ref( """ The ref to retrieve. Fully qualified matches are checked in order - (`refs/heads/main`) before falling back onto checks for short name matches (`main`). + (`refs/heads/master`) before falling back onto checks for short name matches (`master`). """ qualifiedName: String! ): Ref diff --git a/cla-backend-go/projects_cla_groups/service.go b/cla-backend-go/projects_cla_groups/service.go index 0c825f330..d98f53b7f 100644 --- a/cla-backend-go/projects_cla_groups/service.go +++ b/cla-backend-go/projects_cla_groups/service.go @@ -27,7 +27,7 @@ type Service struct { repo Repository } -// NewService creates a new service +// NewService creates a new whitelist service func NewService(repo Repository) Service { return Service{ repo, diff --git a/cla-backend-go/signatures/constants.go b/cla-backend-go/signatures/constants.go index 20a4aaf0b..1e2de9f07 100644 --- a/cla-backend-go/signatures/constants.go +++ b/cla-backend-go/signatures/constants.go @@ -4,16 +4,16 @@ package signatures // SignatureEmailApprovalListColumn is the name of the signature column for the email approval list -const SignatureEmailApprovalListColumn = "email_whitelist" // TODO: rename column to email_allowlist +const SignatureEmailApprovalListColumn = "email_whitelist" // TODO: rename column to email_approval_list // SignatureDomainApprovalListColumn is the name of the signature column for the domain approval list -const SignatureDomainApprovalListColumn = "domain_whitelist" // TODO: rename column to domain_allowlist +const SignatureDomainApprovalListColumn = "domain_whitelist" // TODO: rename column to domain_approval_list // SignatureGitHubUsernameApprovalListColumn is the name of the signature column for the GitHub username approval list -const SignatureGitHubUsernameApprovalListColumn = "github_whitelist" // TODO: rename column to github_username_allowlist +const SignatureGitHubUsernameApprovalListColumn = "github_whitelist" // TODO: rename column to github_username_approval_list // SignatureGitHubOrgApprovalListColumn is the name of the signature column for the GitHub organization approval list -const SignatureGitHubOrgApprovalListColumn = "github_org_whitelist" // TODO: rename column to github_org_allowlist +const SignatureGitHubOrgApprovalListColumn = "github_org_whitelist" // TODO: rename column to github_org_approval_list // SignatureGitlabUsernameApprovalListColumn is the name of the signature column for gitlab username approval lists const SignatureGitlabUsernameApprovalListColumn = "gitlab_username_approval_list" diff --git a/cla-backend-go/signatures/handlers.go b/cla-backend-go/signatures/handlers.go index c307e2079..85b39e7df 100644 --- a/cla-backend-go/signatures/handlers.go +++ b/cla-backend-go/signatures/handlers.go @@ -162,13 +162,13 @@ func Configure(api *operations.ClaAPI, service SignatureService, sessionStore *d }) // Retrieve GitHub Approval List Entries - api.SignaturesGetGitHubOrgAllowlistHandler = signatures.GetGitHubOrgAllowlistHandlerFunc(func(params signatures.GetGitHubOrgAllowlistParams, claUser *user.CLAUser) middleware.Responder { + api.SignaturesGetGitHubOrgWhitelistHandler = signatures.GetGitHubOrgWhitelistHandlerFunc(func(params signatures.GetGitHubOrgWhitelistParams, claUser *user.CLAUser) middleware.Responder { reqID := utils.GetRequestID(params.XREQUESTID) ctx := context.WithValue(context.Background(), utils.XREQUESTID, reqID) // nolint session, err := sessionStore.Get(params.HTTPRequest, github.SessionStoreKey) if err != nil { log.Warnf("error retrieving session from the session store, error: %+v", err) - return signatures.NewGetGitHubOrgAllowlistBadRequest().WithXRequestID(reqID).WithPayload(errorResponse(err)) + return signatures.NewGetGitHubOrgWhitelistBadRequest().WithXRequestID(reqID).WithPayload(errorResponse(err)) } githubAccessToken, ok := session.Values["github_access_token"].(string) @@ -181,20 +181,20 @@ func Configure(api *operations.ClaAPI, service SignatureService, sessionStore *d if err != nil { log.Warnf("error fetching github organization approval list entries v using signature_id: %s, error: %+v", params.SignatureID, err) - return signatures.NewGetGitHubOrgAllowlistBadRequest().WithXRequestID(reqID).WithPayload(errorResponse(err)) + return signatures.NewGetGitHubOrgWhitelistBadRequest().WithXRequestID(reqID).WithPayload(errorResponse(err)) } - return signatures.NewGetGitHubOrgAllowlistOK().WithXRequestID(reqID).WithPayload(ghApprovalList) + return signatures.NewGetGitHubOrgWhitelistOK().WithXRequestID(reqID).WithPayload(ghApprovalList) }) // Add GitHub Approval List Entries - api.SignaturesAddGitHubOrgAllowlistHandler = signatures.AddGitHubOrgAllowlistHandlerFunc(func(params signatures.AddGitHubOrgAllowlistParams, claUser *user.CLAUser) middleware.Responder { + api.SignaturesAddGitHubOrgWhitelistHandler = signatures.AddGitHubOrgWhitelistHandlerFunc(func(params signatures.AddGitHubOrgWhitelistParams, claUser *user.CLAUser) middleware.Responder { reqID := utils.GetRequestID(params.XREQUESTID) ctx := context.WithValue(context.Background(), utils.XREQUESTID, reqID) // nolint session, err := sessionStore.Get(params.HTTPRequest, github.SessionStoreKey) if err != nil { log.Warnf("error retrieving session from the session store, error: %+v", err) - return signatures.NewAddGitHubOrgAllowlistBadRequest().WithXRequestID(reqID).WithPayload(errorResponse(err)) + return signatures.NewAddGitHubOrgWhitelistBadRequest().WithXRequestID(reqID).WithPayload(errorResponse(err)) } githubAccessToken, ok := session.Values["github_access_token"].(string) @@ -205,9 +205,9 @@ func Configure(api *operations.ClaAPI, service SignatureService, sessionStore *d ghApprovalList, err := service.AddGithubOrganizationToApprovalList(ctx, params.SignatureID, params.Body, githubAccessToken) if err != nil { - log.Warnf("error adding github organization %s using signature_id: %s to the allowlist, error: %+v", + log.Warnf("error adding github organization %s using signature_id: %s to the whitelist, error: %+v", *params.Body.OrganizationID, params.SignatureID, err) - return signatures.NewAddGitHubOrgAllowlistBadRequest().WithXRequestID(reqID).WithPayload(errorResponse(err)) + return signatures.NewAddGitHubOrgWhitelistBadRequest().WithXRequestID(reqID).WithPayload(errorResponse(err)) } // Create an event @@ -233,18 +233,18 @@ func Configure(api *operations.ClaAPI, service SignatureService, sessionStore *d }, }) - return signatures.NewAddGitHubOrgAllowlistOK().WithXRequestID(reqID).WithPayload(ghApprovalList) + return signatures.NewAddGitHubOrgWhitelistOK().WithXRequestID(reqID).WithPayload(ghApprovalList) }) // Delete GitHub Approval List Entries - api.SignaturesDeleteGitHubOrgAllowlistHandler = signatures.DeleteGitHubOrgAllowlistHandlerFunc(func(params signatures.DeleteGitHubOrgAllowlistParams, claUser *user.CLAUser) middleware.Responder { + api.SignaturesDeleteGitHubOrgWhitelistHandler = signatures.DeleteGitHubOrgWhitelistHandlerFunc(func(params signatures.DeleteGitHubOrgWhitelistParams, claUser *user.CLAUser) middleware.Responder { reqID := utils.GetRequestID(params.XREQUESTID) ctx := context.WithValue(context.Background(), utils.XREQUESTID, reqID) // nolint session, err := sessionStore.Get(params.HTTPRequest, github.SessionStoreKey) if err != nil { log.Warnf("error retrieving session from the session store, error: %+v", err) - return signatures.NewDeleteGitHubOrgAllowlistBadRequest().WithXRequestID(reqID).WithPayload(errorResponse(err)) + return signatures.NewDeleteGitHubOrgWhitelistBadRequest().WithXRequestID(reqID).WithPayload(errorResponse(err)) } githubAccessToken, ok := session.Values["github_access_token"].(string) @@ -255,9 +255,9 @@ func Configure(api *operations.ClaAPI, service SignatureService, sessionStore *d ghApprovalList, err := service.DeleteGithubOrganizationFromApprovalList(ctx, params.SignatureID, params.Body, githubAccessToken) if err != nil { - log.Warnf("error deleting github organization %s using signature_id: %s from the allowlist, error: %+v", + log.Warnf("error deleting github organization %s using signature_id: %s from the whitelist, error: %+v", *params.Body.OrganizationID, params.SignatureID, err) - return signatures.NewDeleteGitHubOrgAllowlistBadRequest().WithXRequestID(reqID).WithPayload(errorResponse(err)) + return signatures.NewDeleteGitHubOrgWhitelistBadRequest().WithXRequestID(reqID).WithPayload(errorResponse(err)) } // Create an event @@ -284,7 +284,7 @@ func Configure(api *operations.ClaAPI, service SignatureService, sessionStore *d }, }) - return signatures.NewDeleteGitHubOrgAllowlistNoContent().WithXRequestID(reqID).WithPayload(ghApprovalList) + return signatures.NewDeleteGitHubOrgWhitelistNoContent().WithXRequestID(reqID).WithPayload(ghApprovalList) }) // Get Project Signatures diff --git a/cla-backend-go/signatures/mocks/mock_service.go b/cla-backend-go/signatures/mocks/mock_service.go index 938bc0a4a..01284a77b 100644 --- a/cla-backend-go/signatures/mocks/mock_service.go +++ b/cla-backend-go/signatures/mocks/mock_service.go @@ -57,7 +57,7 @@ func (mr *MockSignatureServiceMockRecorder) AddCLAManager(ctx, signatureID, claM } // AddGithubOrganizationToApprovalList mocks base method. -func (m *MockSignatureService) AddGithubOrganizationToApprovalList(ctx context.Context, signatureID string, approvalListParams models.GhOrgAllowlist, githubAccessToken string) ([]models.GithubOrg, error) { +func (m *MockSignatureService) AddGithubOrganizationToApprovalList(ctx context.Context, signatureID string, approvalListParams models.GhOrgWhitelist, githubAccessToken string) ([]models.GithubOrg, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "AddGithubOrganizationToApprovalList", ctx, signatureID, approvalListParams, githubAccessToken) ret0, _ := ret[0].([]models.GithubOrg) @@ -116,7 +116,7 @@ func (mr *MockSignatureServiceMockRecorder) CreateSignature(ctx, signature inter } // DeleteGithubOrganizationFromApprovalList mocks base method. -func (m *MockSignatureService) DeleteGithubOrganizationFromApprovalList(ctx context.Context, signatureID string, approvalListParams models.GhOrgAllowlist, githubAccessToken string) ([]models.GithubOrg, error) { +func (m *MockSignatureService) DeleteGithubOrganizationFromApprovalList(ctx context.Context, signatureID string, approvalListParams models.GhOrgWhitelist, githubAccessToken string) ([]models.GithubOrg, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "DeleteGithubOrganizationFromApprovalList", ctx, signatureID, approvalListParams, githubAccessToken) ret0, _ := ret[0].([]models.GithubOrg) diff --git a/cla-backend-go/signatures/repository.go b/cla-backend-go/signatures/repository.go index 36c8166e7..533827698 100644 --- a/cla-backend-go/signatures/repository.go +++ b/cla-backend-go/signatures/repository.go @@ -459,7 +459,7 @@ func (repo repository) AddGithubOrganizationToApprovalList(ctx context.Context, itemFromMap, ok := result.Item["github_org_whitelist"] if !ok { - log.WithFields(f).Debugf("signatureID: %s is missing the 'github_org_allowlist' column - will add", signatureID) + log.WithFields(f).Debugf("signatureID: %s is missing the 'github_org_whitelist' column - will add", signatureID) itemFromMap = &dynamodb.AttributeValue{} } @@ -552,7 +552,7 @@ func (repo repository) DeleteGithubOrganizationFromApprovalList(ctx context.Cont if !ok { log.WithFields(f).Warnf("unable to remove github organization approval list entry: %s for signature: %s - list is empty", GitHubOrganizationID, signatureID) - return nil, errors.New("no github_org_allowlist column") + return nil, errors.New("no github_org_whitelist column") } // generate new List L without element to be deleted diff --git a/cla-backend-go/signatures/service.go b/cla-backend-go/signatures/service.go index 50eed6594..8365fd01c 100644 --- a/cla-backend-go/signatures/service.go +++ b/cla-backend-go/signatures/service.go @@ -61,8 +61,8 @@ type SignatureService interface { HasUserSigned(ctx context.Context, user *models.User, projectID string) (*bool, *bool, error) GetGithubOrganizationsFromApprovalList(ctx context.Context, signatureID string, githubAccessToken string) ([]models.GithubOrg, error) - AddGithubOrganizationToApprovalList(ctx context.Context, signatureID string, approvalListParams models.GhOrgAllowlist, githubAccessToken string) ([]models.GithubOrg, error) - DeleteGithubOrganizationFromApprovalList(ctx context.Context, signatureID string, approvalListParams models.GhOrgAllowlist, githubAccessToken string) ([]models.GithubOrg, error) + AddGithubOrganizationToApprovalList(ctx context.Context, signatureID string, approvalListParams models.GhOrgWhitelist, githubAccessToken string) ([]models.GithubOrg, error) + DeleteGithubOrganizationFromApprovalList(ctx context.Context, signatureID string, approvalListParams models.GhOrgWhitelist, githubAccessToken string) ([]models.GithubOrg, error) UpdateApprovalList(ctx context.Context, authUser *auth.User, claGroupModel *models.ClaGroup, companyModel *models.Company, claGroupID string, params *models.ApprovalList, projectSFID string) (*models.Signature, error) AddCLAManager(ctx context.Context, signatureID, claManagerID string) (*models.Signature, error) @@ -319,7 +319,7 @@ func (s service) GetGithubOrganizationsFromApprovalList(ctx context.Context, sig } // AddGithubOrganizationToApprovalList adds the GH organization to the approval list -func (s service) AddGithubOrganizationToApprovalList(ctx context.Context, signatureID string, approvalListParams models.GhOrgAllowlist, githubAccessToken string) ([]models.GithubOrg, error) { +func (s service) AddGithubOrganizationToApprovalList(ctx context.Context, signatureID string, approvalListParams models.GhOrgWhitelist, githubAccessToken string) ([]models.GithubOrg, error) { organizationID := approvalListParams.OrganizationID if signatureID == "" { @@ -389,7 +389,7 @@ func (s service) AddGithubOrganizationToApprovalList(ctx context.Context, signat } // DeleteGithubOrganizationFromApprovalList deletes the specified GH organization from the approval list -func (s service) DeleteGithubOrganizationFromApprovalList(ctx context.Context, signatureID string, approvalListParams models.GhOrgAllowlist, githubAccessToken string) ([]models.GithubOrg, error) { +func (s service) DeleteGithubOrganizationFromApprovalList(ctx context.Context, signatureID string, approvalListParams models.GhOrgWhitelist, githubAccessToken string) ([]models.GithubOrg, error) { // Extract the payload values organizationID := approvalListParams.OrganizationID diff --git a/cla-backend-go/swagger/cla.v1.yaml b/cla-backend-go/swagger/cla.v1.yaml index 5b9e8d7e6..7cef11d43 100644 --- a/cla-backend-go/swagger/cla.v1.yaml +++ b/cla-backend-go/swagger/cla.v1.yaml @@ -629,7 +629,7 @@ paths: summary: Get GitHub Organization Approval List Entries security: - OauthSecurity: [ ] - operationId: getGitHubOrgAllowlist + operationId: getGitHubOrgWhitelist parameters: - $ref: "#/parameters/x-request-id" - name: signatureID @@ -661,7 +661,7 @@ paths: summary: Delete GitHub Organization Approval List Entry security: - OauthSecurity: [ ] - operationId: deleteGitHubOrgAllowlist + operationId: deleteGitHubOrgWhitelist parameters: - $ref: "#/parameters/x-request-id" - name: signatureID @@ -671,7 +671,7 @@ paths: - name: body in: body schema: - $ref: '#/definitions/gh-org-allowlist' + $ref: '#/definitions/gh-org-whitelist' responses: '204': description: 'Success' @@ -697,7 +697,7 @@ paths: summary: Update GitHub Organization Approval List Entries security: - OauthSecurity: [ ] - operationId: addGitHubOrgAllowlist + operationId: addGitHubOrgWhitelist parameters: - $ref: "#/parameters/x-request-id" - name: signatureID @@ -707,7 +707,7 @@ paths: - name: body in: body schema: - $ref: '#/definitions/gh-org-allowlist' + $ref: '#/definitions/gh-org-whitelist' responses: '200': description: 'Success' @@ -1467,7 +1467,7 @@ paths: security: - OauthSecurity: - user - operationId: listCclaAllowlistRequestsByCompanyAndProject + operationId: listCclaWhitelistRequestsByCompanyAndProject parameters: - $ref: "#/parameters/x-request-id" - $ref: "#/parameters/path-companyID" @@ -1484,7 +1484,7 @@ paths: type: string description: The unique request ID value - assigned/set by the API Gateway based on the session schema: - $ref: '#/definitions/ccla-allowlist-request-list' + $ref: '#/definitions/ccla-whitelist-request-list' '400': $ref: '#/responses/invalid-request' '401': @@ -1498,7 +1498,7 @@ paths: post: summary: Create Project Company Approval List Entries security: [ ] - operationId: addCclaAllowlistRequest + operationId: addCclaWhitelistRequest parameters: - $ref: "#/parameters/x-request-id" - $ref: "#/parameters/path-companyID" @@ -1506,7 +1506,7 @@ paths: - in: body name: body schema: - $ref: '#/definitions/ccla-allowlist-request-input' + $ref: '#/definitions/ccla-whitelist-request-input' required: true responses: '200': @@ -1532,7 +1532,7 @@ paths: security: - OauthSecurity: - user - operationId: listCclaAllowlistRequestsByCompanyAndProjectAndUser + operationId: listCclaWhitelistRequestsByCompanyAndProjectAndUser parameters: - $ref: "#/parameters/x-request-id" - $ref: "#/parameters/path-companyID" @@ -1550,7 +1550,7 @@ paths: type: string description: The unique request ID value - assigned/set by the API Gateway based on the session schema: - $ref: '#/definitions/ccla-allowlist-request-list' + $ref: '#/definitions/ccla-whitelist-request-list' '400': $ref: '#/responses/invalid-request' '401': @@ -1568,7 +1568,7 @@ paths: security: - OauthSecurity: - company - operationId: approveCclaAllowlistRequest + operationId: approveCclaWhitelistRequest parameters: - $ref: "#/parameters/x-request-id" - $ref: "#/parameters/path-companyID" @@ -1601,7 +1601,7 @@ paths: security: - OauthSecurity: - company - operationId: rejectCclaAllowlistRequest + operationId: rejectCclaWhitelistRequest parameters: - $ref: "#/parameters/x-request-id" - $ref: "#/parameters/path-companyID" @@ -1634,7 +1634,7 @@ paths: security: - OauthSecurity: - user - operationId: listCclaAllowlistRequests + operationId: listCclaWhitelistRequests parameters: - $ref: "#/parameters/x-request-id" - $ref: "#/parameters/path-companyID" @@ -1651,7 +1651,7 @@ paths: type: string description: The unique request ID value - assigned/set by the API Gateway based on the session schema: - $ref: '#/definitions/ccla-allowlist-request-list' + $ref: '#/definitions/ccla-whitelist-request-list' '400': $ref: '#/responses/invalid-request' '401': @@ -2776,8 +2776,8 @@ definitions: $ref: '#/definitions/user' - gh-org-allowlist: - $ref: './common/gh-org-allowlist.yaml' + gh-org-whitelist: + $ref: './common/gh-org-whitelist.yaml' github-org: $ref: './common/github-org.yaml' @@ -3005,11 +3005,11 @@ definitions: approval-list: $ref: './common/signature-approval-list.yaml' - ccla-allowlist-request-input: + ccla-whitelist-request-input: type: object x-nullable: false - title: Ccla allowlist request input - description: Ccla allowlist request input + title: Ccla whitelist request input + description: Ccla whitelist request input properties: contributorId: type: string @@ -3024,20 +3024,20 @@ definitions: message: type: string - ccla-allowlist-request-list: + ccla-whitelist-request-list: type: object properties: list: type: array items: - $ref: '#/definitions/ccla-allowlist-request' + $ref: '#/definitions/ccla-whitelist-request' - ccla-allowlist-request: + ccla-whitelist-request: type: object x-nullable: false - title: Ccla allowlist request - description: Ccla allowlist request + title: Ccla whitelist request + description: Ccla whitelist request properties: requestId: type: string diff --git a/cla-backend-go/swagger/cla.v2.yaml b/cla-backend-go/swagger/cla.v2.yaml index 14caed919..68ac7e726 100644 --- a/cla-backend-go/swagger/cla.v2.yaml +++ b/cla-backend-go/swagger/cla.v2.yaml @@ -3076,7 +3076,7 @@ paths: get: summary: Signature Update description: Updates the specified signature GitHub Organization approval list - operationId: getGitHubOrgAllowlist + operationId: getGitHubOrgWhitelist parameters: - $ref: "#/parameters/x-request-id" - $ref: "#/parameters/x-acl" @@ -3110,7 +3110,7 @@ paths: delete: summary: Signature Delete description: Deletes the specified signature GitHub organization approval list - operationId: deleteGitHubOrgAllowlist + operationId: deleteGitHubOrgWhitelist parameters: - $ref: "#/parameters/x-request-id" - $ref: "#/parameters/x-acl" @@ -3123,7 +3123,7 @@ paths: - name: body in: body schema: - $ref: '#/definitions/gh-org-allowlist' + $ref: '#/definitions/gh-org-whitelist' responses: '204': description: 'Resource Deleted' @@ -3148,7 +3148,7 @@ paths: post: summary: Signature Update description: Updates the specified signature GitHub organization approval list - operationId: addGitHubOrgAllowlist + operationId: addGitHubOrgWhitelist parameters: - $ref: "#/parameters/x-request-id" - $ref: "#/parameters/x-acl" @@ -3161,7 +3161,7 @@ paths: - name: body in: body schema: - $ref: '#/definitions/gh-org-allowlist' + $ref: '#/definitions/gh-org-whitelist' responses: '200': description: 'Success' @@ -5084,8 +5084,8 @@ definitions: github-org: $ref: './common/github-org.yaml' - gh-org-allowlist: - $ref: './common/gh-org-allowlist.yaml' + gh-org-whitelist: + $ref: './common/gh-org-whitelist.yaml' add-gerrit-input: $ref: './common/add-gerrit-input.yaml' diff --git a/cla-backend-go/swagger/common/gh-org-allowlist.yaml b/cla-backend-go/swagger/common/gh-org-whitelist.yaml similarity index 73% rename from cla-backend-go/swagger/common/gh-org-allowlist.yaml rename to cla-backend-go/swagger/common/gh-org-whitelist.yaml index 4d852291f..072506248 100644 --- a/cla-backend-go/swagger/common/gh-org-allowlist.yaml +++ b/cla-backend-go/swagger/common/gh-org-whitelist.yaml @@ -3,8 +3,8 @@ type: object x-nullable: false -title: Github Organization Allowlist -description: Github Organiation Allowlist +title: Github Organization Whitelist +description: Github Organiation Whitelist properties: organization_id: type: string diff --git a/cla-backend-go/swagger/common/github-org.yaml b/cla-backend-go/swagger/common/github-org.yaml index cba6cedf7..ee92d7d5c 100644 --- a/cla-backend-go/swagger/common/github-org.yaml +++ b/cla-backend-go/swagger/common/github-org.yaml @@ -4,7 +4,7 @@ type: object x-nullable: false title: Github Organization -description: Github Organiation object used for CCLA allowlist +description: Github Organiation object used for CCLA whitelist properties: id: type: string diff --git a/cla-backend-go/swagger/common/health.yaml b/cla-backend-go/swagger/common/health.yaml index 0473d70e9..017db7b77 100644 --- a/cla-backend-go/swagger/common/health.yaml +++ b/cla-backend-go/swagger/common/health.yaml @@ -23,7 +23,7 @@ properties: Branch: type: string description: the branch name of the software for this version of the product - example: 'main' + example: 'master' BuildTimeStamp: type: string description: the build date/time of the software for this version of the product diff --git a/cla-backend-go/swagger/common/version.yaml b/cla-backend-go/swagger/common/version.yaml index 5aeef0911..a26160819 100644 --- a/cla-backend-go/swagger/common/version.yaml +++ b/cla-backend-go/swagger/common/version.yaml @@ -17,7 +17,7 @@ properties: branch: type: string description: the branch name of the software for this version of the product - example: 'main' + example: 'master' buildDate: type: string description: the build date/time of the software for this version of the product diff --git a/cla-backend-go/users/repository.go b/cla-backend-go/users/repository.go index b27ee6939..8d6dc083e 100644 --- a/cla-backend-go/users/repository.go +++ b/cla-backend-go/users/repository.go @@ -59,7 +59,7 @@ type repository struct { companyTableName string } -// NewRepository creates a new instance of the service +// NewRepository creates a new instance of the whitelist service func NewRepository(awsSession *session.Session, stage string) UserRepository { return repository{ stage: stage, diff --git a/cla-backend-go/users/service.go b/cla-backend-go/users/service.go index 8eceb2281..6dd55f01d 100644 --- a/cla-backend-go/users/service.go +++ b/cla-backend-go/users/service.go @@ -36,7 +36,7 @@ type service struct { events events.Service } -// NewService creates a new service +// NewService creates a new whitelist service func NewService(repo UserRepository, events events.Service) Service { return service{ repo, diff --git a/cla-backend-go/v2/dynamo_events/signatures.go b/cla-backend-go/v2/dynamo_events/signatures.go index 17c81f5aa..7fa05c40e 100644 --- a/cla-backend-go/v2/dynamo_events/signatures.go +++ b/cla-backend-go/v2/dynamo_events/signatures.go @@ -51,10 +51,10 @@ type Signature struct { SignatureReferenceType string `json:"signature_reference_type"` SignatureType string `json:"signature_type"` SignatureUserCompanyID string `json:"signature_user_ccla_company_id"` - EmailAllowlist []string `json:"email_whitelist"` - DomainAllowlist []string `json:"domain_whitelist"` - GitHubAllowlist []string `json:"github_whitelist"` - GitHubOrgAllowlist []string `json:"github_org_whitelist"` + EmailWhitelist []string `json:"email_whitelist"` + DomainWhitelist []string `json:"domain_whitelist"` + GitHubWhitelist []string `json:"github_whitelist"` + GitHubOrgWhitelist []string `json:"github_org_whitelist"` SignatureACL []string `json:"signature_acl"` SigtypeSignedApprovedID string `json:"sigtype_signed_approved_id"` UserGithubUsername string `json:"user_github_username"` diff --git a/cla-backend-go/v2/signatures/handlers.go b/cla-backend-go/v2/signatures/handlers.go index 476b59ab8..127ace233 100644 --- a/cla-backend-go/v2/signatures/handlers.go +++ b/cla-backend-go/v2/signatures/handlers.go @@ -185,19 +185,19 @@ func Configure(api *operations.EasyclaAPI, claGroupService service.Service, proj }) // Retrieve GitHub Approval Entries - api.SignaturesGetGitHubOrgAllowlistHandler = signatures.GetGitHubOrgAllowlistHandlerFunc(func(params signatures.GetGitHubOrgAllowlistParams, authUser *auth.User) middleware.Responder { + api.SignaturesGetGitHubOrgWhitelistHandler = signatures.GetGitHubOrgWhitelistHandlerFunc(func(params signatures.GetGitHubOrgWhitelistParams, authUser *auth.User) middleware.Responder { reqID := utils.GetRequestID(params.XREQUESTID) ctx := context.WithValue(context.Background(), utils.XREQUESTID, reqID) // nolint utils.SetAuthUserProperties(authUser, params.XUSERNAME, params.XEMAIL) f := logrus.Fields{ - "functionName": "v2.signatures.handlers.SignaturesGetGitHubOrgAllowlistHandler", + "functionName": "v2.signatures.handlers.SignaturesGetGitHubOrgWhitelistHandler", utils.XREQUESTID: ctx.Value(utils.XREQUESTID), "signatureID": params.SignatureID, } session, err := sessionStore.Get(params.HTTPRequest, github.SessionStoreKey) if err != nil { log.WithFields(f).Warnf("error retrieving session from the session store, error: %+v", err) - return signatures.NewGetGitHubOrgAllowlistBadRequest().WithXRequestID(reqID).WithPayload(errorResponse(reqID, err)) + return signatures.NewGetGitHubOrgWhitelistBadRequest().WithXRequestID(reqID).WithPayload(errorResponse(reqID, err)) } githubAccessToken, ok := session.Values["github_access_token"].(string) @@ -210,25 +210,25 @@ func Configure(api *operations.EasyclaAPI, claGroupService service.Service, proj if err != nil { log.WithFields(f).Warnf("error fetching github organization approval list entries using signature_id: %s, error: %+v", params.SignatureID, err) - return signatures.NewGetGitHubOrgAllowlistBadRequest().WithXRequestID(reqID).WithPayload(errorResponse(reqID, err)) + return signatures.NewGetGitHubOrgWhitelistBadRequest().WithXRequestID(reqID).WithPayload(errorResponse(reqID, err)) } var response []models.GithubOrg err = copier.Copy(&response, ghOrgApprovalList) if err != nil { - return signatures.NewGetGitHubOrgAllowlistBadRequest().WithXRequestID(reqID).WithPayload(errorResponse(reqID, err)) + return signatures.NewGetGitHubOrgWhitelistBadRequest().WithXRequestID(reqID).WithPayload(errorResponse(reqID, err)) } - return signatures.NewGetGitHubOrgAllowlistOK().WithXRequestID(reqID).WithPayload(response) + return signatures.NewGetGitHubOrgWhitelistOK().WithXRequestID(reqID).WithPayload(response) }) // Add GitHub Approval Entries - api.SignaturesAddGitHubOrgAllowlistHandler = signatures.AddGitHubOrgAllowlistHandlerFunc(func(params signatures.AddGitHubOrgAllowlistParams, authUser *auth.User) middleware.Responder { + api.SignaturesAddGitHubOrgWhitelistHandler = signatures.AddGitHubOrgWhitelistHandlerFunc(func(params signatures.AddGitHubOrgWhitelistParams, authUser *auth.User) middleware.Responder { reqID := utils.GetRequestID(params.XREQUESTID) ctx := context.WithValue(context.Background(), utils.XREQUESTID, reqID) // nolint utils.SetAuthUserProperties(authUser, params.XUSERNAME, params.XEMAIL) f := logrus.Fields{ - "functionName": "v2.signatures.handlers.SignaturesAddGitHubOrgAllowlistHandler", + "functionName": "v2.signatures.handlers.SignaturesAddGitHubOrgWhitelistHandler", utils.XREQUESTID: ctx.Value(utils.XREQUESTID), "signatureID": params.SignatureID, } @@ -237,7 +237,7 @@ func Configure(api *operations.EasyclaAPI, claGroupService service.Service, proj session, err := sessionStore.Get(params.HTTPRequest, github.SessionStoreKey) if err != nil { log.WithFields(f).Warnf("error retrieving session from the session store, error: %+v", err) - return signatures.NewAddGitHubOrgAllowlistBadRequest().WithXRequestID(reqID).WithPayload(errorResponse(reqID, err)) + return signatures.NewAddGitHubOrgWhitelistBadRequest().WithXRequestID(reqID).WithPayload(errorResponse(reqID, err)) } githubAccessToken, ok := session.Values["github_access_token"].(string) @@ -246,17 +246,17 @@ func Configure(api *operations.EasyclaAPI, claGroupService service.Service, proj githubAccessToken = "" } - input := v1Models.GhOrgAllowlist{} + input := v1Models.GhOrgWhitelist{} err = copier.Copy(&input, ¶ms.Body) if err != nil { - return signatures.NewAddGitHubOrgAllowlistBadRequest().WithXRequestID(reqID).WithPayload(errorResponse(reqID, err)) + return signatures.NewAddGitHubOrgWhitelistBadRequest().WithXRequestID(reqID).WithPayload(errorResponse(reqID, err)) } ghApprovalList, err := v1SignatureService.AddGithubOrganizationToApprovalList(ctx, params.SignatureID, input, githubAccessToken) if err != nil { log.WithFields(f).Warnf("error adding github organization %s using signature_id: %s to the approval list, error: %+v", *params.Body.OrganizationID, params.SignatureID, err) - return signatures.NewAddGitHubOrgAllowlistBadRequest().WithXRequestID(reqID).WithPayload(errorResponse(reqID, err)) + return signatures.NewAddGitHubOrgWhitelistBadRequest().WithXRequestID(reqID).WithPayload(errorResponse(reqID, err)) } // Create an event @@ -285,19 +285,19 @@ func Configure(api *operations.EasyclaAPI, claGroupService service.Service, proj var response []models.GithubOrg err = copier.Copy(&response, ghApprovalList) if err != nil { - return signatures.NewAddGitHubOrgAllowlistBadRequest().WithXRequestID(reqID).WithPayload(errorResponse(reqID, err)) + return signatures.NewAddGitHubOrgWhitelistBadRequest().WithXRequestID(reqID).WithPayload(errorResponse(reqID, err)) } - return signatures.NewAddGitHubOrgAllowlistOK().WithXRequestID(reqID).WithPayload(response) + return signatures.NewAddGitHubOrgWhitelistOK().WithXRequestID(reqID).WithPayload(response) }) // Delete GitHub Approval List Entries - api.SignaturesDeleteGitHubOrgAllowlistHandler = signatures.DeleteGitHubOrgAllowlistHandlerFunc(func(params signatures.DeleteGitHubOrgAllowlistParams, authUser *auth.User) middleware.Responder { + api.SignaturesDeleteGitHubOrgWhitelistHandler = signatures.DeleteGitHubOrgWhitelistHandlerFunc(func(params signatures.DeleteGitHubOrgWhitelistParams, authUser *auth.User) middleware.Responder { reqID := utils.GetRequestID(params.XREQUESTID) ctx := context.WithValue(context.Background(), utils.XREQUESTID, reqID) // nolint utils.SetAuthUserProperties(authUser, params.XUSERNAME, params.XEMAIL) f := logrus.Fields{ - "functionName": "v2.signatures.handlers.SignaturesDeleteGitHubOrgAllowlistHandler", + "functionName": "v2.signatures.handlers.SignaturesDeleteGitHubOrgWhitelistHandler", utils.XREQUESTID: ctx.Value(utils.XREQUESTID), "signatureID": params.SignatureID, } @@ -305,7 +305,7 @@ func Configure(api *operations.EasyclaAPI, claGroupService service.Service, proj session, err := sessionStore.Get(params.HTTPRequest, github.SessionStoreKey) if err != nil { log.WithFields(f).Warnf("error retrieving session from the session store, error: %+v", err) - return signatures.NewDeleteGitHubOrgAllowlistBadRequest().WithXRequestID(reqID).WithPayload(errorResponse(reqID, err)) + return signatures.NewDeleteGitHubOrgWhitelistBadRequest().WithXRequestID(reqID).WithPayload(errorResponse(reqID, err)) } githubAccessToken, ok := session.Values["github_access_token"].(string) @@ -314,17 +314,17 @@ func Configure(api *operations.EasyclaAPI, claGroupService service.Service, proj githubAccessToken = "" } - input := v1Models.GhOrgAllowlist{} + input := v1Models.GhOrgWhitelist{} err = copier.Copy(&input, ¶ms.Body) if err != nil { - return signatures.NewDeleteGitHubOrgAllowlistBadRequest().WithXRequestID(reqID).WithPayload(errorResponse(reqID, err)) + return signatures.NewDeleteGitHubOrgWhitelistBadRequest().WithXRequestID(reqID).WithPayload(errorResponse(reqID, err)) } ghApprovalList, err := v1SignatureService.DeleteGithubOrganizationFromApprovalList(ctx, params.SignatureID, input, githubAccessToken) if err != nil { log.WithFields(f).Warnf("error deleting github organization %s using signature_id: %s from the approval list, error: %+v", *params.Body.OrganizationID, params.SignatureID, err) - return signatures.NewDeleteGitHubOrgAllowlistBadRequest().WithXRequestID(reqID).WithPayload(errorResponse(reqID, err)) + return signatures.NewDeleteGitHubOrgWhitelistBadRequest().WithXRequestID(reqID).WithPayload(errorResponse(reqID, err)) } // Create an event @@ -351,10 +351,10 @@ func Configure(api *operations.EasyclaAPI, claGroupService service.Service, proj var response []models.GithubOrg err = copier.Copy(&response, ghApprovalList) if err != nil { - return signatures.NewDeleteGitHubOrgAllowlistBadRequest().WithXRequestID(reqID).WithPayload(errorResponse(reqID, err)) + return signatures.NewDeleteGitHubOrgWhitelistBadRequest().WithXRequestID(reqID).WithPayload(errorResponse(reqID, err)) } - return signatures.NewDeleteGitHubOrgAllowlistNoContent().WithXRequestID(reqID).WithPayload(response) + return signatures.NewDeleteGitHubOrgWhitelistNoContent().WithXRequestID(reqID).WithPayload(response) }) // Get Project Signatures diff --git a/cla-backend/.pylintrc b/cla-backend/.pylintrc index 0b48f5b0f..29f0626dc 100644 --- a/cla-backend/.pylintrc +++ b/cla-backend/.pylintrc @@ -5,11 +5,11 @@ # run arbitrary code. extension-pkg-whitelist= -# Add files or directories to the denylist. They should be base names, not +# Add files or directories to the blacklist. They should be base names, not # paths. ignore=CVS -# Add files or directories matching the regex patterns to the denylist. The +# Add files or directories matching the regex patterns to the blacklist. The # regex matches against base names, not paths. ignore-patterns= diff --git a/cla-backend/cla/controllers/company.py b/cla-backend/cla/controllers/company.py index ca7166fa3..4dd1a6b65 100644 --- a/cla-backend/cla/controllers/company.py +++ b/cla-backend/cla/controllers/company.py @@ -203,13 +203,13 @@ def update_company(company_id: str, # pylint: disable=too-many-arguments ''' -def update_company_allowlist_csv(content, company_id, username=None): +def update_company_whitelist_csv(content, company_id, username=None): """ - Adds the CSV of email addresses to this company's allowlist. + Adds the CSV of email addresses to this company's whitelist. :param content: The content posted to this endpoint (CSV data). :type content: string - :param company_id: The ID of the company to add to the allowlist. + :param company_id: The ID of the company to add to the whitelist. :type company_id: UUID """ company = Company() @@ -223,9 +223,9 @@ def update_company_allowlist_csv(content, company_id, username=None): # Ready email addresses. emails = content.split('\n') emails = [email for email in emails if '@' in email] - current_allowlist = company.get_company_allowlist() - new_allowlist = list(set(current_allowlist + emails)) - company.set_company_allowlist(new_allowlist) + current_whitelist = company.get_company_'whitelist'() + new_whitelist = list(set(current_whitelist + emails)) + company.set_company_whitelist(new_whitelist) company.save() return company.to_dict() ''' diff --git a/cla-backend/cla/controllers/signature.py b/cla-backend/cla/controllers/signature.py index f41116337..c19b5ff89 100644 --- a/cla-backend/cla/controllers/signature.py +++ b/cla-backend/cla/controllers/signature.py @@ -158,10 +158,10 @@ def update_signature(signature_id, # pylint: disable=too-many-arguments,too-man signature_embargo_acked=True, signature_return_url=None, signature_sign_url=None, - domain_allowlist=None, - email_allowlist=None, - github_allowlist=None, - github_org_allowlist=None): + domain_whitelist=None, + email_whitelist=None, + github_whitelist=None, + github_org_whitelist=None): """ Updates an signature and returns the newly updated signature in dict format. A value of None means the field should not be updated. @@ -188,10 +188,10 @@ def update_signature(signature_id, # pylint: disable=too-many-arguments,too-man :type signature_return_url: string | None :param signature_sign_url: The URL the user must visit to sign the signature. :type signature_sign_url: string | None - :param domain_allowlist: the domain allowlist - :param email_allowlist: the email allowlist - :param github_allowlist: the github username allowlist - :param github_org_allowlist: the github org allowlist + :param domain_whitelist: the domain whitelist + :param email_whitelist: the email whitelist + :param github_whitelist: the github username whitelist + :param github_org_whitelist: the github org whitelist :return: dict representation of the signature object. :rtype: dict """ @@ -267,49 +267,49 @@ def update_signature(signature_id, # pylint: disable=too-many-arguments,too-man except KeyError: return {'errors': {'signature_sign_url': 'Invalid value passed in for URL field'}} - if domain_allowlist is not None: + if domain_whitelist is not None: try: - domain_allowlist = hug.types.multiple(domain_allowlist) - signature.set_domain_allowlist(domain_allowlist) - update_str += f'domain_allowlist updated to {domain_allowlist} \n' + domain_whitelist = hug.types.multiple(domain_whitelist) + signature.set_domain_whitelist(domain_whitelist) + update_str += f'domain_whitelist updated to {domain_whitelist} \n' except KeyError: return {'errors': { - 'domain_allowlist': 'Invalid value passed in for the domain allowlist' + 'domain_whitelist': 'Invalid value passed in for the domain whitelist' }} - if email_allowlist is not None: + if email_whitelist is not None: try: - email_allowlist = hug.types.multiple(email_allowlist) - signature.set_email_allowlist(email_allowlist) - update_str += f'email_allowlist updated to {email_allowlist} \n' + email_whitelist = hug.types.multiple(email_whitelist) + signature.set_email_whitelist(email_whitelist) + update_str += f'email_whitelist updated to {email_whitelist} \n' except KeyError: return {'errors': { - 'email_allowlist': 'Invalid value passed in for the email allowlist' + 'email_whitelist': 'Invalid value passed in for the email whitelist' }} - if github_allowlist is not None: + if github_whitelist is not None: try: - github_allowlist = hug.types.multiple(github_allowlist) - signature.set_github_allowlist(github_allowlist) + github_whitelist = hug.types.multiple(github_whitelist) + signature.set_github_whitelist(github_whitelist) - # A little bit of special logic to for GitHub allowlists that have bots - bot_list = [github_user for github_user in github_allowlist if is_github_bot(github_user)] + # A little bit of special logic to for GitHub whitelists that have bots + bot_list = [github_user for github_user in github_whitelist if is_github_bot(github_user)] if bot_list is not None: handle_bots(bot_list, signature) - update_str += f'github_allowlist updated to {github_allowlist} \n' + update_str += f'github_whitelist updated to {github_whitelist} \n' except KeyError: return {'errors': { - 'github_allowlist': 'Invalid value passed in for the github allowlist' + 'github_whitelist': 'Invalid value passed in for the github whitelist' }} - if github_org_allowlist is not None: + if github_org_whitelist is not None: try: - github_org_allowlist = hug.types.multiple(github_org_allowlist) - signature.set_github_org_allowlist(github_org_allowlist) - update_str += f'github_org_allowlist updated to {github_org_allowlist} \n' + github_org_whitelist = hug.types.multiple(github_org_whitelist) + signature.set_github_org_whitelist(github_org_whitelist) + update_str += f'github_org_whitelist updated to {github_org_whitelist} \n' except KeyError: return {'errors': { - 'github_org_allowlist': 'Invalid value passed in for the github org allowlist' + 'github_org_whitelist': 'Invalid value passed in for the github org whitelist' }} event_data = update_str @@ -322,7 +322,7 @@ def update_signature(signature_id, # pylint: disable=too-many-arguments,too-man ) signature.save() - notify_allowlist_change(auth_user=auth_user, old_signature=old_signature, new_signature=signature) + notify_whitelist_change(auth_user=auth_user, old_signature=old_signature, new_signature=signature) return signature.to_dict() @@ -341,7 +341,7 @@ def change_in_list(old_list, new_list, msg_added, msg_deleted): return change, added, deleted -def notify_allowlist_change(auth_user, old_signature: Signature, new_signature: Signature): +def notify_whitelist_change(auth_user, old_signature: Signature, new_signature: Signature): company_name = new_signature.get_signature_reference_name() project = cla.utils.get_project_instance() project.load(new_signature.get_signature_project_id()) @@ -350,32 +350,32 @@ def notify_allowlist_change(auth_user, old_signature: Signature, new_signature: changes = [] domain_msg_added = 'The domain {} was added to the domain approval list.' domain_msg_deleted = 'The domain {} was removed from the domain approval list.' - domain_changes, _, _ = change_in_list(old_list=old_signature.get_domain_allowlist(), - new_list=new_signature.get_domain_allowlist(), + domain_changes, _, _ = change_in_list(old_list=old_signature.get_domain_whitelist(), + new_list=new_signature.get_domain_whitelist(), msg_added=domain_msg_added, msg_deleted=domain_msg_deleted) changes = changes + domain_changes email_msg_added = 'The email address {} was added to the email approval list.' email_msg_deleted = 'The email address {} was removed from the email approval list.' - email_changes, email_added, email_deleted = change_in_list(old_list=old_signature.get_email_allowlist(), - new_list=new_signature.get_email_allowlist(), + email_changes, email_added, email_deleted = change_in_list(old_list=old_signature.get_email_whitelist(), + new_list=new_signature.get_email_whitelist(), msg_added=email_msg_added, msg_deleted=email_msg_deleted) changes = changes + email_changes github_msg_added = 'The GitHub user {} was added to the GitHub approval list.' github_msg_deleted = 'The GitHub user {} was removed from the github approval list.' - github_changes, github_added, github_deleted = change_in_list(old_list=old_signature.get_github_allowlist(), - new_list=new_signature.get_github_allowlist(), + github_changes, github_added, github_deleted = change_in_list(old_list=old_signature.get_github_whitelist(), + new_list=new_signature.get_github_whitelist(), msg_added=github_msg_added, msg_deleted=github_msg_deleted) changes = changes + github_changes github_org_msg_added = 'The GitHub organization {} was added to the GitHub organization approval list.' github_org_msg_deleted = 'The GitHub organization {} was removed from the GitHub organization approval list.' - github_org_changes, _, _ = change_in_list(old_list=old_signature.get_github_org_allowlist(), - new_list=new_signature.get_github_org_allowlist(), + github_org_changes, _, _ = change_in_list(old_list=old_signature.get_github_org_whitelist(), + new_list=new_signature.get_github_org_whitelist(), msg_added=github_org_msg_added, msg_deleted=github_org_msg_deleted) changes = changes + github_org_changes @@ -390,7 +390,7 @@ def notify_allowlist_change(auth_user, old_signature: Signature, new_signature: cla_manager_name = auth_user.name # send email to contributors - notify_allowlist_change_to_contributors(project=project, + notify_whitelist_change_to_contributors(project=project, email_added=email_added, email_removed=email_deleted, github_users_added=github_added, @@ -410,16 +410,16 @@ def notify_allowlist_change(auth_user, old_signature: Signature, new_signature: ) -def notify_allowlist_change_to_contributors(project, email_added, email_removed, +def notify_whitelist_change_to_contributors(project, email_added, email_removed, github_users_added, github_users_removed, company_name, project_name, cla_manager_name): for email in email_added: - subject, body, recipients = get_contributor_allowlist_update_email_content( + subject, body, recipients = get_contributor_whitelist_update_email_content( project, 'added', company_name, project_name, cla_manager_name, email) get_email_service().send(subject, body, recipients) for email in email_removed: - subject, body, recipients = get_contributor_allowlist_update_email_content( + subject, body, recipients = get_contributor_whitelist_update_email_content( project, 'deleted', company_name, project_name, cla_manager_name, email) get_email_service().send(subject, body, recipients) @@ -429,7 +429,7 @@ def notify_allowlist_change_to_contributors(project, email_added, email_removed, if users is not None: user = users[0] email = user.get_user_email() - subject, body, recipients = get_contributor_allowlist_update_email_content( + subject, body, recipients = get_contributor_whitelist_update_email_content( project, 'added', company_name, project_name, cla_manager_name, email) get_email_service().send(subject, body, recipients) @@ -439,12 +439,12 @@ def notify_allowlist_change_to_contributors(project, email_added, email_removed, if users is not None: user = users[0] email = user.get_user_email() - subject, body, recipients = get_contributor_allowlist_update_email_content( + subject, body, recipients = get_contributor_whitelist_update_email_content( project, 'deleted', company_name, project_name, cla_manager_name, email) get_email_service().send(subject, body, recipients) -def get_contributor_allowlist_update_email_content(project, action, company_name, project_name, cla_manager, email): +def get_contributor_whitelist_update_email_content(project, action, company_name, project_name, cla_manager, email): subject = f'EasyCLA: Approval List Update for {project_name}' preposition = 'to' if action == 'deleted': @@ -465,7 +465,7 @@ def get_contributor_allowlist_update_email_content(project, action, company_name def approval_list_change_email_content(project, company_name, project_name, cla_managers, changes): - """Helper function to get allowlist change email subject, body, recipients""" + """Helper function to get whitelist change email subject, body, recipients""" subject = f'EasyCLA: Approval List Update for {project_name}' # Append suffix / prefix to strings in list changes = ["
  • " + txt + "
  • " for txt in changes] diff --git a/cla-backend/cla/controllers/signing.py b/cla-backend/cla/controllers/signing.py index 4a94578e6..dfe0e2951 100644 --- a/cla-backend/cla/controllers/signing.py +++ b/cla-backend/cla/controllers/signing.py @@ -76,7 +76,7 @@ def request_corporate_signature(auth_user, :type signing_entity_name: string :param send_as_email: the send as email flag :type send_as_email: bool - :param authority_name: the company manager/authority who is responsible for allowlisting/managing the company, but + :param authority_name: the company manager/authority who is responsible for whitelisting/managing the company, but may not be a CLA signatory :type authority_name: str :param authority_email: the company manager/authority email @@ -139,7 +139,7 @@ def check_and_prepare_employee_signature(project_id, company_id, user_id): Checks that 1. The given project, company, and user exists 2. The company signatory has signed the CCLA for their company. - 3. The user is included as part of the allowlist of the CCLA that the company signed. + 3. The user is included as part of the whitelist of the CCLA that the company signed. :param project_id: The ID of the CLA Group (project) the user is signing a CCLA for. :type project_id: string diff --git a/cla-backend/cla/controllers/user.py b/cla-backend/cla/controllers/user.py index 79ed04812..1edf39aa5 100644 --- a/cla-backend/cla/controllers/user.py +++ b/cla-backend/cla/controllers/user.py @@ -9,7 +9,7 @@ import cla from cla.models import DoesNotExist -from cla.models.dynamo_models import User, Company, Project, Event, CCLAAllowlistRequest, CompanyInvite +from cla.models.dynamo_models import User, Company, Project, Event, CCLAWhitelistRequest, CompanyInvite from cla.models.event_types import EventType from cla.utils import get_user_instance, get_company_instance, get_email_service, get_email_sign_off_content, get_email_help_content, \ append_email_help_sign_off_content @@ -103,7 +103,7 @@ def get_users_company(user_company_id): return [user.to_dict() for user in users] -def request_company_allowlist(user_id: str, company_id: str, user_name: str, user_email: str, project_id: str, +def request_company_whitelist(user_id: str, company_id: str, user_name: str, user_email: str, project_id: str, message: str = None, recipient_name: str = None, recipient_email: str = None): """ Sends email to the specified company manager notifying them that a user has requested to be @@ -284,16 +284,16 @@ def invite_cla_manager(contributor_id, contributor_name, contributor_email, cla_ cla_manager_name, cla_manager_email, company_name, False) - # update ccla_allowlist_request - ccla_allowlist_request = CCLAAllowlistRequest() - ccla_allowlist_request.set_request_id(str(uuid.uuid4())) - ccla_allowlist_request.set_company_name(company_name) - ccla_allowlist_request.set_project_name(project_name) - ccla_allowlist_request.set_user_github_id(contributor_id) - ccla_allowlist_request.set_user_github_username(contributor_name) - ccla_allowlist_request.set_user_emails(set([contributor_email])) - ccla_allowlist_request.set_request_status("pending") - ccla_allowlist_request.save() + # update ccla_whitelist_request + ccla_whitelist_request = CCLAWhitelistRequest() + ccla_whitelist_request.set_request_id(str(uuid.uuid4())) + ccla_whitelist_request.set_company_name(company_name) + ccla_whitelist_request.set_project_name(project_name) + ccla_whitelist_request.set_user_github_id(contributor_id) + ccla_whitelist_request.set_user_github_username(contributor_name) + ccla_whitelist_request.set_user_emails(set([contributor_email])) + ccla_whitelist_request.set_request_status("pending") + ccla_whitelist_request.save() Event.create_event( event_user_id=contributor_id, @@ -356,15 +356,15 @@ def request_company_ccla(user_id, user_email, company_id, project_id): f'for company {company_name}') cla.log.debug(f'creating CCLA approval request table entry for {msg}') # Add an entry into the CCLA request table - ccla_allowlist_request = CCLAAllowlistRequest() - ccla_allowlist_request.set_request_id(str(uuid.uuid4())) - ccla_allowlist_request.set_company_name(company_name) - ccla_allowlist_request.set_project_name(project_name) - ccla_allowlist_request.set_user_github_id(user.get_user_github_id()) - ccla_allowlist_request.set_user_github_username(user.get_user_github_username()) - ccla_allowlist_request.set_user_emails({user_email}) - ccla_allowlist_request.set_request_status("pending") - ccla_allowlist_request.save() + ccla_whitelist_request = CCLAWhitelistRequest() + ccla_whitelist_request.set_request_id(str(uuid.uuid4())) + ccla_whitelist_request.set_company_name(company_name) + ccla_whitelist_request.set_project_name(project_name) + ccla_whitelist_request.set_user_github_id(user.get_user_github_id()) + ccla_whitelist_request.set_user_github_username(user.get_user_github_username()) + ccla_whitelist_request.set_user_emails({user_email}) + ccla_whitelist_request.set_request_status("pending") + ccla_whitelist_request.save() cla.log.debug(f'created CCLA approval request table entry for {msg}') diff --git a/cla-backend/cla/models/docusign_models.py b/cla-backend/cla/models/docusign_models.py index edfe838f4..2bc032be0 100644 --- a/cla-backend/cla/models/docusign_models.py +++ b/cla-backend/cla/models/docusign_models.py @@ -66,7 +66,7 @@ class CCLANotFound(Exception): pass -class UserNotAllowlisted(Exception): +class UserNotWhitelisted(Exception): pass @@ -389,7 +389,7 @@ def check_and_prepare_employee_signature(project_id, company_id, user_id) -> dic # Before an employee begins the signing process, ensure that # 1. The given project, company, and user exists # 2. The company signatory has signed the CCLA for their company. - # 3. The user is included as part of the allowlist of the CCLA that the company signed. + # 3. The user is included as part of the whitelist of the CCLA that the company signed. # Returns an error if any of the above is false. fn = 'docusign_models.check_and_prepare_employee_signature' diff --git a/cla-backend/cla/models/dynamo_models.py b/cla-backend/cla/models/dynamo_models.py index 4bfc7bb0f..5424b2604 100644 --- a/cla-backend/cla/models/dynamo_models.py +++ b/cla-backend/cla/models/dynamo_models.py @@ -57,7 +57,7 @@ def create_database(): GitHubOrgModel, GerritModel, EventModel, - CCLAAllowlistRequestModel, + CCLAWhitelistRequestModel, ] # Create all required tables. @@ -82,7 +82,7 @@ def delete_database(): StoreModel, GitHubOrgModel, GerritModel, - CCLAAllowlistRequestModel, + CCLAWhitelistRequestModel, ] # Delete all existing tables. for table in tables: @@ -700,7 +700,7 @@ class CompanyIDProjectIDIndex(GlobalSecondaryIndex): """ class Meta: - """ Meta class for ccla-allowlist-requests company-id-project-id-index """ + """ Meta class for ccla-whitelist-requests company-id-project-id-index """ index_name = "company-id-project-id-index" write_capacity_units = int(cla.conf["DYNAMO_WRITE_UNITS"]) read_capacity_units = int(cla.conf["DYNAMO_READ_UNITS"]) @@ -2037,11 +2037,11 @@ def preprocess_pattern(self, emails, patterns) -> bool: def is_approved(self, ccla_signature: Signature) -> bool: """ Helper function to determine whether at least one of the user's email - addresses are allowlisted for a particular ccla signature. + addresses are whitelisted for a particular ccla signature. :param ccla_signature: The ccla signature to check against. :type ccla_signature: cla.models.Signature - :return: True if at least one email is allowlisted, False otherwise. + :return: True if at least one email is whitelisted, False otherwise. :rtype: bool """ fn = 'dynamo_models.is_approved' @@ -2051,26 +2051,26 @@ def is_approved(self, ccla_signature: Signature) -> bool: # remove leading and trailing whitespace before checking emails emails = [email.strip() for email in emails] - # First, we check email allowlist - allowlist = ccla_signature.get_email_allowlist() + # First, we check email whitelist + whitelist = ccla_signature.get_email_whitelist() cla.log.debug(f'{fn} - testing user emails: {emails} with ' - f'CCLA approval emails: {allowlist}') + f'CCLA approval emails: {whitelist}') - if allowlist is not None: + if whitelist is not None: for email in emails: # Case insensitive match - if email.lower() in (s.lower() for s in allowlist): + if email.lower() in (s.lower() for s in whitelist): cla.log.debug(f'{fn} - found user email in email approval list') return True else: - cla.log.debug(f'{fn} - no email allowlist match for user: {self}') + cla.log.debug(f'{fn} - no email whitelist match for user: {self}') - # Secondly, let's check domain allowlist + # Secondly, let's check domain whitelist # If a naked domain (e.g. google.com) is provided, we prefix it with '^.*@', # so that sub-domains are not allowed. # If a '*', '*.' or '.' prefix is provided, we replace the prefix with '.*\.', # which will allow subdomains. - patterns = ccla_signature.get_domain_allowlist() + patterns = ccla_signature.get_domain_whitelist() cla.log.debug(f'{fn} - testing user email domains: {emails} with ' f'domain approval values: {patterns}') @@ -2083,7 +2083,7 @@ def is_approved(self, ccla_signature: Signature) -> bool: cla.log.debug(f'{fn} - no domain approval patterns defined - ' 'skipping domain approval checks') - # Third and Forth, check github allowlists + # Third and Forth, check github whitelists github_username = self.get_user_github_username() github_id = self.get_user_github_id() @@ -2091,7 +2091,7 @@ def is_approved(self, ccla_signature: Signature) -> bool: # Since usernames can be changed, if we have the github_id already - let's # lookup the username by id to see if they have changed their username # if the username is different, then we should reset the field to the - # new value - this will potentially change the github username allowlist + # new value - this will potentially change the github username whitelist # since the old username is already in the list # Attempt to fetch the github username based on the github id @@ -2115,13 +2115,13 @@ def is_approved(self, ccla_signature: Signature) -> bool: if github_username is not None: # remove leading and trailing whitespace from github username github_username = github_username.strip() - github_allowlist = ccla_signature.get_github_allowlist() + github_whitelist = ccla_signature.get_github_whitelist() cla.log.debug(f'{fn} - testing user github username: {github_username} with ' - f'CCLA github approval list: {github_allowlist}') + f'CCLA github approval list: {github_whitelist}') - if github_allowlist is not None: + if github_whitelist is not None: # case insensitive search - if github_username.lower() in (s.lower() for s in github_allowlist): + if github_username.lower() in (s.lower() for s in github_whitelist): cla.log.debug(f'{fn} - found github username in github approval list') return True else: @@ -2131,7 +2131,7 @@ def is_approved(self, ccla_signature: Signature) -> bool: # Check github org approval list if github_username is not None: # Load the github org approval list for this CCLA signature record - github_org_approval_list = ccla_signature.get_github_org_allowlist() + github_org_approval_list = ccla_signature.get_github_org_whitelist() if github_org_approval_list is not None: # Fetch the list of orgs associated with this user cla.log.debug(f'{fn} - determining if github user {github_username} is associated ' @@ -2182,13 +2182,13 @@ def is_approved(self, ccla_signature: Signature) -> bool: if gitlab_username is not None: # remove leading and trailing whitespace from gitlab username gitlab_username = gitlab_username.strip() - gitlab_allowlist = ccla_signature.get_gitlab_username_approval_list() + gitlab_whitelist = ccla_signature.get_gitlab_username_approval_list() cla.log.debug(f'{fn} - testing user github username: {gitlab_username} with ' - f'CCLA github approval list: {gitlab_allowlist}') + f'CCLA github approval list: {gitlab_whitelist}') - if gitlab_allowlist is not None: + if gitlab_whitelist is not None: # case insensitive search - if gitlab_username.lower() in (s.lower() for s in gitlab_allowlist): + if gitlab_username.lower() in (s.lower() for s in gitlab_whitelist): cla.log.debug(f'{fn} - found gitlab username in gitlab approval list') return True else: @@ -2213,7 +2213,7 @@ def is_approved(self, ccla_signature: Signature) -> bool: except DoesNotExist as err: cla.log.debug(f'gitlab group with full path: {gl_name} does not exist: {err}') - cla.log.debug(f'{fn} - unable to find user in any allowlist') + cla.log.debug(f'{fn} - unable to find user in any whitelist') return False def get_users_by_company(self, company_id): @@ -2551,8 +2551,7 @@ class Meta: project_signature_external_id_index = SignatureProjectExternalIndex() signature_project_reference_index = SignatureProjectReferenceIndex() - # approval lists (previously called allowlists) are only used by CCLAs - # we can't update their names to be inclusive yet as they are DynamoDB item properties + # approval lists (previously called whitelists) are only used by CCLAs domain_whitelist = ListAttribute(null=True) email_whitelist = ListAttribute(null=True) github_whitelist = ListAttribute(null=True) @@ -2602,10 +2601,10 @@ def __init__( signature_acl=set(), signature_return_url_type=None, signature_envelope_id=None, - domain_allowlist=None, - email_allowlist=None, - github_allowlist=None, - github_org_allowlist=None, + domain_whitelist=None, + email_whitelist=None, + github_whitelist=None, + github_org_whitelist=None, note=None, signature_project_external_id=None, signature_company_signatory_id=None, @@ -2650,11 +2649,10 @@ def __init__( self.model.signature_acl = signature_acl self.model.signature_return_url_type = signature_return_url_type self.model.signature_envelope_id = signature_envelope_id - # we can't update their names to be inclusive yet as they are DynamoDB item properties - self.model.domain_whitelist = domain_allowlist - self.model.email_whitelist = email_allowlist - self.model.github_whitelist = github_allowlist - self.model.github_org_whitelist = github_org_allowlist + self.model.domain_whitelist = domain_whitelist + self.model.email_whitelist = email_whitelist + self.model.github_whitelist = github_whitelist + self.model.github_org_whitelist = github_org_whitelist self.model.note = note self.model.signature_project_external_id = signature_project_external_id self.model.signature_company_signatory_id = signature_company_signatory_id @@ -2677,8 +2675,8 @@ def __str__(self): "reference type: {}, " "user cla company id: {}, signed: {}, signed_on: {}, signatory_name: {}, signing entity name: {}," "sigtype_signed_approved_id: {}, " - "approved: {}, embargo_acked: {}, domain allowlist: {}, " - "email allowlist: {}, github user allowlist: {}, github domain allowlist: {}, " + "approved: {}, embargo_acked: {}, domain whitelist: {}, " + "email whitelist: {}, github user whitelist: {}, github domain whitelist: {}, " "note: {},signature project external id: {}, signature company signatory id: {}, " "signature company signatory name: {}, signature company signatory email: {}," "signature company initial manager id: {}, signature company initial manager name: {}," @@ -2702,7 +2700,6 @@ def __str__(self): self.model.sigtype_signed_approved_id, self.model.signature_approved, self.model.signature_embargo_acked, - # we can't update their names to be inclusive yet as they are DynamoDB item properties self.model.domain_whitelist, self.model.email_whitelist, self.model.github_whitelist, @@ -2829,20 +2826,16 @@ def get_signature_return_url_type(self): def get_signature_envelope_id(self): return self.model.signature_envelope_id - # we can't update their names to be inclusive yet as they are DynamoDB item properties - def get_domain_allowlist(self): + def get_domain_whitelist(self): return self.model.domain_whitelist - # we can't update their names to be inclusive yet as they are DynamoDB item properties - def get_email_allowlist(self): + def get_email_whitelist(self): return self.model.email_whitelist - # we can't update their names to be inclusive yet as they are DynamoDB item properties - def get_github_allowlist(self): + def get_github_whitelist(self): return self.model.github_whitelist - # we can't update their names to be inclusive yet as they are DynamoDB item properties - def get_github_org_allowlist(self): + def get_github_org_whitelist(self): return self.model.github_org_whitelist def get_gitlab_org_approval_list(self): @@ -2993,23 +2986,19 @@ def set_signature_company_initial_manager_email(self, signature_company_initial_ def set_signature_company_secondary_manager_list(self, signature_company_secondary_manager_list) -> None: self.model.signature_company_secondary_manager_list = signature_company_secondary_manager_list - # Remove leading and trailing whitespace for all items before setting allowlist + # Remove leading and trailing whitespace for all items before setting whitelist - # we can't update their names to be inclusive yet as they are DynamoDB item properties - def set_domain_allowlist(self, domain_allowlist) -> None: - self.model.domain_whitelist = [domain.strip() for domain in domain_allowlist] + def set_domain_whitelist(self, domain_whitelist) -> None: + self.model.domain_whitelist = [domain.strip() for domain in domain_whitelist] - # we can't update their names to be inclusive yet as they are DynamoDB item properties - def set_email_allowlist(self, email_allowlist) -> None: - self.model.email_whitelist = [email.strip() for email in email_allowlist] + def set_email_whitelist(self, email_whitelist) -> None: + self.model.email_whitelist = [email.strip() for email in email_whitelist] - # we can't update their names to be inclusive yet as they are DynamoDB item properties - def set_github_allowlist(self, github_allowlist) -> None: - self.model.github_whitelist = [github_user.strip() for github_user in github_allowlist] + def set_github_whitelist(self, github_whitelist) -> None: + self.model.github_whitelist = [github_user.strip() for github_user in github_whitelist] - # we can't update their names to be inclusive yet as they are DynamoDB item properties - def set_github_org_allowlist(self, github_org_allowlist) -> None: - self.model.github_org_whitelist = [github_org.strip() for github_org in github_org_allowlist] + def set_github_org_whitelist(self, github_org_whitelist) -> None: + self.model.github_org_whitelist = [github_org.strip() for github_org in github_org_whitelist] def set_gitlab_username_approval_list(self, gitlab_username_approval_list) -> None: self.model.gitlab_username_approval_list = [gitlab_user.strip() for gitlab_user in @@ -5316,15 +5305,14 @@ def create_event( return {"errors": {"event_id": str(err)}} -class CCLAAllowlistRequestModel(BaseModel): +class CCLAWhitelistRequestModel(BaseModel): """ - Represents a CCLAAllowlistRequest in the database + Represents a CCLAWhitelistRequest in the database """ class Meta: - """ Meta class for cclaallowlistrequest """ + """ Meta class for cclawhitelistrequest """ - # we can't update this to be inclusive yet as it is a DynamoDB table name table_name = "cla-{}-ccla-whitelist-requests".format(stage) if stage == "local": host = "http://localhost:8000" @@ -5344,9 +5332,9 @@ class Meta: company_id_project_id_index = CompanyIDProjectIDIndex() -class CCLAAllowlistRequest(model_interfaces.CCLAAllowlistRequest): +class CCLAWhitelistRequest(model_interfaces.CCLAWhitelistRequest): """ - ORM-agnostic wrapper for the DynamoDB CCLAAllowlistRequestModel + ORM-agnostic wrapper for the DynamoDB CCLAWhitelistRequestModel """ def __init__( @@ -5364,8 +5352,8 @@ def __init__( user_name=None, project_external_id=None, ): - super(CCLAAllowlistRequest).__init__() - self.model = CCLAAllowlistRequestModel() + super(CCLAWhitelistRequest).__init__() + self.model = CCLAWhitelistRequestModel() self.model.request_id = request_id self.model.company_id = company_id self.model.company_name = company_name @@ -5403,9 +5391,9 @@ def save(self): def load(self, request_id): try: - ccla_allowlist_request = self.model.get(str(request_id)) - except CCLAAllowlistRequest.DoesNotExist: - raise cla.models.DoesNotExist("CCLAAllowlistRequest not found") + ccla_whitelist_request = self.model.get(str(request_id)) + except CCLAWhitelistRequest.DoesNotExist: + raise cla.models.DoesNotExist("CCLAWhitelistRequest not found") def delete(self): self.model.delete() @@ -5492,10 +5480,10 @@ def set_project_external_id(self, project_external_id): self.model.project_external_id = project_external_id def all(self): - ccla_allowlist_requests = self.model.scan() + ccla_whitelist_requests = self.model.scan() ret = [] - for request in ccla_allowlist_requests: - ccla_allowlist_request = CCLAAllowlistRequest() - ccla_allowlist_request.model = request - ret.append(ccla_allowlist_request) + for request in ccla_whitelist_requests: + ccla_whitelist_request = CCLAWhitelistRequest() + ccla_whitelist_request.model = request + ret.append(ccla_whitelist_request) return ret diff --git a/cla-backend/cla/models/event_types.py b/cla-backend/cla/models/event_types.py index 86ec0636a..b70574e7e 100644 --- a/cla-backend/cla/models/event_types.py +++ b/cla-backend/cla/models/event_types.py @@ -7,7 +7,7 @@ class EventType(Enum): """ Enumerator representing type of CLA events - across projects, users, signatures, allowlists + across projects, users, signatures, whitelists """ CreateUser = "Create User" UpdateUser = "Update User" @@ -26,7 +26,7 @@ class EventType(Enum): RemovePermission = "Remove Permission" AddProjectManager = "Add Project Manager" RemoveProjectManager = "Remove Project Manager" - RequestCompanyWL = "Request Company Allowlist" + RequestCompanyWL = "Request Company Whitelist" InviteAdmin = "Invite Admin" RequestCCLA = "Request Company CCLA" RequestCompanyAdmin = "Request Company Admin access" diff --git a/cla-backend/cla/models/github_models.py b/cla-backend/cla/models/github_models.py index f5b286813..dac3c37af 100644 --- a/cla-backend/cla/models/github_models.py +++ b/cla-backend/cla/models/github_models.py @@ -1514,7 +1514,7 @@ def handle_commit_from_user( # projects like CNCF which significantly delays updating the GH PR status. # Revisit once we add more indexes to the table - # # Check to see if not found user is allowlisted to assist in triaging github comment + # # Check to see if not found user is whitelisted to assist in triaging github comment # # Search for the CCLA signatures for this project - wish we had a company ID to restrict the query... # signatures = cla.utils.get_signature_instance().get_signatures_by_project( # project.get_project_id(), @@ -1524,16 +1524,16 @@ def handle_commit_from_user( # # list_author_info = list(author_info) # for signature in signatures: - # if cla.utils.is_allowlisted( + # if cla.utils.is_whitelisted( # signature, # email=author_email, # github_id=author_id, # github_username=author_username # ): - # # Append allowlisted flag to the author info list + # # Append whitelisted flag to the author info list # cla.log.debug(f'Github user(id:{author_id}, ' # f'user: {author_username}, ' - # f'email {author_email}) is allowlisted but not a CLA user') + # f'email {author_email}) is whitelisted but not a CLA user') # list_author_info.append(True) # break # missing.append((commit_sha, list_author_info)) @@ -1877,7 +1877,7 @@ def update_pull_request( "github", str(installation_id), github_repository_id, pull_request.number, project_version ) - # check if unsigned user is allowlisted + # check if unsigned user is whitelisted if user_commit_summary.commit_sha != last_commit.sha: continue diff --git a/cla-backend/cla/models/model_interfaces.py b/cla-backend/cla/models/model_interfaces.py index 7bb27c8ac..974429196 100644 --- a/cla-backend/cla/models/model_interfaces.py +++ b/cla-backend/cla/models/model_interfaces.py @@ -934,16 +934,16 @@ def get_signature_user_ccla_company_id(self): """ raise NotImplementedError() - def get_domain_allowlist(self): + def get_domain_whitelist(self): raise NotImplementedError() - def get_email_allowlist(self): + def get_email_whitelist(self): raise NotImplementedError() - def get_github_allowlist(self): + def get_github_whitelist(self): raise NotImplementedError() - def get_github_org_allowlist(self): + def get_github_org_whitelist(self): raise NotImplementedError() def get_gitlab_org_approval_list(self): @@ -1338,66 +1338,66 @@ def set_is_sanctioned(self, is_sanctioned): """ raise NotImplementedError() - def set_company_allowlist(self, allowlist): + def set_company_whitelist(self, whitelist): """ - Setter for an company's allowlisted domain names. + Setter for an company's whitelisted domain names. - :param allowlist: The list of domain names to mark as safe. + :param whitelist: The list of domain names to mark as safe. Example: ['ibm.com', 'ibm.ca'] - :type allowlist: list of strings + :type whitelist: list of strings """ raise NotImplementedError() - def add_company_allowlist(self, allowlist_item): + def add_company_whitelist(self, whitelist_item): """ - Adds another entry in the list of allowlisted domain names. + Adds another entry in the list of whitelisted domain names. Does not query the DB - save() will take care of that. - :param allowlist_item: A domain name to add to the allowlist of this company. - :type allowlist_item: string + :param whitelist_item: A domain name to add to the whitelist of this company. + :type whitelist_item: string """ raise NotImplementedError() - def remove_company_allowlist(self, allowlist_item): + def remove_company_whitelist(self, whitelist_item): """ - Removes an entry from the list of allowlisted domain names. + Removes an entry from the list of whitelisted domain names. Does not query the DB - save() will take care of that. - :param allowlist_item: A domain name to remove from the allowlist of this company. - :type allowlist_item: string + :param whitelist_item: A domain name to remove from the whitelist of this company. + :type whitelist_item: string """ raise NotImplementedError() - def set_company_allowlist_patterns(self, allowlist_patterns): + def set_company_whitelist_patterns(self, whitelist_patterns): """ - Setter for an company's allowlist regex patterns. + Setter for an company's whitelist regex patterns. - :param allowlist_patterns: The list of email patterns to exlude from signing. + :param whitelist_patterns: The list of email patterns to exlude from signing. Example: ['.*@ibm.co.uk$', '^info.*'] - :type allowlist_patterns: list of strings + :type whitelist_patterns: list of strings :todo: Need to actually test out those examples. """ raise NotImplementedError() - def add_company_allowlist_pattern(self, allowlist_pattern): + def add_company_whitelist_pattern(self, whitelist_pattern): """ - Adds another entry in the list of allowlistd patterns. + Adds another entry in the list of whitelistd patterns. Does not query the DB - save() will take care of that. - :param allowlist_pattern: A regex string to add to the excluded patterns of this company. - :type allowlist_pattern: string + :param whitelist_pattern: A regex string to add to the excluded patterns of this company. + :type whitelist_pattern: string """ raise NotImplementedError() - def remove_company_allowlist_pattern(self, allowlist_pattern): + def remove_company_whitelist_pattern(self, whitelist_pattern): """ - Removes an entry from the list of allowlisted domain names. + Removes an entry from the list of whitelisted domain names. Does not query the DB - save() will take care of that. - :param allowlist_pattern: A regex string to remove from the exluded patterns + :param whitelist_pattern: A regex string to remove from the exluded patterns of this company. - :type allowlist_pattern: string + :type whitelist_pattern: string """ raise NotImplementedError() @@ -2317,9 +2317,9 @@ def all(self, project_sfids): raise NotImplementedError() -class CCLAAllowlistRequest(object): +class CCLAWhitelistRequest(object): """ - Interface to the CCLAAllowlistRequest Model + Interface to the CCLAWhitelistRequest Model """ def to_dict(self): @@ -2348,14 +2348,14 @@ def load(self, request_id): Simple abstraction around the supported ORMs to load a model Populates the current object. - :param request_id: The id of the ccla allowlist request + :param request_id: The id of the ccla whitelist request :type request_id: string """ raise NotImplementedError() def all(self): """ - Fetches all CCLAAllowlistRequests in the CLA system. + Fetches all CCLAWhitelistRequests in the CLA system. :return: A list of projectCLAGroup objects. :rtype: [cla.models.model_interfaces.ProjectCLAGroup] diff --git a/cla-backend/cla/routes.py b/cla-backend/cla/routes.py index 39f471cfb..bbc56fa91 100755 --- a/cla-backend/cla/routes.py +++ b/cla-backend/cla/routes.py @@ -152,9 +152,9 @@ def get_users_company(auth_user: check_auth, user_company_id: hug.types.uuid): """ return cla.controllers.user.get_users_company(user_company_id) -# We can't change API URL to be inclusive yet as this would break all consumers and require acs-cli and lfx-gateway updates + @hug.post("/user/{user_id}/request-company-whitelist/{company_id}", versions=2) -def request_company_allowlist( +def request_company_whitelist( user_id: hug.types.uuid, company_id: hug.types.uuid, user_name: hug.types.text, @@ -170,9 +170,9 @@ def request_company_allowlist( DATA: {'user_email': , 'message': 'custom message to manager'} Performs the necessary actions (ie: send email to manager) when the specified user requests to - be added the the specified company's allowlist. + be added the the specified company's whitelist. """ - return cla.controllers.user.request_company_allowlist( + return cla.controllers.user.request_company_whitelist( user_id, str(company_id), str(user_name), str(user_email), str(project_id), message, str(recipient_name), str(recipient_email), ) @@ -341,7 +341,6 @@ def post_signature( ) -# We can't change API parameters to be inclusive yet as this would break all consumers and require acs-cli and lfx-gateway updates @hug.put( "/signature", versions=1, @@ -360,7 +359,7 @@ def put_signature( signature_embargo_acked=None, signature_return_url=None, signature_sign_url=None, - domain_whitelist=None, # because they come from API parameter we can't change to inclusive names yet + domain_whitelist=None, email_whitelist=None, github_whitelist=None, github_org_whitelist=None, @@ -387,10 +386,10 @@ def put_signature( signature_embargo_acked=signature_embargo_acked, signature_return_url=signature_return_url, signature_sign_url=signature_sign_url, - domain_allowlist=domain_whitelist, # because they come from API parameter we can't change to inclusive names yet - email_allowlist=email_whitelist, - github_allowlist=github_whitelist, - github_org_allowlist=github_org_whitelist, + domain_whitelist=domain_whitelist, + email_whitelist=email_whitelist, + github_whitelist=github_whitelist, + github_org_whitelist=github_org_whitelist, ) @@ -735,18 +734,17 @@ def delete_company(auth_user: check_auth, company_id: hug.types.text): return cla.controllers.company.delete_company(company_id, username=auth_user.username) -# We can't change API URL to be inclusive yet as this would break all consumers and require acs-cli and lfx-gateway updates @hug.put("/company/{company_id}/import/whitelist/csv", versions=1) -def put_company_allowlist_csv(body, auth_user: check_auth, company_id: hug.types.uuid): +def put_company_whitelist_csv(body, auth_user: check_auth, company_id: hug.types.uuid): """ PUT: /company/{company_id}/import/whitelist/csv - Imports a CSV file of allowlisted user emails. + Imports a CSV file of whitelisted user emails. Expects the first column to have a header in the first row and contain email addresses. """ # staff_verify(user) or company_manager_verify(user, company_id) content = body.read().decode() - return cla.controllers.company.update_company_allowlist_csv(content, company_id, username=auth_user.username) + return cla.controllers.company.update_company_whitelist_csv(content, company_id, username=auth_user.username) @hug.get("/companies/{manager_id}", version=1) diff --git a/cla-backend/cla/tests/unit/test_email_approval_list.py b/cla-backend/cla/tests/unit/test_email_approval_list.py index 776fc0481..a2975689c 100644 --- a/cla-backend/cla/tests/unit/test_email_approval_list.py +++ b/cla-backend/cla/tests/unit/test_email_approval_list.py @@ -67,8 +67,8 @@ def test_pattern_with_dot_prefix(create_user): def test_email_approval_list_fail(create_user): """Test email that fails domain and email approval list checks """ signature = Signature() - signature.get_email_allowlist = MagicMock(return_value={"foo@gmail.com"}) - signature.get_domain_allowlist = MagicMock(return_value=["foo.com"]) + signature.get_email_whitelist = MagicMock(return_value={"foo@gmail.com"}) + signature.get_domain_whitelist = MagicMock(return_value=["foo.com"]) create_user.get_all_user_emails = MagicMock(return_value=["bar@gmail.com"]) assert create_user.is_approved(signature) == False @@ -76,6 +76,6 @@ def test_email_approval_list_fail(create_user): def test_gerrit_project_approval_listing(create_user): """Test for email in signature approval list""" signature = Signature() - signature.get_email_allowlist = MagicMock(return_value={"phillip.leigh@amdocs.com"}) + signature.get_email_whitelist = MagicMock(return_value={"phillip.leigh@amdocs.com"}) create_user.get_all_user_emails = MagicMock(return_value=["phillip.leigh@amdocs.com"]) assert create_user.is_approved(signature) == True diff --git a/cla-backend/cla/tests/unit/test_github.py b/cla-backend/cla/tests/unit/test_github.py index 7bac977a5..1d4229cd4 100644 --- a/cla-backend/cla/tests/unit/test_github.py +++ b/cla-backend/cla/tests/unit/test_github.py @@ -77,14 +77,14 @@ # assert response == expected -# def test_get_comment_body_allowlisted_missing_user(): +# def test_get_comment_body_whitelisted_missing_user(): # """ -# Test CLA comment body for case of a allowlisted user that has not confirmed affiliation +# Test CLA comment body for case of a whitelisted user that has not confirmed affiliation # """ -# is_allowlisted = True +# is_whitelisted = True # author = "foo" # signed = [] -# missing = [(GITHUB_FAKE_SHA, ["12", author, "foo@gmail.com", is_allowlisted])] +# missing = [(GITHUB_FAKE_SHA, ["12", author, "foo@gmail.com", is_whitelisted])] # response = get_comment_body("github", SIGN_URL, signed, missing) # expected = ( # f"