Skip to content

Commit ced7d45

Browse files
committed
Updated w/ Feedback
1 parent f60b9ad commit ced7d45

File tree

1 file changed

+30
-10
lines changed

1 file changed

+30
-10
lines changed

β€Ždocs/concepts/Security-Best-Practices.mdβ€Ž

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ We will cover various tools and techniques that NuGet and GitHub provides, which
6161

6262
### NuGet dependency graph
6363

64+
πŸ“¦ Package Consumer
65+
6466
You can view your NuGet dependencies in your project by looking directly at the respective project file.
6567

6668
This is typically found in one of two places:
@@ -76,13 +78,17 @@ For more information on managing NuGet dependencies, [see the following document
7678

7779
### GitHub dependency graph
7880

81+
πŸ“¦ Package Consumer | πŸ“¦πŸ–Š Package Author
82+
7983
You can use GitHub’s dependency graph to see the packages your project depends on and the repositories that depend on it. This can help you see any vulnerabilities detected in its dependencies.
8084

8185
For more information on GitHub repository dependencies, [see the following documentation](https://github.co/dependency-graph).
8286

8387
### Dependency versions
8488

85-
To ensure a secure supply chain of dependencies, you will want to ensure that all your dependencies are regularly updated to the latest stable version. Your dependencies can include code you depend on, binaries you consume, tooling you use, and other components. This can include:
89+
πŸ“¦ Package Consumer | πŸ“¦πŸ–Š Package Author
90+
91+
To ensure a secure supply chain of dependencies, you will want to ensure that all of your dependencies & tooling are regularly updated to the latest stable version as they will often include the latest functionality and security patches to known vulnerabilities. Your dependencies can include code you depend on, binaries you consume, tooling you use, and other components. This may include:
8692

8793
- [Visual Studio](https://visualstudio.microsoft.com/downloads/)
8894
- [.NET SDK & Runtime](https://dotnet.microsoft.com/download)
@@ -93,10 +99,14 @@ To ensure a secure supply chain of dependencies, you will want to ensure that al
9399

94100
### NuGet deprecated and vulnerable dependencies
95101

102+
πŸ“¦ Package Consumer | πŸ“¦πŸ–Š Package Author
103+
96104
You can use the [dotnet CLI](/dotnet/core/tools/dotnet-list-package) to list any known deprecated or vulnerable dependencies you may have inside your project or solution. You can use the command `dotnet list package --deprecated` or `dotnet list package --vulnerable` to provide you a list of any known deprecations or vulnerabilities.
97105

98106
### GitHub vulnerable dependencies
99107

108+
πŸ“¦ Package Consumer | πŸ“¦πŸ–Š Package Author
109+
100110
If your project is hosted on GitHub, you can leverage [GitHub Security](https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/automatically-scanning-your-code-for-vulnerabilities-and-errors) to find security vulnerabilities and errors in your project and Dependabot will fix them by opening up a pull request against your codebase.
101111

102112
Catching vulnerable dependencies before they are introduced is one goal of the [β€œShift Left”](https://en.wikipedia.org/wiki/Shift-left_testing) movement. Being able to have information about your dependencies such as their license, transitive dependencies, and the age of dependencies helps you do just that.
@@ -105,54 +115,64 @@ For more information about Dependabot alerts & security updates, [see the follow
105115

106116
### NuGet feeds
107117

108-
Packages can come from different feeds. To ensure you are secure, knowing what feed your packages are coming from is a best practice. One such best practice is the use of a single feed. You can accomplish this by using multiple upstream source feeds to bring your packages into a single feed.
118+
πŸ“¦ Package Consumer
119+
120+
When using multiple public & private NuGet source feeds, a package can be downloaded from any of the feeds. To ensure your build is predictable and secure from known attacks such as [Dependency Confusion](https://medium.com/@alex.birsan/dependency-confusion-4a5d60fec610), knowing what specific feed(s) your packages are coming from is a best practice. You can use a single feed or private feed with upstreaming capabilities for protection.
109121

110122
For more information to secure your package feeds, see [3 Ways to Mitigate Risk When Using Private Package Feeds](https://azure.microsoft.com/en-us/resources/3-ways-to-mitigate-risk-using-private-package-feeds/).
111123

112124
### Client trust policies
113125

126+
πŸ“¦ Package Consumer
127+
114128
There are policies that you can opt-into in which you require the packages you use to be signed. This allows you to trust a package author, as long as it is author signed, or trust a package if it is owned by a specific user or account that is repository signed by NuGet.org.
115129

116130
To configure client trust policies, [see the following documentation](../consume-packages/installing-signed-packages.md).
117131

118132
### Lock files
119133

134+
πŸ“¦ Package Consumer
135+
120136
Lock files store the hash of your package’s content. If the content hash of a package you want to install matches with the lock file, it will ensure package repeatability.
121137

122138
To enable lock files, [see the following documentation](../consume-packages/package-references-in-project-files#locking-dependencies).
123139

124140
## Monitor your supply chain
125141

126-
### Publish to NuGet.org
127-
128-
NuGet.org serves as a central repository to over 200,000 unique packages. Whenever you publish a package, NuGet.org will go through numerous validations and indexing that can benefit you in the long term. These can include scanning the package for viruses, [providing a repository signature](../reference/signed-packages-reference.md) on the package, and even protecting your package ID so only you can push updates to it.
129-
130-
To learn more about the benefits of publishing on NuGet.org, see [Package validation and indexing](../nuget-org/publish-a-package.md#package-validation-and-indexing).
131-
132142
### GitHub secret scanning
133143

144+
πŸ“¦πŸ–Š Package Author
145+
134146
GitHub scans repositories for NuGet API keys to prevent fraudulent uses of secrets that were accidentally committed.
135147

136148
To learn more about secret scanning, see [About secret scanning](https://docs.github.com/en/github/administering-a-repository/about-secret-scanning).
137149

138150
### Author Package Signing
139151

140-
[Author signing](../reference/signed-packages-reference.md) allows a package author to stamp their identity on a package and for a consumer to verify it came from you. This protects you against content tampering and serves as a single source of truth about the origin of the package and the package authenticity.
152+
πŸ“¦πŸ–Š Package Author
153+
154+
[Author signing](../reference/signed-packages-reference.md) allows a package author to stamp their identity on a package and for a consumer to verify it came from you. This protects you against content tampering and serves as a single source of truth about the origin of the package and the package authenticity. When combined with client trust policies, you can verify a package came from a specific author.
141155

142156
To author sign a package, see [Sign a package](../create-packages/sign-a-package.md).
143157

144158
### Two-Factor Authentication (2FA)
145159

160+
πŸ“¦πŸ–Š Package Author
161+
146162
Enabling two-factor authentication (2FA) can add an extra layer of security when [logging into your GitHub account](https://docs.github.com/en/github/authenticating-to-github/securing-your-account-with-two-factor-authentication-2fa) or the [NuGet.org public package repository](../nuget-org/individual-accounts.md#enable-two-factor-authentication-2fa). It is recommended that you enable two-factor authentication to protect your account.
147163

148164
### Package ID prefix reservation
149165

150-
To protect the identity of your packages, you can reserve a package ID prefix to associate a matching owner if your package ID prefix properly falls under the [specified criteria](../nuget-org/id-prefix-reservation.md#id-prefix-reservation-criteria).
166+
πŸ“¦πŸ–Š Package Author
167+
168+
To protect the identity of your packages, you can reserve a package ID prefix with your respective namespace to associate a matching owner if your package ID prefix properly falls under the [specified criteria](../nuget-org/id-prefix-reservation.md#id-prefix-reservation-criteria).
151169

152170
To learn about reserving ID prefixes, see [Package ID prefix reservation](../nuget-org/id-prefix-reservation.md).
153171

154172
### Deprecating and unlisting a vulnerable package
155173

174+
πŸ“¦πŸ–Š Package Author
175+
156176
To protect the .NET package ecosystem when you are aware of a vulnerability in a package you have authored, do your best to deprecate and unlist the package so it is hidden from users searching for packages. If you are consuming a package that is deprecated and unlisted, you should avoid using the package.
157177

158178
To learn how to deprecate and unlist a package, see the following documentation on [deprecating](../nuget-org/deprecate-packages.md) and [unlisting packages](../nuget-org/policies/deleting-packages.md#unlisting-a-package).

0 commit comments

Comments
Β (0)