File: 10-mandatory-6.1.23.t

package info (click to toggle)
libcsaf-perl 0.26-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,280 kB
  • sloc: perl: 7,583; makefile: 2
file content (42 lines) | stat: -rw-r--r-- 831 bytes parent folder | download
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
#!perl

use 5.010001;
use strict;
use warnings;
use Test::More;

use FindBin '$RealBin';
use lib "$RealBin/lib";

use Test::CSAF qw(base_csaf_security_advisory exec_validator_mandatory_test);

# 6.1.23 Multiple Use of Same CVE

# It MUST be tested that a CVE is not used in multiple vulnerability items.

# The relevant path for this test is:

#   /vulnerabilities[]/cve

# Fail test:

#   "vulnerabilities": [
#     {
#       "cve": "CVE-2017-0145"
#     },
#     {
#       "cve": "CVE-2017-0145"
#     }
#   ]

my $csaf = base_csaf_security_advisory();

$csaf->product_tree->full_product_names->add(name => 'Product A', product_id => 'CSAFPID-9080700');

my $vulns = $csaf->vulnerabilities;
$vulns->add(cve => 'CVE-2017-0145');
$vulns->add(cve => 'CVE-2017-0145');

exec_validator_mandatory_test($csaf, '6.1.23');

done_testing;