Skip to content

Commit 651381b

Browse files
authored
Merge pull request #6916 from NuGet/dev
[ReleasePrep][2019.02.21]RI of dev into master
2 parents 9f578da + 41100b7 commit 651381b

128 files changed

Lines changed: 5192 additions & 1077 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/Bootstrap/dist/css/bootstrap-theme.css

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Bootstrap/less/theme/all.less

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
@import "modals.less";
33
@import "common-edit-metadata.less";
44
@import "common-high-contrast.less";
5+
@import "common-licenses.less";
56
@import "common-list-packages.less";
67
@import "common-user-package-list.less";
78
@import "page-about.less";
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.common-licenses {
2+
pre.license-file-contents {
3+
white-space: pre-wrap;
4+
word-break: normal;
5+
}
6+
7+
.custom-license-container {
8+
margin-bottom: @default-margin-bottom;
9+
}
10+
}

src/Bootstrap/less/theme/page-upload.less

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,4 @@
22
#browse-for-package-button {
33
margin: 0;
44
}
5-
6-
pre.license-file-contents {
7-
white-space: pre-wrap;
8-
word-break: normal;
9-
}
10-
11-
.custom-license-container {
12-
margin-bottom: @default-margin-bottom;
13-
}
145
}

src/NuGet.Services.Entities/Cve.cs

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
// Copyright (c) .NET Foundation. All rights reserved.
2+
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3+
4+
using System;
5+
using System.Collections.Generic;
6+
using System.ComponentModel.DataAnnotations;
7+
using System.ComponentModel.DataAnnotations.Schema;
8+
9+
namespace NuGet.Services.Entities
10+
{
11+
/// <summary>
12+
/// Represents a Common Vulnerability and Exposure (CVE).
13+
/// </summary>
14+
public class Cve
15+
: IEntity
16+
{
17+
public const string IdPrefix = "CVE-";
18+
19+
public Cve()
20+
{
21+
PackageDeprecations = new HashSet<PackageDeprecation>();
22+
}
23+
24+
/// <summary>
25+
/// Gets or sets the primary key for the entity.
26+
/// </summary>
27+
public int Key { get; set; }
28+
29+
/// <summary>
30+
/// Gets or sets the unique CVE ID.
31+
/// The CVE ID number has four or more digits in the sequence number portion of the ID (e.g., "CVE-1999-0067", "CVE-2014-12345", "CVE-2016-7654321").
32+
/// </summary>
33+
// sources:
34+
// * https://cve.mitre.org/cve/identifiers/syntaxchange.html
35+
// * https://cve.mitre.org/about/faqs.html#what_is_cve_id
36+
[Index(IsUnique = true)]
37+
[Required]
38+
[MaxLength(20)]
39+
public string CveId { get; set; }
40+
41+
/// <summary>
42+
/// Gets or sets the description of the CVE.
43+
/// The description is a plain language field that describes the vulnerability with sufficient detail as to demonstrate that the vulnerability is unique.
44+
/// </summary>
45+
/// <remarks>
46+
/// The description field is intentionally truncated to maximum 300 characters.
47+
/// </remarks>
48+
[MaxLength(300)]
49+
[Required]
50+
public string Description { get; set; }
51+
52+
/// <summary>
53+
/// Gets or sets the last-modified date for the entity.
54+
/// </summary>
55+
public DateTime LastModifiedDate { get; set; }
56+
57+
/// <summary>
58+
/// Gets or sets the date this CVE entity was first published.
59+
/// </summary>
60+
public DateTime PublishedDate { get; set; }
61+
62+
/// <summary>
63+
/// Gets or sets whether the <see cref="Cve"/> is publicly listed.
64+
/// An unlisted CVE is no longer available for reference.
65+
/// Any <see cref="PackageDeprecation"/>s referencing an unlisted CVE will maintain existing references.
66+
/// </summary>
67+
public bool Listed { get; set; }
68+
69+
/// <summary>
70+
/// Gets or sets the status of the <see cref="Cve"/>.
71+
/// </summary>
72+
[Required]
73+
public CveStatus Status { get; set; }
74+
75+
/// <summary>
76+
/// Gets or sets the CVSS rating for this <see cref="Cve"/> as determined by the NVD.
77+
/// </summary>
78+
/// <remarks>
79+
/// CVSS ratings are from 0.0 to 10.0 and have a single point of precision.
80+
/// </remarks>
81+
[Range(0, 10)]
82+
public decimal? CvssRating { get; set; }
83+
84+
public virtual ICollection<PackageDeprecation> PackageDeprecations { get; set; }
85+
}
86+
}
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
// Copyright (c) .NET Foundation. All rights reserved.
2+
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3+
4+
namespace NuGet.Services.Entities
5+
{
6+
// source: https://nvd.nist.gov/vuln
7+
public enum CveStatus
8+
{
9+
/// <summary>
10+
/// CVE has been recently published to the CVE dictionary and has been received by the NVD.
11+
/// </summary>
12+
Received = 0,
13+
14+
/// <summary>
15+
/// CVE has been marked for Analysis. Normally once in this state the CVE will be analyzed by NVD staff within 24 hours.
16+
/// </summary>
17+
AwaitingAnalysis = 1,
18+
19+
/// <summary>
20+
/// CVE is currently being analyzed by NVD staff.
21+
/// This process results in association of reference link tags, CVSS scores, CWE association, and CPE applicability statements.
22+
/// </summary>
23+
UndergoingAnalysis = 2,
24+
25+
/// <summary>
26+
/// CVE has had analysis completed and all data associations made.
27+
/// </summary>
28+
Analyzed = 3,
29+
30+
/// <summary>
31+
/// CVE has been amended by a source (CVE Primary CNA or another CNA).
32+
/// Analysis data supplied by the NVD may be no longer be accurate due to these changes.
33+
/// </summary>
34+
Modified = 4,
35+
36+
/// <summary>
37+
/// When a CVE is given this status the NVD does not plan analyze or re-analyze this CVE due to resource or other concerns.
38+
/// </summary>
39+
Deferred = 5,
40+
41+
/// <summary>
42+
/// CVE has been marked as "**REJECT**" in the CVE Dictionary.
43+
/// These CVEs are in the NVD, but do not show up in search results.
44+
/// </summary>
45+
// source: https://cve.mitre.org/about/faqs.html#reject_signify_in_cve_entry
46+
Rejected = 6,
47+
48+
/// <summary>
49+
/// A CVE Entry is marked as "RESERVED" when it has been reserved for use by a CVE Numbering Authority (CNA) or security researcher,
50+
/// but the details of it are not yet populated.
51+
/// A CVE Entry can change from the RESERVED state to being populated at any time based on a number of factors both internal and external to the CVE List.
52+
/// Once the CVE Entry is populated with details on the CVE List, it will become available in the U.S. National Vulnerability Database (NVD).
53+
/// </summary>
54+
// source: https://cve.mitre.org/about/faqs.html#reserved_signify_in_cve_entry
55+
Reserved = 7,
56+
57+
/// <summary>
58+
/// When one party disagrees with another party's assertion that a particular issue in software is a vulnerability,
59+
/// a CVE Entry assigned to that issue may be designated as being "DISPUTED".
60+
/// In these cases, CVE is making no determination as to which party is correct.
61+
/// Instead, CVE makes note of this dispute and try to offer any public references that will better inform those trying to understand the facts of the issue.
62+
/// </summary>
63+
// source: https://cve.mitre.org/about/faqs.html#disputed_signify_in_cve_entry
64+
Disputed = 8,
65+
66+
/// <summary>
67+
///
68+
/// </summary>
69+
Unverifiable = 9,
70+
71+
/// <summary>
72+
/// Due to a CNA error, the CVE candidate was also originally assigned to another issue.
73+
/// The CVE description will provide details about which other CVEs to refer too.
74+
/// </summary>
75+
Split = 10
76+
}
77+
}

src/NuGet.Services.Entities/Cwe.cs

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
// Copyright (c) .NET Foundation. All rights reserved.
2+
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3+
4+
using System.Collections.Generic;
5+
using System.ComponentModel.DataAnnotations;
6+
using System.ComponentModel.DataAnnotations.Schema;
7+
8+
namespace NuGet.Services.Entities
9+
{
10+
/// <summary>
11+
/// Represents a Common Weakness Enumeration (CWE).
12+
/// </summary>
13+
public class Cwe
14+
: IEntity
15+
{
16+
public const string IdPrefix = "CWE-";
17+
18+
public Cwe()
19+
{
20+
PackageDeprecations = new HashSet<PackageDeprecation>();
21+
}
22+
23+
/// <summary>
24+
/// Gets or sets the primary key for the entity.
25+
/// </summary>
26+
public int Key { get; set; }
27+
28+
/// <summary>
29+
/// Gets or sets the unique CWE-ID.
30+
/// </summary>
31+
[Index(IsUnique = true)]
32+
[Required]
33+
[MaxLength(20)]
34+
public string CweId { get; set; }
35+
36+
/// <summary>
37+
/// Gets or sets the name of the CWE.
38+
/// </summary>
39+
[MaxLength(200)]
40+
[Required]
41+
public string Name { get; set; }
42+
43+
/// <summary>
44+
/// Gets or sets the description of the CWE.
45+
/// </summary>
46+
/// <remarks>
47+
/// The description field is intentionally truncated to maximum 300 characters.
48+
/// </remarks>
49+
[MaxLength(300)]
50+
[Required]
51+
public string Description { get; set; }
52+
53+
/// <summary>
54+
/// Gets or sets whether the <see cref="Cwe"/> is publicly listed.
55+
/// An unlisted CWE is no longer available for reference.
56+
/// Any <see cref="PackageDeprecation"/>s referencing an unlisted CWE will maintain existing references.
57+
/// </summary>
58+
public bool Listed { get; set; }
59+
60+
/// <summary>
61+
/// Gets or sets the status of the <see cref="Cwe"/>.
62+
/// </summary>
63+
[Required]
64+
public CweStatus Status { get; set; }
65+
66+
public virtual ICollection<PackageDeprecation> PackageDeprecations { get; set; }
67+
}
68+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
// Copyright (c) .NET Foundation. All rights reserved.
2+
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3+
4+
namespace NuGet.Services.Entities
5+
{
6+
// source: https://cwe.mitre.org/documents/schema/#StatusEnumeration
7+
// Note that the quality requirements for Draft and Usable status are very resource-intensive to accomplish,
8+
// while some Incomplete and Draft entries are actively used by the general public;
9+
// so, this status enumeration might change in the future.
10+
public enum CweStatus
11+
{
12+
/// <summary>
13+
/// A value of Stable indicates that all important elements have been verified,
14+
/// and the entry is unlikely to change significantly in the future.
15+
/// </summary>
16+
Stable = 0,
17+
18+
/// <summary>
19+
/// A value of Usable refers to an entity that has received close, extensive review,
20+
/// with critical elements verified.
21+
/// </summary>
22+
Usable = 1,
23+
24+
/// <summary>
25+
/// A value of Draft refers to an entity that has all important elements filled,
26+
/// and critical elements such as Name and Description are reasonably well-written;
27+
/// the entity may still have important problems or gaps.
28+
/// </summary>
29+
Draft = 2,
30+
31+
/// <summary>
32+
/// A value of Incomplete means that the entity does not have all important elements filled,
33+
/// and there is no guarantee of quality.
34+
/// </summary>
35+
Incomplete = 3,
36+
37+
/// <summary>
38+
/// A value of Obsolete is used when an entity is still valid but no longer is relevant,
39+
/// likely because it has been superceded by a more recent entity.
40+
/// </summary>
41+
Obsolete = 4,
42+
43+
/// <summary>
44+
/// A value of Deprecated refers to an entity that has been removed from CWE,
45+
/// likely because it was a duplicate or was created in error.
46+
/// </summary>
47+
/// <remarks>
48+
/// CWEs with this status must be filtered out during initial import.
49+
/// </remarks>
50+
Deprecated = 5
51+
}
52+
}

src/NuGet.Services.Entities/NuGet.Services.Entities.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@
5252
<Compile Include="Credential.cs" />
5353
<Compile Include="CuratedFeed.cs" />
5454
<Compile Include="CuratedPackage.cs" />
55+
<Compile Include="Cve.cs" />
56+
<Compile Include="CveStatus.cs" />
57+
<Compile Include="Cwe.cs" />
58+
<Compile Include="CweStatus.cs" />
5559
<Compile Include="EmailMessage.cs" />
5660
<Compile Include="EmbeddedLicenseFileType.cs" />
5761
<Compile Include="EntityException.cs" />

0 commit comments

Comments
 (0)