Skip to content

Add limits for license names

Marcos Rocha requested to merge mc_rocha-add-limits-license-names into master

What does this MR do and why?

The license_type property is primarily used to specify the license to match the SPDX license as described in the scan result policies documentation.

During the policy creation, if a user adds a new unknown license not present in the SPDX license list, we store it in the shared table software_licenses.

Looking at our database, we noticed that:

No unknown software license name has more than 255 characters(Internal only)

No project has more than 180 unknown licenses(Internal only)

This MR adds limits to

  • how many license_types can be added to a policy
  • how long the license_types can be

We believe that these limits are enough for the product needs and will help to avoid potential errors during the police creation since we have limits like the YAML size.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

license_types name size validation in the YAML editor

Screenshot_2024-01-29_at_5.00.07_PM

Maximum license_types allowed validation in the YAML editor

Screenshot_2024-01-29_at_1.11.37_PM

How to set up and validate locally

  1. Create a new project
  2. Add a .gitlab-ci.yml file with the content
include:
  - template: Security/Dependency-Scanning.gitlab-ci.yml
  1. Add a new member to the project with developer access
  2. Go to Secure > Policies
  3. Click on New policy
  4. Select scan result policy
  5. Change to .yaml mode
  6. Copy the yaml below:
type: scan_result_policy
name: a
description: ''
enabled: true
rules:
  - type: license_finding
    match_on_inclusion: true
    license_types:
      - aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    license_states:
      - newly_detected
    branch_type: protected
actions:
  - type: require_approval
    approvals_required: 1
    role_approvers:
      - developer
approval_settings:
  block_branch_modification: true
  prevent_pushing_and_force_pushing: true
  1. Click on Configure with a merge request
  2. Verify that a error related to the license_types maxLength is returned
  3. Copy the yaml below:
type: scan_result_policy
name: a
description: ''
enabled: true
rules:
  - type: license_finding
    match_on_inclusion: true
    license_types:
      - License 0
      - License 1
      - License 2
      - License 3
      - License 4
      - License 5
      - License 6
      - License 7
      - License 8
      - License 9
      - License 10
      - License 11
      - License 12
      - License 13
      - License 14
      - License 15
      - License 16
      - License 17
      - License 18
      - License 19
      - License 20
      - License 21
      - License 22
      - License 23
      - License 24
      - License 25
      - License 26
      - License 27
      - License 28
      - License 29
      - License 30
      - License 31
      - License 32
      - License 33
      - License 34
      - License 35
      - License 36
      - License 37
      - License 38
      - License 39
      - License 40
      - License 41
      - License 42
      - License 43
      - License 44
      - License 45
      - License 46
      - License 47
      - License 48
      - License 49
      - License 50
      - License 51
      - License 52
      - License 53
      - License 54
      - License 55
      - License 56
      - License 57
      - License 58
      - License 59
      - License 60
      - License 61
      - License 62
      - License 63
      - License 64
      - License 65
      - License 66
      - License 67
      - License 68
      - License 69
      - License 70
      - License 71
      - License 72
      - License 73
      - License 74
      - License 75
      - License 76
      - License 77
      - License 78
      - License 79
      - License 80
      - License 81
      - License 82
      - License 83
      - License 84
      - License 85
      - License 86
      - License 87
      - License 88
      - License 89
      - License 90
      - License 91
      - License 92
      - License 93
      - License 94
      - License 95
      - License 96
      - License 97
      - License 98
      - License 99
      - License 100
      - License 101
      - License 102
      - License 103
      - License 104
      - License 105
      - License 106
      - License 107
      - License 108
      - License 109
      - License 110
      - License 111
      - License 112
      - License 113
      - License 114
      - License 115
      - License 116
      - License 117
      - License 118
      - License 119
      - License 120
      - License 121
      - License 122
      - License 123
      - License 124
      - License 125
      - License 126
      - License 127
      - License 128
      - License 129
      - License 130
      - License 131
      - License 132
      - License 133
      - License 134
      - License 135
      - License 136
      - License 137
      - License 138
      - License 139
      - License 140
      - License 141
      - License 142
      - License 143
      - License 144
      - License 145
      - License 146
      - License 147
      - License 148
      - License 149
      - License 150
      - License 151
      - License 152
      - License 153
      - License 154
      - License 155
      - License 156
      - License 157
      - License 158
      - License 159
      - License 160
      - License 161
      - License 162
      - License 163
      - License 164
      - License 165
      - License 166
      - License 167
      - License 168
      - License 169
      - License 170
      - License 171
      - License 172
      - License 173
      - License 174
      - License 175
      - License 176
      - License 177
      - License 178
      - License 179
      - License 180
      - License 181
      - License 182
      - License 183
      - License 184
      - License 185
      - License 186
      - License 187
      - License 188
      - License 189
      - License 190
      - License 191
      - License 192
      - License 193
      - License 194
      - License 195
      - License 196
      - License 197
      - License 198
      - License 199
      - License 200
      - License 201
      - License 202
      - License 203
      - License 204
      - License 205
      - License 206
      - License 207
      - License 208
      - License 209
      - License 210
      - License 211
      - License 212
      - License 213
      - License 214
      - License 215
      - License 216
      - License 217
      - License 218
      - License 219
      - License 220
      - License 221
      - License 222
      - License 223
      - License 224
      - License 225
      - License 226
      - License 227
      - License 228
      - License 229
      - License 230
      - License 231
      - License 232
      - License 233
      - License 234
      - License 235
      - License 236
      - License 237
      - License 238
      - License 239
      - License 240
      - License 241
      - License 242
      - License 243
      - License 244
      - License 245
      - License 246
      - License 247
      - License 248
      - License 249
      - License 250
      - License 251
      - License 252
      - License 253
      - License 254
      - License 255
      - License 256
      - License 257
      - License 258
      - License 259
      - License 260
      - License 261
      - License 262
      - License 263
      - License 264
      - License 265
      - License 266
      - License 267
      - License 268
      - License 269
      - License 270
      - License 271
      - License 272
      - License 273
      - License 274
      - License 275
      - License 276
      - License 277
      - License 278
      - License 279
      - License 280
      - License 281
      - License 282
      - License 283
      - License 284
      - License 285
      - License 286
      - License 287
      - License 288
      - License 289
      - License 290
      - License 291
      - License 292
      - License 293
      - License 294
      - License 295
      - License 296
      - License 297
      - License 298
      - License 299
      - License 300
      - License 301
      - License 302
      - License 303
      - License 304
      - License 305
      - License 306
      - License 307
      - License 308
      - License 309
      - License 310
      - License 311
      - License 312
      - License 313
      - License 314
      - License 315
      - License 316
      - License 317
      - License 318
      - License 319
      - License 320
      - License 321
      - License 322
      - License 323
      - License 324
      - License 325
      - License 326
      - License 327
      - License 328
      - License 329
      - License 330
      - License 331
      - License 332
      - License 333
      - License 334
      - License 335
      - License 336
      - License 337
      - License 338
      - License 339
      - License 340
      - License 341
      - License 342
      - License 343
      - License 344
      - License 345
      - License 346
      - License 347
      - License 348
      - License 349
      - License 350
      - License 351
      - License 352
      - License 353
      - License 354
      - License 355
      - License 356
      - License 357
      - License 358
      - License 359
      - License 360
      - License 361
      - License 362
      - License 363
      - License 364
      - License 365
      - License 366
      - License 367
      - License 368
      - License 369
      - License 370
      - License 371
      - License 372
      - License 373
      - License 374
      - License 375
      - License 376
      - License 377
      - License 378
      - License 379
      - License 380
      - License 381
      - License 382
      - License 383
      - License 384
      - License 385
      - License 386
      - License 387
      - License 388
      - License 389
      - License 390
      - License 391
      - License 392
      - License 393
      - License 394
      - License 395
      - License 396
      - License 397
      - License 398
      - License 399
      - License 400
      - License 401
      - License 402
      - License 403
      - License 404
      - License 405
      - License 406
      - License 407
      - License 408
      - License 409
      - License 410
      - License 411
      - License 412
      - License 413
      - License 414
      - License 415
      - License 416
      - License 417
      - License 418
      - License 419
      - License 420
      - License 421
      - License 422
      - License 423
      - License 424
      - License 425
      - License 426
      - License 427
      - License 428
      - License 429
      - License 430
      - License 431
      - License 432
      - License 433
      - License 434
      - License 435
      - License 436
      - License 437
      - License 438
      - License 439
      - License 440
      - License 441
      - License 442
      - License 443
      - License 444
      - License 445
      - License 446
      - License 447
      - License 448
      - License 449
      - License 450
      - License 451
      - License 452
      - License 453
      - License 454
      - License 455
      - License 456
      - License 457
      - License 458
      - License 459
      - License 460
      - License 461
      - License 462
      - License 463
      - License 464
      - License 465
      - License 466
      - License 467
      - License 468
      - License 469
      - License 470
      - License 471
      - License 472
      - License 473
      - License 474
      - License 475
      - License 476
      - License 477
      - License 478
      - License 479
      - License 480
      - License 481
      - License 482
      - License 483
      - License 484
      - License 485
      - License 486
      - License 487
      - License 488
      - License 489
      - License 490
      - License 491
      - License 492
      - License 493
      - License 494
      - License 495
      - License 496
      - License 497
      - License 498
      - License 499
      - License 500
      - License 501
      - License 502
      - License 503
      - License 504
      - License 505
      - License 506
      - License 507
      - License 508
      - License 509
      - License 510
      - License 511
      - License 512
      - License 513
      - License 514
      - License 515
      - License 516
      - License 517
      - License 518
      - License 519
      - License 520
      - License 521
      - License 522
      - License 523
      - License 524
      - License 525
      - License 526
      - License 527
      - License 528
      - License 529
      - License 530
      - License 531
      - License 532
      - License 533
      - License 534
      - License 535
      - License 536
      - License 537
      - License 538
      - License 539
      - License 540
      - License 541
      - License 542
      - License 543
      - License 544
      - License 545
      - License 546
      - License 547
      - License 548
      - License 549
      - License 550
      - License 551
      - License 552
      - License 553
      - License 554
      - License 555
      - License 556
      - License 557
      - License 558
      - License 559
      - License 560
      - License 561
      - License 562
      - License 563
      - License 564
      - License 565
      - License 566
      - License 567
      - License 568
      - License 569
      - License 570
      - License 571
      - License 572
      - License 573
      - License 574
      - License 575
      - License 576
      - License 577
      - License 578
      - License 579
      - License 580
      - License 581
      - License 582
      - License 583
      - License 584
      - License 585
      - License 586
      - License 587
      - License 588
      - License 589
      - License 590
      - License 591
      - License 592
      - License 593
      - License 594
      - License 595
      - License 596
      - License 597
      - License 598
      - License 599
      - License 600
      - License 601
      - License 602
      - License 603
      - License 604
      - License 605
      - License 606
      - License 607
      - License 608
      - License 609
      - License 610
      - License 611
      - License 612
      - License 613
      - License 614
      - License 615
      - License 616
      - License 617
      - License 618
      - License 619
      - License 620
      - License 621
      - License 622
      - License 623
      - License 624
      - License 625
      - License 626
      - License 627
      - License 628
      - License 629
      - License 630
      - License 631
      - License 632
      - License 633
      - License 634
      - License 635
      - License 636
      - License 637
      - License 638
      - License 639
      - License 640
      - License 641
      - License 642
      - License 643
      - License 644
      - License 645
      - License 646
      - License 647
      - License 648
      - License 649
      - License 650
      - License 651
      - License 652
      - License 653
      - License 654
      - License 655
      - License 656
      - License 657
      - License 658
      - License 659
      - License 660
      - License 661
      - License 662
      - License 663
      - License 664
      - License 665
      - License 666
      - License 667
      - License 668
      - License 669
      - License 670
      - License 671
      - License 672
      - License 673
      - License 674
      - License 675
      - License 676
      - License 677
      - License 678
      - License 679
      - License 680
      - License 681
      - License 682
      - License 683
      - License 684
      - License 685
      - License 686
      - License 687
      - License 688
      - License 689
      - License 690
      - License 691
      - License 692
      - License 693
      - License 694
      - License 695
      - License 696
      - License 697
      - License 698
      - License 699
      - License 700
      - License 701
      - License 702
      - License 703
      - License 704
      - License 705
      - License 706
      - License 707
      - License 708
      - License 709
      - License 710
      - License 711
      - License 712
      - License 713
      - License 714
      - License 715
      - License 716
      - License 717
      - License 718
      - License 719
      - License 720
      - License 721
      - License 722
      - License 723
      - License 724
      - License 725
      - License 726
      - License 727
      - License 728
      - License 729
      - License 730
      - License 731
      - License 732
      - License 733
      - License 734
      - License 735
      - License 736
      - License 737
      - License 738
      - License 739
      - License 740
      - License 741
      - License 742
      - License 743
      - License 744
      - License 745
      - License 746
      - License 747
      - License 748
      - License 749
      - License 750
      - License 751
      - License 752
      - License 753
      - License 754
      - License 755
      - License 756
      - License 757
      - License 758
      - License 759
      - License 760
      - License 761
      - License 762
      - License 763
      - License 764
      - License 765
      - License 766
      - License 767
      - License 768
      - License 769
      - License 770
      - License 771
      - License 772
      - License 773
      - License 774
      - License 775
      - License 776
      - License 777
      - License 778
      - License 779
      - License 780
      - License 781
      - License 782
      - License 783
      - License 784
      - License 785
      - License 786
      - License 787
      - License 788
      - License 789
      - License 790
      - License 791
      - License 792
      - License 793
      - License 794
      - License 795
      - License 796
      - License 797
      - License 798
      - License 799
      - License 800
      - License 801
      - License 802
      - License 803
      - License 804
      - License 805
      - License 806
      - License 807
      - License 808
      - License 809
      - License 810
      - License 811
      - License 812
      - License 813
      - License 814
      - License 815
      - License 816
      - License 817
      - License 818
      - License 819
      - License 820
      - License 821
      - License 822
      - License 823
      - License 824
      - License 825
      - License 826
      - License 827
      - License 828
      - License 829
      - License 830
      - License 831
      - License 832
      - License 833
      - License 834
      - License 835
      - License 836
      - License 837
      - License 838
      - License 839
      - License 840
      - License 841
      - License 842
      - License 843
      - License 844
      - License 845
      - License 846
      - License 847
      - License 848
      - License 849
      - License 850
      - License 851
      - License 852
      - License 853
      - License 854
      - License 855
      - License 856
      - License 857
      - License 858
      - License 859
      - License 860
      - License 861
      - License 862
      - License 863
      - License 864
      - License 865
      - License 866
      - License 867
      - License 868
      - License 869
      - License 870
      - License 871
      - License 872
      - License 873
      - License 874
      - License 875
      - License 876
      - License 877
      - License 878
      - License 879
      - License 880
      - License 881
      - License 882
      - License 883
      - License 884
      - License 885
      - License 886
      - License 887
      - License 888
      - License 889
      - License 890
      - License 891
      - License 892
      - License 893
      - License 894
      - License 895
      - License 896
      - License 897
      - License 898
      - License 899
      - License 900
      - License 901
      - License 902
      - License 903
      - License 904
      - License 905
      - License 906
      - License 907
      - License 908
      - License 909
      - License 910
      - License 911
      - License 912
      - License 913
      - License 914
      - License 915
      - License 916
      - License 917
      - License 918
      - License 919
      - License 920
      - License 921
      - License 922
      - License 923
      - License 924
      - License 925
      - License 926
      - License 927
      - License 928
      - License 929
      - License 930
      - License 931
      - License 932
      - License 933
      - License 934
      - License 935
      - License 936
      - License 937
      - License 938
      - License 939
      - License 940
      - License 941
      - License 942
      - License 943
      - License 944
      - License 945
      - License 946
      - License 947
      - License 948
      - License 949
      - License 950
      - License 951
      - License 952
      - License 953
      - License 954
      - License 955
      - License 956
      - License 957
      - License 958
      - License 959
      - License 960
      - License 961
      - License 962
      - License 963
      - License 964
      - License 965
      - License 966
      - License 967
      - License 968
      - License 969
      - License 970
      - License 971
      - License 972
      - License 973
      - License 974
      - License 975
      - License 976
      - License 977
      - License 978
      - License 979
      - License 980
      - License 981
      - License 982
      - License 983
      - License 984
      - License 985
      - License 986
      - License 987
      - License 988
      - License 989
      - License 990
      - License 991
      - License 992
      - License 993
      - License 994
      - License 995
      - License 996
      - License 997
      - License 998
      - License 999
      - License 1000
    license_states:
      - newly_detected
    branch_type: protected
actions:
  - type: require_approval
    approvals_required: 1
    role_approvers:
      - developer
approval_settings:
  block_branch_modification: true
  prevent_pushing_and_force_pushing: true
  1. Click on Configure with a merge request
  2. Verify that a error related to the license_types maxItems is returned
Edited by Marcos Rocha

Merge request reports

Loading