Skip to content

Commit 016320b

Browse files
Merge pull request #4732 from linuxfoundation/unicron-use-inclusive-naming
Use inclusive naming 'whitelist' -> 'allowlist'
2 parents c6f5430 + 7c628c3 commit 016320b

File tree

6 files changed

+48
-48
lines changed

6 files changed

+48
-48
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Whitelisting Bots
1+
## Allowlisting Bots
22

33
You can allow specific bot users to automatically pass the CLA check.
44

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ The following diagram explains the EasyCLA architecture.
6161

6262
![CLA Architecture](.gitbook/assets/easycla-architecture-overview.png)
6363

64-
## Bot Whitelisting
64+
## Bot CLA Exemptions
6565

66-
For whitelisting bots please see the [Whitelisting Bots](WHITELISTING_BOTS.md) documentation.
66+
See [BOT_ALLOWLIST.md](BOT_ALLOWLIST.md) for information on configuring bots that are exempt from CLA checks.
6767

6868
## EasyCLA Release Process
6969

cla-backend-go/github/bots.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -123,14 +123,14 @@ func parseConfigPatterns(config string) []string {
123123
return []string{config}
124124
}
125125

126-
// SkipWhitelistedBots- check if the actors are whitelisted based on the skip_cla configuration.
126+
// SkipAllowlistedBots- check if the actors are allowlisted based on the skip_cla configuration.
127127
// Returns two lists:
128128
// - actors still missing cla: actors who still need to sign the CLA after checking skip_cla
129-
// - whitelisted actors: actors who are skipped due to skip_cla configuration
129+
// - allowlisted actors: actors who are skipped due to skip_cla configuration
130130
// :param orgModel: The GitHub organization model instance.
131131
// :param orgRepo: The repository name in the format 'org/repo'.
132132
// :param actorsMissingCla: List of UserCommitSummary objects representing actors who are missing CLA.
133-
// :return: two arrays (actors still missing CLA, whitelisted actors)
133+
// :return: two arrays (actors still missing CLA, allowlisted actors)
134134
// : in cla-{stage}-github-orgs table there can be a skip_cla field which is a dict with the following structure:
135135
//
136136
// {
@@ -148,21 +148,21 @@ func parseConfigPatterns(config string) []string {
148148
// - <name_pattern> is a GitHub name pattern (exact match or regex prefixed by re: or match all '*') if not specified defaults to '*'
149149
// The login, email and name patterns are separated by a semicolon (;). Email and name parts are optional.
150150
// There can be an array of patterns for a single repository, separated by ||. It must start with a '[' and end with a ']': "[...||...||...]"
151-
// If the skip_cla is not set, it will skip the whitelisted bots check.
152-
func SkipWhitelistedBots(ev events.Service, orgModel *models.GithubOrganization, orgRepo, projectID string, actorsMissingCLA []*UserCommitSummary) ([]*UserCommitSummary, []*UserCommitSummary) {
151+
// If the skip_cla is not set, it will skip the allowlisted bots check.
152+
func SkipAllowlistedBots(ev events.Service, orgModel *models.GithubOrganization, orgRepo, projectID string, actorsMissingCLA []*UserCommitSummary) ([]*UserCommitSummary, []*UserCommitSummary) {
153153
repo := stripOrg(orgRepo)
154154
f := logrus.Fields{
155-
"functionName": "github.SkipWhitelistedBots",
155+
"functionName": "github.SkipAllowlistedBots",
156156
"orgRepo": orgRepo,
157157
"repo": repo,
158158
"projectID": projectID,
159159
}
160160
outActorsMissingCLA := []*UserCommitSummary{}
161-
whitelistedActors := []*UserCommitSummary{}
161+
allowlistedActors := []*UserCommitSummary{}
162162

163163
skipCLA := orgModel.SkipCla
164164
if skipCLA == nil {
165-
log.WithFields(f).Debug("skip_cla is not set, skipping whitelisted bots check")
165+
log.WithFields(f).Debug("skip_cla is not set, skipping allowlisted bots check")
166166
return actorsMissingCLA, []*UserCommitSummary{}
167167
}
168168

@@ -204,7 +204,7 @@ func SkipWhitelistedBots(ev events.Service, orgModel *models.GithubOrganization,
204204

205205
// 4. No match
206206
if config == "" {
207-
log.WithFields(f).Debug("No skip_cla config found for repo, skipping whitelisted bots check")
207+
log.WithFields(f).Debug("No skip_cla config found for repo, skipping allowlisted bots check")
208208
return actorsMissingCLA, []*UserCommitSummary{}
209209
}
210210

@@ -241,11 +241,11 @@ func SkipWhitelistedBots(ev events.Service, orgModel *models.GithubOrganization,
241241
})
242242
log.WithFields(f).Debugf("event logged")
243243
actor.Authorized = true
244-
whitelistedActors = append(whitelistedActors, actor)
244+
allowlistedActors = append(allowlistedActors, actor)
245245
} else {
246246
outActorsMissingCLA = append(outActorsMissingCLA, actor)
247247
}
248248
}
249249

250-
return outActorsMissingCLA, whitelistedActors
250+
return outActorsMissingCLA, allowlistedActors
251251
}

cla-backend-go/signatures/service.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,13 +1114,13 @@ func (s service) updateChangeRequest(ctx context.Context, ghOrg *models.GithubOr
11141114
}
11151115

11161116
log.WithFields(f).Debugf("commit authors status => signed: %+v and missing: %+v", signed, unsigned)
1117-
var whitelisted []*github.UserCommitSummary
1118-
unsigned, whitelisted = github.SkipWhitelistedBots(s.eventsService, ghOrg, gitHubRepoName, projectID, unsigned)
1119-
if len(whitelisted) > 0 {
1120-
log.WithFields(f).Debugf("adding %d whitelisted actors to signed list", len(whitelisted))
1121-
signed = append(signed, whitelisted...)
1117+
var allowlisted []*github.UserCommitSummary
1118+
unsigned, allowlisted = github.SkipAllowlistedBots(s.eventsService, ghOrg, gitHubRepoName, projectID, unsigned)
1119+
if len(allowlisted) > 0 {
1120+
log.WithFields(f).Debugf("adding %d allowlisted actors to signed list", len(allowlisted))
1121+
signed = append(signed, allowlisted...)
11221122
}
1123-
log.WithFields(f).Debugf("commit authors status after whitelisting bots => signed: %+v, missing: %+v, whitelisted: %+v", signed, unsigned, whitelisted)
1123+
log.WithFields(f).Debugf("commit authors status after allowlisting bots => signed: %+v, missing: %+v, allowlisted: %+v", signed, unsigned, allowlisted)
11241124

11251125
// update pull request
11261126
updateErr := github.UpdatePullRequest(ctx, ghOrg.OrganizationInstallationID, int(pullRequestID), gitHubOrgName, gitHubRepoName, githubRepository.ID, *latestSHA, signed, unsigned, s.claBaseAPIURL, s.claLandingPage, s.claLogoURL)

cla-backend-go/v2/sign/helpers.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,13 +148,13 @@ func (s service) updateChangeRequest(ctx context.Context, installationID, reposi
148148

149149
log.WithFields(f).Debugf("commit authors status => signed: %+v and missing: %+v", signed, unsigned)
150150
if ghOrg != nil {
151-
var whitelisted []*github.UserCommitSummary
152-
unsigned, whitelisted = github.SkipWhitelistedBots(s.eventsService, ghOrg, gitHubRepoName, projectID, unsigned)
153-
if len(whitelisted) > 0 {
154-
log.WithFields(f).Debugf("adding %d whitelisted actors to signed list", len(whitelisted))
155-
signed = append(signed, whitelisted...)
151+
var allowlisted []*github.UserCommitSummary
152+
unsigned, allowlisted = github.SkipAllowlistedBots(s.eventsService, ghOrg, gitHubRepoName, projectID, unsigned)
153+
if len(allowlisted) > 0 {
154+
log.WithFields(f).Debugf("adding %d allowlisted actors to signed list", len(allowlisted))
155+
signed = append(signed, allowlisted...)
156156
}
157-
log.WithFields(f).Debugf("commit authors status after whitelisting bots => signed: %+v, missing: %+v, whitelisted: %+v", signed, unsigned, whitelisted)
157+
log.WithFields(f).Debugf("commit authors status after allowlisting bots => signed: %+v, missing: %+v, allowlisted: %+v", signed, unsigned, allowlisted)
158158
}
159159

160160
// update pull request

cla-backend/cla/models/github_models.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -738,11 +738,11 @@ def update_merge_group(self, installation_id, github_repository_id, merge_group_
738738
for user_commit_summary in commit_authors:
739739
handle_commit_from_user(project, user_commit_summary, signed, missing)
740740

741-
# Skip whitelisted bots per org/repo GitHub login/email regexps
742-
missing, whitelisted = self.skip_whitelisted_bots(github_org, repository.get_repository_name(), missing)
743-
if whitelisted is not None and len(whitelisted) > 0:
744-
cla.log.debug(f"{fn} - adding {len(whitelisted)} whitelisted actors to signed list")
745-
signed.extend(whitelisted)
741+
# Skip allowlisted bots per org/repo GitHub login/email regexps
742+
missing, allowlisted = self.skip_allowlisted_bots(github_org, repository.get_repository_name(), missing)
743+
if allowlisted is not None and len(allowlisted) > 0:
744+
cla.log.debug(f"{fn} - adding {len(allowlisted)} allowlisted actors to signed list")
745+
signed.extend(allowlisted)
746746

747747
# update Merge group status
748748
self.update_merge_group_status(
@@ -904,11 +904,11 @@ def update_change_request(self, installation_id, github_repository_id, change_re
904904
for future in concurrent.futures.as_completed(futures):
905905
cla.log.debug(f"{fn} - ThreadClosed for handle_commit_from_user")
906906

907-
# Skip whitelisted bots per org/repo GitHub login/email regexps
908-
missing, whitelisted = self.skip_whitelisted_bots(github_org, repository.get_repository_name(), missing)
909-
if whitelisted is not None and len(whitelisted) > 0:
910-
cla.log.debug(f"{fn} - adding {len(whitelisted)} whitelisted actors to signed list")
911-
signed.extend(whitelisted)
907+
# Skip allowlisted bots per org/repo GitHub login/email regexps
908+
missing, allowlisted = self.skip_allowlisted_bots(github_org, repository.get_repository_name(), missing)
909+
if allowlisted is not None and len(allowlisted) > 0:
910+
cla.log.debug(f"{fn} - adding {len(allowlisted)} allowlisted actors to signed list")
911+
signed.extend(allowlisted)
912912
# At this point, the signed and missing lists are now filled and updated with the commit user info
913913

914914
cla.log.debug(
@@ -950,7 +950,7 @@ def property_matches(self, pattern, value):
950950

951951
def is_actor_skipped(self, actor, config):
952952
"""
953-
Returns True if the actor should be skipped (whitelisted) based on config pattern.
953+
Returns True if the actor should be skipped (allowlisted) based on config pattern.
954954
config: '<login_pattern>;<email_pattern>;<name_pattern>'
955955
If any pattern is missing, it defaults to '*'
956956
It returns true if ANY config entry matches or false if there is no match in any config entry.
@@ -1008,16 +1008,16 @@ def safe_getattr(self, obj, attr, default='(null)'):
10081008
return default
10091009
return val
10101010

1011-
def skip_whitelisted_bots(self, org_model, org_repo, actors_missing_cla) -> Tuple[List[UserCommitSummary], List[UserCommitSummary]]:
1011+
def skip_allowlisted_bots(self, org_model, org_repo, actors_missing_cla) -> Tuple[List[UserCommitSummary], List[UserCommitSummary]]:
10121012
"""
1013-
Check if the actors are whitelisted based on the skip_cla configuration.
1013+
Check if the actors are allowlisted based on the skip_cla configuration.
10141014
Returns a tuple of two lists:
10151015
- actors_missing_cla: actors who still need to sign the CLA after checking skip_cla
1016-
- whitelisted_actors: actors who are skipped due to skip_cla configuration
1016+
- allowlisted_actors: actors who are skipped due to skip_cla configuration
10171017
:param org_model: The GitHub organization model instance.
10181018
:param org_repo: The repository name in the format 'org/repo'.
10191019
:param actors_missing_cla: List of UserCommitSummary objects representing actors who are missing CLA.
1020-
:return: Tuple of (actors_missing_cla, whitelisted_actors)
1020+
:return: Tuple of (actors_missing_cla, allowlisted_actors)
10211021
: in cla-{stage}-github-orgs table there can be a skip_cla field which is a dict with the following structure:
10221022
{
10231023
"repo-name": "<login_pattern>;<email_pattern>;<name_pattern>",
@@ -1033,13 +1033,13 @@ def skip_whitelisted_bots(self, org_model, org_repo, actors_missing_cla) -> Tupl
10331033
- <name_pattern> is a GitHub name pattern (exact match or regex prefixed by re: or match all '*') - defaults to '*' if not set
10341034
:note: The login (sometimes called username it's the same), email and name patterns are separated by a semicolon (;).
10351035
:note: There can be an array of patterns - it must start with [ and with ] and be || separated.
1036-
:note: If the skip_cla is not set, it will skip the whitelisted bots check.
1036+
:note: If the skip_cla is not set, it will skip the allowlisted bots check.
10371037
"""
10381038
try:
10391039
repo = self.strip_org(org_repo)
10401040
skip_cla = org_model.get_skip_cla()
10411041
if skip_cla is None:
1042-
cla.log.debug("skip_cla is not set on '%s', skipping whitelisted bots check", org_repo)
1042+
cla.log.debug("skip_cla is not set on '%s', skipping allowlisted bots check", org_repo)
10431043
return actors_missing_cla, []
10441044

10451045
if hasattr(skip_cla, "as_dict"):
@@ -1073,7 +1073,7 @@ def skip_whitelisted_bots(self, org_model, org_repo, actors_missing_cla) -> Tupl
10731073

10741074
# 4. No match
10751075
if config == '':
1076-
cla.log.debug("No skip_cla config found for repo %s, skipping whitelisted bots check", org_repo)
1076+
cla.log.debug("No skip_cla config found for repo %s, skipping allowlisted bots check", org_repo)
10771077
return actors_missing_cla, []
10781078

10791079
actor_debug_data = [
@@ -1086,7 +1086,7 @@ def skip_whitelisted_bots(self, org_model, org_repo, actors_missing_cla) -> Tupl
10861086
config = self.parse_config_patterns(config)
10871087
cla.log.debug("final skip_cla config for repo %s is %s; actors_missing_cla: [%s]", org_repo, config, ", ".join(actor_debug_data))
10881088
out_actors_missing_cla = []
1089-
whitelisted_actors = []
1089+
allowlisted_actors = []
10901090
for actor in actors_missing_cla:
10911091
if actor is None:
10921092
continue
@@ -1113,7 +1113,7 @@ def skip_whitelisted_bots(self, org_model, org_repo, actors_missing_cla) -> Tupl
11131113
contains_pii=True,
11141114
)
11151115
actor.authorized = True
1116-
whitelisted_actors.append(actor)
1116+
allowlisted_actors.append(actor)
11171117
continue
11181118
except Exception as e:
11191119
cla.log.warning(
@@ -1127,10 +1127,10 @@ def skip_whitelisted_bots(self, org_model, org_repo, actors_missing_cla) -> Tupl
11271127
)
11281128
out_actors_missing_cla.append(actor)
11291129

1130-
return out_actors_missing_cla, whitelisted_actors
1130+
return out_actors_missing_cla, allowlisted_actors
11311131
except Exception as exc:
11321132
cla.log.error(
1133-
"Exception in skip_whitelisted_bots: %s (repo=%s, actors=%s). Disabling skip_cla logic for this run.",
1133+
"Exception in skip_allowlisted_bots: %s (repo=%s, actors=%s). Disabling skip_cla logic for this run.",
11341134
exc, org_repo, actors_missing_cla
11351135
)
11361136
# Always return all actors if something breaks

0 commit comments

Comments
 (0)