Skip to content

Commit 5171d2b

Browse files
authored
Update build-reliable-secure-programs.md
Michael Howard edits
1 parent 613934e commit 5171d2b

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

docs/code-quality/build-reliable-secure-programs.md

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ This document follows the same structure as NISTIR 8397. Each section:
1717

1818
**Summary**
1919

20-
Threat modeling is valuable, especially when applied in a way that scales to meet your development needs and that reduces noise.
20+
Threat modeling is a valuable process, especially when applied in a way that scales to meet your development needs and that reduces noise.
2121

2222
**Recommendations**
2323

2424
Threat modeling should be one part of your dynamic Security Development Lifecycle (SDL). We suggest that for your product as a whole, for a specific feature, or for a major design or implementation change:
2525

2626
1. Have a solid, dynamic SDL that allows for early engagement with developer teams and rightsizing of approach.
27-
1. Apply threat modeling in a targeted way. Don't apply threat modeling to all features, but tactically to complex or critical features. Do apply it regularly instead as part of a top-down product review.
28-
1. Apply threat modeling early (as with all security requirements), when there's still opportunity to change the design. Also, threat models serve as an input to other processes, such as attack surface reduction or designing for security. Threat models that are done later are at best "surveys" for pen test (penetration testing) or areas that need security testing such as fuzzing. After you create a baseline threat model, plan to continue iterating on it as the attack surface changes.
27+
1. Apply threat modeling in a targeted way. Apply threat modeling to all features, but tactically start with exposed, complex or critical features. Do apply it regularly instead as part of a top-down product review.
28+
1. Apply threat modeling early (as with all security requirements), when there's still opportunity to change the design. Also, threat models serve as an input to other processes, such as attack surface reduction or designing for security. Threat models that are created later are at best "surveys" for pen test (penetration testing) or areas that need security testing such as fuzzing. After you create a baseline threat model, plan to continue iterating on it as the attack surface changes.
2929
1. Use asset inventory and compliance to appropriately track what makes up a product, and track security artifacts (including threat models) along with the assets they apply to. This approach enables better automated risk assessment and focusing of security efforts on the specific components or features that change.
3030
1. **In Azure**, the Microsoft Threat Modeling Tool was updated in 2022 for Azure development. For more information, see [Microsoft Threat Modeling Tool overview - Azure](/azure/security/develop/threat-modeling-tool)
3131

@@ -35,7 +35,7 @@ To properly apply threat modeling and avoid underuse/overuse, we have found that
3535

3636
*Development approach*
3737

38-
First, understand the team's development approach. For teams with agile development workflows that push dozens of changes to production daily, it's not practical or reasonable to require that every functional change has a threat model. Instead, from the start when writing a feature's functional requirements, consider including a security requirements questionnaire. The questionnaire should focus on specific questions about the feature to determine what future aspects of your SDL apply. For example:
38+
First, understand the team's development approach. For teams with agile development workflows that push dozens of changes to production daily, it's not practical or reasonable to require that every functional change requir an update to the threat model. Instead, from the start when writing a feature's functional requirements, consider including a security requirements questionnaire. The questionnaire should focus on specific questions about the feature to determine what future aspects of your SDL apply. For example:
3939
- Does the feature make a major change in design of how we provide customer isolation in a multi-tenant environment? If so, consider performing a full threat model.
4040
- Does a new feature allow file uploads? If so, perhaps what's more appropriate is a web application security assessment.
4141
- Is this change primarily just a functional UI change? If so, perhaps nothing is needed beyond your traditional automated tooling.
@@ -51,7 +51,7 @@ Second, maintain a strong asset inventory of the products you're tasked with ass
5151
- machine learning in the cloud feeding back into the device or a fleet management application,
5252
- and more.
5353

54-
In such complex products, it's not effective to require traditional SDL modeling of each functional unit in isolation. Having a strong asset inventory enables you to view the entirely of the product stack to see the complete picture, and see the key points that need to evaluate how a new/changed feature impacts product security.
54+
In such complex products, threat modeling is critical and having a strong asset inventory enables you to view the entirely of the product stack to see the complete picture, and see the key points that need to evaluate how a new/changed feature impacts product security.
5555

5656
*Granularity and integration*
5757

@@ -109,7 +109,7 @@ Tests that do deeper verification and take longer to run, such as static analysi
109109
- Enable static analysis for all C++ programs, for both the input source code (before compilation) and the executable binaries (after compilation). "Enable" might mean to run analysis during each build on the developer's machine, or as a separate build to inspect the code later or as a checkin requirement.
110110
- Incorporate static analysis into CI pipelines as a form of testing.
111111
- Static analysis by definition comes with false positives, and be prepared to incorporate that fact into your quality feedback loop. Be quick to enable all low-false-positive warnings up front. Then be proactive to gradually increase the number of rules for which your code base compiles warning-clean as you regularly add more rules that flag important bugs at the expense of gradually higher false positives (initially, before the code base has been cleaned for those rules too).
112-
- Always use the latest supported versions of Visual Studio, and set up your engineering environment to be able to quickly consume the latest patch releases as soon as they become available, without delaying to the next development stage/cycle.
112+
- Always use the latest supported versions of Visual Studio, and set up your engineering environment to quickly consume the latest patch releases as soon as they become available, without delaying to the next development stage/cycle.
113113

114114
**Key tools** Be aware of and use the following:
115115

@@ -172,16 +172,13 @@ When credentials are found in your source code, the immediate urgent need is to
172172
1. Invalidate the exposed secret.
173173
1. Perform auditing/risk assessment of potential damage due to compromise.
174174

175-
To safeguard cryptographic keys and other secrets used by cloud apps and services, use [Azure Key Vault](https://azure.microsoft.com/products/key-vault).
175+
To safeguard cryptographic keys and other secrets used by cloud apps and services, use [Azure Key Vault](https://azure.microsoft.com/products/key-vault) with an appropriate access policy.
176176

177177
If an exposure compromises certain customer data/PII, it may require other compliance/reporting requirements.
178178

179179
Remove the now-invalidated secrets from your source code, and replace them with alternative methods that don't expose the secrets directly in your source code. Look for opportunities to eliminate secrets where possible by using tools like dMSI, Azure AD, or dKDS. You can update your authentication methods to take advantage of managed identities via Azure Active Directory (AAD). Only use approved stores to store and manage secrets such as Azure Key Vault (AKV). For more information, see:
180180

181-
- [dMSI: dSTS managed service identity](https://accessmanagementdocs.azurewebsites.net/dsts/advanced/dMSISupportDetails.html)
182181
- [Azure AD: Implementing autorotation using Azure Active Directory (AAD)](https://eng.ms/docs/products/onecert-certificates-key-vault-and-dsms/key-vault-dsms/autorotationandecr/scenarios/aad)
183-
- [dKDS: Datacenter key distribution service](https://msazure.visualstudio.com/AzureCoreSecurityServices/_wiki/wikis/AzureCoreSecurityServices.wiki/20522/Key-Distribution-Service-(dKDS))
184-
- [Key Vault & dSMS & Secrets Management: What is certificate autorotation?](https://eng.ms/docs/products/onecert-certificates-key-vault-and-dsms/key-vault-dsms/autorotationandecr/getstartedcerts#how-do-i-procure-and-store-the-cert)
185182

186183
**Azure DevOps (AzDO)**
187184

@@ -264,7 +261,7 @@ Compilation should enable security-relevant compiler checks as breaking errors,
264261

265262
**Mark binaries as compatible with OS runtime security mitigations**
266263

267-
Compiler settings should opt into code generation features that detect and mitigate malicious code execution, including:
264+
Compiler and linker settings should opt into code generation features that detect and mitigate malicious code execution, including:
268265
- Stack corruption prevention
269266
- [`/SAFESEH` - Image has safe exception handlers](https://aka.ms/SafeExceptionHandlers) - Produces a table of the image's safe exception handlers for x86 binaries.
270267
- [`/GS` - Buffer Security Check](https://aka.ms/BufferSecurityCheck) - Detects some buffer overruns that overwrite return addresses, exception handler addresses or certain types of parameters.
@@ -407,7 +404,7 @@ Modify your build(s) to support continuous creation of executables that use LibF
407404
Within the scope of Microsoft Visual C++ on Windows, Microsoft recommends:
408405

409406
- Prefer TypeScript, JavaScript, and ASP.NET for web applications.
410-
- Don't write web extensions in C++. Microsoft has banned using ActiveX.
407+
- Don't write web extensions in C++. Microsoft has deprecated ActiveX.
411408
- When code is compiled to Emscripten/WASM, it's no longer C++ and other tools apply.
412409
- Microsoft provides [RESTler, a stateful REST API fuzzer](https://github.com/microsoft/restler-fuzzer).
413410

0 commit comments

Comments
 (0)