-
Notifications
You must be signed in to change notification settings - Fork 112
/
iam.go
665 lines (602 loc) · 20 KB
/
iam.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
package legacy
import (
"context"
"database/sql"
"fmt"
"strings"
storage_errors "github.com/chef/automate/components/authz-service/storage"
constants_v1 "github.com/chef/automate/components/authz-service/storage/postgres/migration/legacy/constants/v1"
constants "github.com/chef/automate/components/authz-service/storage/postgres/migration/legacy/constants/v2"
"github.com/chef/automate/lib/logger"
uuid "github.com/chef/automate/lib/uuid4"
"github.com/pkg/errors"
)
// MigrateToV2 inserts needed IAM v2 resources into the db and
// migrates any valid v1 policies
func MigrateToV2(ctx context.Context, db *sql.DB, shouldMigrateV1Policies bool) error {
for _, role := range defaultRoles() {
if err := createRole(ctx, db, &role); err != nil {
return errors.Wrapf(err,
"could not create default role with ID: %s", role.ID)
}
}
for _, pol := range v2DefaultPolicies() {
if _, err := createV2Policy(ctx, db, &pol); err != nil {
return errors.Wrapf(err,
"could not create default policy with ID: %s", pol.ID)
}
}
if shouldMigrateV1Policies {
err := migrateV1Policies(ctx, db)
if err != nil {
return errors.Wrapf(err, "migrate v1 policies")
}
}
return nil
}
/*
COPY PASTA DATABASE CODE
The below is code we've copied from our database functionality because we need
versions of the database functions needed for the migrations that do not change.
This is because this migration is run at a single point in time as part of the schema
upgrades. So this code need to be compatible with a specific schema version that never changes.
*/
func migrateV1Policies(ctx context.Context, db *sql.DB) error {
l, err := logger.NewLogger("text", "info")
if err != nil {
return errors.Wrap(err, "could not initialize logger")
}
pols, err := listPoliciesWithSubjects(ctx, db)
if err != nil {
return errors.Wrap(err, "list v1 policies")
}
var errs []error
for _, pol := range pols {
adminTokenPolicy, err := checkForAdminTokenPolicy(pol)
if err != nil {
errs = append(errs, errors.Wrapf(err, "verify subjects %q for admin policy %q", pol.Subjects, pol.ID.String()))
continue
}
if adminTokenPolicy != nil {
if err := addTokenToAdminPolicy(ctx, adminTokenPolicy.Subjects[0], db); err != nil {
errs = append(errs, errors.Wrapf(err, "adding members %q for admin policy %q", pol.Subjects, pol.ID.String()))
}
continue // don't migrate admin policies with single token
}
v2StoragePol, err := versionizeToV2(pol)
if err != nil {
// collect error
errs = append(errs, errors.Wrapf(err, "convert v1 policy %q", pol.ID.String()))
continue // nothing to create
}
if v2StoragePol == nil {
continue // nothing to create
}
_, err = createV2Policy(ctx, db, v2StoragePol)
switch err {
case nil, storage_errors.ErrConflict: // ignore, continue
default:
errs = append(errs, errors.Wrapf(err, "store converted v1 policy %q", pol.ID.String()))
}
}
reports := []string{}
for _, e := range errs {
reports = append(reports, e.Error())
}
if len(reports) != 0 {
l.Infof("invalid v1 policies could not be migrated: %v", reports)
}
return nil
}
func versionizeToV2(pol *v1Policy) (*v2Policy, error) {
wellKnown, err := isWellKnown(pol.ID)
if err != nil {
return nil, errors.Wrapf(err, "lookup v1 default policy %q", pol.ID.String())
}
if wellKnown {
return legacyPolicyFromV1(pol)
}
return customPolicyFromV1(pol)
}
func addTokenToAdminPolicy(ctx context.Context, tok string, db *sql.DB) error {
m, err := newV2Member(tok)
if err != nil {
return errors.Wrap(err, "format v2 member for admin team")
}
mems, err := addPolicyMembers(ctx, db, constants.AdminPolicyID, []v2Member{m})
if err != nil {
return errors.Wrapf(err, "could not add members %q to admin policy", mems)
}
return nil
}
func checkForAdminTokenPolicy(pol *v1Policy) (*v1Policy, error) {
if pol.Action == "*" && pol.Resource == "*" && len(pol.Subjects) == 1 && strings.HasPrefix(pol.Subjects[0], "token:") {
return pol, nil
}
return nil, nil
}
func isWellKnown(id uuid.UUID) (bool, error) {
defaultV1, err := v1DefaultPolicies()
if err != nil {
return false, err
}
_, found := defaultV1[id.String()]
return found, nil
}
var v1PoliciesToSkip = map[string]struct{}{
constants_v1.AdminPolicyID: {},
constants_v1.ServiceInfoWildcardPolicyID: {},
constants_v1.AuthIntrospectionWildcardPolicyID: {},
constants_v1.LicenseStatusPolicyID: {},
constants_v1.ReadOwnUserProfilePolicyID: {},
constants_v1.LocalUserSelfPolicyID: {},
constants_v1.PolicyVersionPolicyID: {},
constants_v1.OcErchefIngestStatusPolicyID: {},
constants_v1.OcErchefIngestEventsPolicyID: {},
constants_v1.CSNginxComplianceProfilesPolicyID: {},
constants_v1.CSNginxComplianceDataCollectorPolicyID: {},
constants_v1.ApplicationsServiceGroupsPolicyID: {},
}
var v1CfgmgmtPolicies = map[string]struct{}{
constants_v1.CfgmgmtNodesContainerPolicyID: {},
constants_v1.CfgmgmtNodesWildcardPolicyID: {},
constants_v1.CfgmgmtStatsWildcardPolicyID: {},
}
var v1EventFeedPolicies = map[string]struct{}{
constants_v1.EventsContainerPolicyID: {},
constants_v1.EventsWildcardPolicyID: {},
}
var v1NodesPolicies = map[string]struct{}{
constants_v1.NodesContainerPolicyID: {},
constants_v1.NodesWildcardPolicyID: {},
}
var v1NodeManagersPolicies = map[string]struct{}{
constants_v1.NodeManagersContainerPolicyID: {},
constants_v1.NodeManagersWildcardPolicyID: {},
}
var v1SecretsPolicies = map[string]struct{}{
constants_v1.SecretsContainerPolicyID: {},
constants_v1.SecretsWildcardPolicyID: {},
}
var v1ComplianceTokenPolicies = map[string]struct{}{
constants_v1.ComplianceTokenReadProfilesPolicyID: {},
constants_v1.ComplianceTokenSearchProfilesPolicyID: {},
constants_v1.ComplianceTokenUploadProfilesPolicyID: {},
}
// nolint: gocyclo
func legacyPolicyFromV1(pol *v1Policy) (*v2Policy, error) {
if _, found := v1PoliciesToSkip[pol.ID.String()]; found {
return nil, nil
}
noProjects := []string{}
// there's three cfgmgmt policies (which had been deletable) that are now
// mapped into one:
// CfgmgmtNodesContainerPolicyID
// CfgmgmtNodesWildcardPolicyID
// CfgmgmtStatsWildcardPolicyID
if _, found := v1CfgmgmtPolicies[pol.ID.String()]; found {
cfgmgmtStatement := newV2Statement(Allow, "", []string{},
[]string{"*"}, []string{"infra:*"})
member, err := newV2Member("user:*")
if err != nil {
return nil, errors.Wrap(err, "format v2 member (cfgmgmt)")
}
cfgmgmtPolicy, err := newV2Policy(constants.CfgmgmtPolicyID,
"[Legacy] Infrastructure Automation Access",
Custom, []v2Member{member},
[]v2Statement{cfgmgmtStatement}, noProjects)
if err != nil {
return nil, errors.Wrap(err, "format v2 policy (cfgmgmt)")
}
return &cfgmgmtPolicy, nil
}
if pol.ID.String() == constants_v1.ComplianceWildcardPolicyID {
complianceStatement := newV2Statement(Allow, "", []string{},
[]string{"*"}, []string{"compliance:*"})
member, err := newV2Member("user:*")
if err != nil {
return nil, errors.Wrap(err, "format v2 member (compliance)")
}
compliancePolicy, err := newV2Policy(constants.CompliancePolicyID,
"[Legacy] Compliance Access",
Custom, []v2Member{member}, []v2Statement{complianceStatement}, noProjects)
if err != nil {
return nil, errors.Wrap(err, "format v2 policy (cfgmgmt)")
}
return &compliancePolicy, nil
}
if _, found := v1EventFeedPolicies[pol.ID.String()]; found {
eventsStatement := newV2Statement(Allow, "", []string{},
[]string{"*"}, []string{"event:*"})
member, err := newV2Member("user:*")
if err != nil {
return nil, errors.Wrap(err, "format v2 member (events)")
}
eventsPolicy, err := newV2Policy(constants.EventsPolicyID,
"[Legacy] Events Access",
Custom, []v2Member{member}, []v2Statement{eventsStatement}, noProjects)
if err != nil {
return nil, errors.Wrap(err, "format v2 policy (events)")
}
return &eventsPolicy, nil
}
if pol.ID.String() == constants_v1.IngestWildcardPolicyID {
ingestStatement := newV2Statement(Allow, "", []string{},
[]string{"*"}, []string{"ingest:*"})
member, err := newV2Member("token:*")
if err != nil {
return nil, errors.Wrap(err, "format v2 member (ingest)")
}
ingestPolicy, err := newV2Policy(constants.LegacyIngestPolicyID,
"[Legacy] Ingest Access",
Custom, []v2Member{member}, []v2Statement{ingestStatement}, noProjects)
if err != nil {
return nil, errors.Wrap(err, "format v2 policy (ingest)")
}
return &ingestPolicy, nil
}
if _, found := v1NodesPolicies[pol.ID.String()]; found {
nodesStatement := newV2Statement(Allow, "", []string{},
[]string{"*"}, []string{"infra:nodes:*"})
member, err := newV2Member("user:*")
if err != nil {
return nil, errors.Wrap(err, "format v2 member (nodes)")
}
nodesPolicy, err := newV2Policy(
constants.NodesPolicyID,
"[Legacy] Nodes Access",
Custom,
[]v2Member{member},
[]v2Statement{nodesStatement},
noProjects,
)
if err != nil {
return nil, errors.Wrap(err, "format v2 policy (nodes)")
}
return &nodesPolicy, nil
}
if _, found := v1NodeManagersPolicies[pol.ID.String()]; found {
nodeManagersStatement := newV2Statement(Allow, "", []string{},
[]string{"*"}, []string{"infra:nodeManagers:*"})
member, err := newV2Member("user:*")
if err != nil {
return nil, errors.Wrap(err, "format v2 member (nodemanagers)")
}
nodeManagersPolicy, err := newV2Policy(
constants.NodeManagersPolicyID,
"[Legacy] Node Managers Access",
Custom,
[]v2Member{member},
[]v2Statement{nodeManagersStatement},
noProjects,
)
if err != nil {
return nil, errors.Wrap(err, "format v2 policy (nodemanagers)")
}
return &nodeManagersPolicy, nil
}
if _, found := v1SecretsPolicies[pol.ID.String()]; found {
secretsStatement := newV2Statement(Allow, "", []string{},
[]string{"*"}, []string{"secrets:*"})
member, err := newV2Member("user:*")
if err != nil {
return nil, errors.Wrap(err, "format v2 member (secrets)")
}
secretsPolicy, err := newV2Policy(
constants.SecretsPolicyID,
"[Legacy] Secrets Access",
Custom,
[]v2Member{member},
[]v2Statement{secretsStatement},
noProjects,
)
if err != nil {
return nil, errors.Wrap(err, "format v2 policy (secrets)")
}
return &secretsPolicy, nil
}
if pol.ID.String() == constants_v1.TelemetryConfigPolicyID {
telemetryStatement := newV2Statement(Allow, "", []string{},
[]string{"*"}, []string{"system:telemetryConfig:*"})
member, err := newV2Member("user:*")
if err != nil {
return nil, errors.Wrap(err, "format v2 member (telemetry)")
}
telemetryPolicy, err := newV2Policy(
constants.TelemetryPolicyID,
"[Legacy] Telemetry Access",
Custom,
[]v2Member{member},
[]v2Statement{telemetryStatement},
noProjects,
)
if err != nil {
return nil, errors.Wrap(err, "format v2 policy (telemetry)")
}
return &telemetryPolicy, nil
}
if _, found := v1ComplianceTokenPolicies[pol.ID.String()]; found {
complianceTokenStatement := newV2Statement(Allow, "", []string{},
[]string{"*"}, []string{"compliance:profiles:*"})
member, err := newV2Member("token:*")
if err != nil {
return nil, errors.Wrap(err, "format v2 member (compliance token)")
}
complianceTokenPolicy, err := newV2Policy(
constants.ComplianceTokenPolicyID,
"[Legacy] Compliance Profile Access",
Custom,
[]v2Member{member},
[]v2Statement{complianceTokenStatement},
noProjects,
)
if err != nil {
return nil, errors.Wrap(err, "format v2 policy (compliance token)")
}
return &complianceTokenPolicy, nil
}
return nil, errors.New("unknown \"well-known\" policy")
}
func customPolicyFromV1(pol *v1Policy) (*v2Policy, error) {
name := fmt.Sprintf("%s (custom)", pol.ID.String())
resource, err := convertV1Resource(pol.Resource)
if err != nil {
return nil, errors.Wrap(err, "could not derive v2 resource")
}
// in the case of most policies with single term resources (i.e. a container policy
// like 'cfgmgmt'), there is no v2 equivalent resource
// so the policy should be skipped
if resource == "" {
return nil, nil
}
// TODO: If we encounter an unknown action can we just be less permissive with a warning?
// AKA just use []string{"*"} instead of failing the migration?
action, err := convertV1Action(pol.Action, pol.Resource)
if err != nil {
return nil, errors.Wrap(err, "could not derive v2 action")
}
// Note: v1 only had (custom) allow policies
statement := newV2Statement(Allow, "", []string{}, []string{resource}, action)
members := make([]v2Member, len(pol.Subjects))
for i, subject := range pol.Subjects {
memberInt, err := newV2Member(subject)
if err != nil {
return nil, errors.Wrap(err, "format v2 member")
}
members[i] = memberInt
}
policy, err := newV2Policy(
pol.ID.String(),
name,
Custom,
members,
[]v2Statement{statement},
[]string{})
if err != nil {
return nil, errors.Wrap(err, "format v2 policy")
}
return &policy, nil
}
// Basically implements "Current Resource" -> "New Resource Names (RFR)" column of
// https://docs.google.com/spreadsheets/d/1ccaYDJdMnHBfFgmNC1n2_S1YOnMJ-OgkYd8ySbb-mS0/edit#gid=363200100
func convertV1Resource(resource string) (string, error) {
terms := strings.Split(resource, ":")
if len(terms) == 0 {
return "", errors.New("there was no resource passed")
}
if len(terms) == 1 && terms[0] == "*" {
return "*", nil
}
if len(terms) == 1 && !singleTermToMigrate(terms[0]) {
return "", nil
}
switch terms[0] {
case "service_info":
switch terms[1] {
case "version":
return "system:service:version", nil
case "health":
return "system:health", nil
}
return "system:*", nil
case "auth":
terms = changeTerm(terms, "auth", "iam")
terms = changeTerm(terms, "api_tokens", "tokens")
return combineTermsIntoResource(terms...), nil
case "users":
// "users" -> "iam:usersSelf"
terms[0] = "usersSelf"
return combineTermsIntoResource(prefixTerms("iam", terms)...), nil
case "auth_introspection":
// Special case
if terms[1] == "*" {
return "iam:introspect", nil
}
terms = changeTerm(terms, "auth_introspection", "iam")
terms = changeTerm(terms, "introspect_all", "introspect")
terms = changeTerm(terms, "introspect_some", "introspect")
return combineTermsIntoResource(terms...), nil
case "cfgmgmt":
return convertV1Cfgmgmt(terms)
case "compliance":
// Special case
if resource == "compliance:profiles:market" {
return "compliance:marketProfiles", nil
}
return combineTermsIntoResource(deleteTerm(terms, "storage")...), nil
case "events":
return convertV1Events(terms)
case "ingest":
// Special case: "ingest:unified_events" -> "ingest:unifiedEvents" (no wildcards to worry about)
if terms[1] == "unified_events" {
return "ingest:unifiedEvents", nil
}
terms = changeTerm(terms, "unified_events", "unifiedEvents")
return combineTermsIntoResource(terms...), nil
case "license":
if len(terms) == 1 {
return "system:license", nil
}
// if len(terms) == 2 aka license:* or license:status
return "system:status", nil
case "nodemanagers":
// "nodemanagers" -> "infra:nodeManagers"
return combineTermsIntoResource(prefixTerms("infra", changeTerm(terms, "nodemanagers", "nodeManagers"))...),
nil
case "nodes":
// "nodes" -> "infra:nodes"
return combineTermsIntoResource(prefixTerms("infra", terms)...), nil
case "secrets":
// "secrets" -> "secrets:secrets"
return combineTermsIntoResource(prefixTerms("secrets", terms)...), nil
case "telemetry":
// either telemetry:config or telemetry:* maps to system:config
return "system:config", nil
case "notifications":
return resource, nil // unchanged
case "service_groups":
return "applications:serviceGroups", nil
default:
return "", fmt.Errorf("did not recognize base v1 resource term: %s", terms[0])
}
}
func convertV1Cfgmgmt(terms []string) (string, error) {
if terms[1] == "stats" {
return "infra:nodes", nil
}
// cfgmgmt:nodes:{node_id}:runs -> infra:nodes:{node_id}
// cfgmgmt:nodes:{node_id}:runs:{run_id}" -> infra:nodes:{node_id}
if len(terms) >= 4 && terms[3] == "runs" {
return combineTermsIntoResource("infra", "nodes", terms[2]), nil
}
// cfgmgmt:nodes:{node_id}:attribute -> infra:nodes:{node_id}
if len(terms) >= 4 && terms[3] == "attribute" {
return combineTermsIntoResource("infra", "nodes", terms[2]), nil
}
// cfgmgmt:nodes:{node_id}:* -> infra:nodes:{node_id}
if len(terms) >= 3 && terms[2] == "node_id" {
return combineTermsIntoResource("infra", "nodes", terms[2]), nil
}
terms = changeTerm(terms, "cfgmgmt", "infra")
terms = changeTerm(terms, "marked-nodes", "markedNodes")
return combineTermsIntoResource(terms...), nil
}
func convertV1Events(terms []string) (string, error) {
// "events:*" -> "event:events"
if len(terms) == 1 {
return "event:events", nil
}
switch terms[1] {
case "types", "tasks", "strings":
return "event:events", nil
default:
return combineTermsIntoResource(changeTerm(terms, "event", "events")...), nil
}
}
func changeTerm(terms []string, original, updated string) []string {
for i, term := range terms {
if term == original {
terms[i] = updated
}
}
return terms
}
func prefixTerms(prefix string, terms []string) []string {
return append([]string{prefix}, terms...)
}
func deleteTerm(terms []string, original string) []string {
for i, term := range terms {
if term == original {
terms = append(terms[:i], terms[i+1:]...)
}
}
return terms
}
func combineTermsIntoResource(terms ...string) string {
return strings.Join(terms, ":")
}
func convertV1Action(action string, resource string) ([]string, error) {
terms := strings.Split(resource, ":")
// introspect is a special case,
// since there was only the "read" action for every different
// API endpoint, we must assume them all.
if terms[0] == "auth_introspection" {
if action == "*" {
return []string{"*"}, nil
}
return []string{"*:getAll", "*:getSome", "*:get"}, nil
}
if terms[0] == "ingest" && terms[1] == "*" {
switch action {
case "*":
return []string{"ingest:*"}, nil
case "create":
return []string{"ingest:*:create"}, nil
case "delete":
return []string{"ingest:*:delete"}, nil
case "status":
return []string{"ingest:status:get"}, nil
}
return []string{"*:getAll", "*:getSome", "*:get"}, nil
}
if terms[0] == "events" && action == "count" {
return []string{"*:list"}, nil
}
// The rest of all all actions for other resources can
// be generally mapped.
switch action {
case "read":
return []string{"*:get", "*:list"}, nil
case "create":
return []string{"*:create"}, nil
case "update":
return []string{"*:update"}, nil
case "delete":
return []string{"*:delete"}, nil
case "search":
return []string{"*:list"}, nil
case "rerun":
return []string{"*:rerun"}, nil
case "count":
return []string{"*:get"}, nil
case "start":
return []string{"*:start"}, nil
case "stop":
return []string{"*:stop"}, nil // TODO: gdoc says stop -> ["*:start"] but pretty sure that is wrong xD
case "configure":
return []string{"*:update"}, nil
case "mark-missing":
return []string{"*:markMissing"}, nil
case "apply":
return []string{"*:apply"}, nil
case "request":
return []string{"*:request"}, nil
case "list":
return []string{"*:list"}, nil
case "validate":
return []string{"*:validate"}, nil
case "export":
return []string{"*:export"}, nil
case "upload":
return []string{"*:create"}, nil
case "*":
return []string{"*"}, nil
default:
// TODO: should we just warn the logs in this case and not crash the whole migration on the off
// chance that the user created a policy where they mistyped an action name?
return nil, fmt.Errorf("could not parse V1 action: %s", action)
}
}
func singleTermToMigrate(termToCheck string) bool {
// these are the single-term resources that match an endpoint's v1 policy annotation
// (i.e. the node APIs in api/external/nodes/nodes.proto use the resource "nodes")
// all other single-term resources are not actually enforcing any permissions on v1
// and therefore can be skipped
singleTermsToMigrate := []string{"nodes", "events", "license", "nodemanagers", "service_groups"}
for _, term := range singleTermsToMigrate {
if term == termToCheck {
return true
}
}
return false
}