This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Secure Software Development Framework

Secure Software Development Framework and Code/Prebuild CI/CD Steps

Achieving Code and Prebuild Tasks of the Secure Software Development Framework

The Secure Software Development Framework, developed by the National Institute of Standards and Technology (NIST), provides a comprehensive approach to ensuring security across the software development process, from initial design through deployment and maintenance. The framework outlines key practices and guidelines that organizations can implement to secure their software development lifecycle (SDLC), with a particular emphasis on integrating security into automated processes. This chapter focuses specifically on DevSecOps tooling and practices related to Code and Prebuild actions of the CI/CD pipeline to achieve:

Prepare the Organization (PO) Organizations should ensure that their people, processes, and technology are prepared to perform secure software development at the organization level. Many organizations will find some PO practices to also be applicable to subsets of their software development, like individual development groups or projects.
Protect the Software (PS) Organizations should protect all components of their software from tampering and unauthorized access.
Produce Well-Secured Software (PW) Organizations should produce well-secured software with minimal security vulnerabilities in its releases.
Respond to Vulnerabilities (RV) Organizations should identify residual vulnerabilities in their software releases and respond appropriately to address those vulnerabilities and prevent similar ones from occurring in the future.

1 - Protect the Organization (PO)

Protect the Organization (PO) CI/CD Steps

Protect the Organization (PO)

Organizations should ensure that their people, processes, and technology are prepared to perform secure software development at the organization level. Many organizations will find some PO practices to also be applicable to subsets of their software development, like individual development groups or projects.


PO.2 Implement Roles and Responsibilities

Ensure that everyone inside and outside of the organization involved in the SDLC is prepared to perform their SDLC-related roles and responsibilities throughout the SDLC.


Tasks Tools
PO.2.1:

Create new roles and alter responsibilities for existing roles as needed to encompass all parts of the SDLC.Periodically review and maintain the defined roles and responsibilities, updating them as needed.

Designate a group of individuals as the code owners for each project, and review the list annually.

Github CODEOWNERS
Gitlab CODEOWNERS

PO.3 Implement Supporting Toolchains

Use automation to reduce human effort and improve the accuracy, reproducibility, usability, and comprehensiveness of security practices throughout the SDLC, as well as provide a way to document and demonstrate the use of these practices. Toolchains and tools may be used at different levels of the organization, such as organization-wide or project-specific, and may address a particular part of the SDLC, like a build pipeline.


Tasks Tools
PO.3.1:

Specify which tools or tool types must or should be included in each toolchain to mitigate identified risks, as well as how the toolchain components are to be integrated with each other.

Use software factories and/or software templates to standardize the toolchain.

Backstage Software Templates

Can scaffold projects with pipelines-as-code and toolchains-as-code

Konflux-ci software factory for Tekton

Implements the In-toto framework using pipelines-as-code

CDF CDEvents

CDEvents is a common specification for Continuous Delivery events, enabling interoperability in the complete software production ecosystem.

PO.3.2:

Follow recommended security practices to deploy, operate, and maintain tools and toolchains.

Use code-based configuration for toolchains (e.g., pipelines-as-code, toolchains-as-code).

Jenkins Jenkinsfile
Github Actions .github/workflows directory
Gitlab CI/CD .gitlab-ci.yml file
Spinnaker Dinghy
Argo CD
Tekton pipelines-as-code
OpenTofu
PO.3.2:

Follow recommended security practices to deploy, operate, and maintain tools and toolchains.

Implement the technologies and processes needed for reproducible builds.

Hermetic builds with Konflux-ci
Python
Javascript
Java/Kotlin/Groovy
C#/.NET
C++
Rust
Golang
PHP Composer
SLSA Framework
PO.3.3:

Configure tools to generate artifacts of their support of secure software development practices as defined by the organization.

Use existing tooling (e.g., workflow tracking, issue tracking, value stream mapping) to create an audit trail of the secure development-related actions that are performed for continuous improvement purposes. Record security check approvals, rejections, and exception requests as part of the workflow and tracking system.

Github Issues
Gitlab work tracking
Bugzilla
Redmine
Mantis Bug Tracker
Trac
In-toto framework

PO.4 Define and Use Criteria for Software Security Checks

Help ensure that the software resulting from the SDLC meets the organization’s expectations by defining and using criteria for checking the software’s security during development.


Tasks Tools
PO.4.1:

Define criteria for software security checks and track throughout the SDLC.

Add software security criteria to existing checks (e.g., the Definition of Done in agile SDLC methodologies).

Github Issue Templates
Gitlab Description Templates
PO.4.2:

Implement processes, mechanisms, etc. to gather and safeguard the necessary information in support of the criteria.

Collect audit logs for code repositories.

GitHub
GitLab Audit Logs
PO.4.2:

Implement processes, mechanisms, etc. to gather and safeguard the necessary information in support of the criteria.

Only allow authorized personnel to access the gathered information, and prevent any alteration or deletion of the information. Carefully manage the list of repository owners and organization owners who have the ability to view audit logs, delete organizations, and delete code repositories, and review the list annually.

GitHub
GitHub

PO.5 Implement and Maintain Secure Environments for Software Development

Ensure that all components of the environments for software development are strongly protected from internal and external threats to prevent compromises of the environments or the software being developed or maintained within them. Examples of environments for software development include development, build, test, and distribution environments.


Tasks Tools
PO.5.1:

Separate and protect each environment involved in software development.

Require multifactor authentication, SSH keys, signed commits, and code change approvals for code repositories at the organization level.

GitHub Organization Settings
GitLab

Note: Securely configure code repository and CI/CD servers - This is a complex topic, beyond the scope of this document. Securely configure development endpoints (i.e. developer laptops) - This is a complex topic, beyond the scope of this document.

2 - Protect the Software (PS)

Protect the Software (PS) CI/CD Steps

Protect the Software (PS)

Organizations should protect all components of their software from tampering and unauthorized access.


PS.1: Protect All Forms of Code from Unauthorized Access and Tampering.

Help prevent unauthorized changes to code, both inadvertent and intentional, which could circumvent or negate the intended security characteristics of the software. For code that is not intended to be publicly accessible, this helps prevent theft of the software and may make it more difficult or time-consuming for attackers to find vulnerabilities in the software.


Tasks Tools
PS.1.1:

Store all forms of code – including source code, executable code, and configuration-as-code – based on the principle of least privilege so that only authorized personnel, tools, services, etc. have access.

Store all source code and configuration-as-code in a code repository, and restrict access to it based on the nature of the code. For example, open source code intended for public access may need its integrity and availability protected; other code may also need its confidentiality protected.

GitHub
GitLab
Bitbucket
SourceForge
Subversion
PS.1.1:

Store all forms of code – including source code, executable code, and configuration-as-code – based on the principle of least privilege so that only authorized personnel, tools, services, etc. have access.

Use version control features of the repository to track all changes made to the code with accountability to the individual account.

Git
GitHub
GitLab
Bitbucket
SourceForge
Subversion
GitBucket
Gitea
gittuf
PS.1.1:

Store all forms of code – including source code, executable code, and configuration-as-code – based on the principle of least privilege so that only authorized personnel, tools, services, etc. have access.

Use commit signing for code repositories to sign code.

GitHub Signing Commits
About commit signature verification
GitLab Signed Commits
Bitbucket Sign Commits and Tags with SSH keys
Bitbucket Sign Commits and Tags with X.509 certificates
Bitbucket Using GPG Keys
Sigstore
PS.1.1:

Store all forms of code – including source code, executable code, and configuration-as-code – based on the principle of least privilege so that only authorized personnel, tools, services, etc. have access.

Have the code owner review and approve all changes made to the code by others.

Github CODEOWNERS
GitHub Code Review
Gitlab CODEOWNERS
Gitlab Code Review Guidelines
Bitbucket Set Up and Use Code Owners
Bitbucket Code Review
PS.1.1:

Store all forms of code – including source code, executable code, and configuration-as-code – based on the principle of least privilege so that only authorized personnel, tools, services, etc. have access.

Use cryptography (e.g., cryptographic hashes) to help protect file integrity

GitHub About Commits

PS.2 Provide a Mechanism for Verifying Software Release Integrity:

Help software acquirers ensure that the software they acquire is legitimate and has not been tampered with.


Tasks Tools
PS.2.1:

Make software integrity verification information available to software acquirers.

Post cryptographic hashes for release files on a well-secured website.

Apache Infrastructure Signing Releases
OpenPGP
The GNU Privacy Guard
PS.2.1:

Make software integrity verification information available to software acquirers.

Use an established certificate authority for code signing so that consumers’ operating systems or other tools and services can confirm the validity of signatures before use. Periodically review the code signing processes, including certificate renewal, rotation, revocation, and protection.

Let's Encrypt
EJBCA Community
Dogtag Certificate System
OpenXPKI
Step-CA

PS.3 Archive and Protect Each Software Release:

Preserve software releases in order to help identify, analyze, and eliminate vulnerabilities discovered in the software after release.


Tasks Tools
PS.3.1:

Securely archive the necessary files and supporting data (e.g., integrity verification information, provenance data) to be retained for each software release.

Store the release files, associated images, etc. in repositories following the organization’s established policy. Allow read-only access to them by necessary personnel and no access by anyone else.

Access Permissions on GitHub
GitLab Roles and Permissions
Bitbucket Grant Repository Access to Users and Groups
PS.3.1:

Securely archive the necessary files and supporting data (e.g., integrity verification information, provenance data) to be retained for each software release.

Store and protect release integrity verification information and provenance data, such as by keeping it in a separate location from the release files or by signing the data.

GitHub Repository Roles for an Organization
GitLab Roles and Permissions
Bitbucket Grant Access to a Workspace
Ortelius
PS.3.2:

Collect, safeguard, maintain, and share provenance data for all components of each software release (e.g., in a Software Bill of Materials (SBOM)).

Make the provenance data available to software acquirers in accordance with the organization’s policies, preferably using standards-based formats.

AI SBOM Generator
CycloneDX
Software Identification (SWID) Tagging Tools and Utilities
SPDX
PS.3.2:

Collect, safeguard, maintain, and share provenance data for all components of each software release (e.g., in a Software Bill of Materials (SBOM)).

Make the provenance data available to the organization’s operations and response teams to aid them in mitigating software vulnerabilities.

bomctl
OWASP Dependency-Check
Dependency-Track
Clair
Grype
Ortelius
Protobom
Syft
Tern
Trivy
PS.3.2:

Collect, safeguard, maintain, and share provenance data for all components of each software release (e.g., in a Software Bill of Materials (SBOM)).

Protect the integrity of provenance data, and provide a way for recipients to verify provenance data integrity.

aoss-verifier
Sigstore
TLSNotary Protocol
PS.3.2:

Collect, safeguard, maintain, and share provenance data for all components of each software release (e.g., in a Software Bill of Materials (SBOM)).

Update the provenance data every time any of the software’s components are updated.

GitHub Actions
GitLab CI/CD
Bitbucket Pipelines
CircleCI
Travis CI
Updatecli
Renovate

3 - Produce Well-Secured Software (PW)

Produce Well-Secured Software (PW) CI/CD Steps

Produce Well-Secured Software (PW)

PW.4.1 Acquire and Maintain Well-secured Software

Ensure safe use of components (e.g., software libraries, modules, middleware, frameworks) from commercial, open-source, and other third-party developers for use by the organization’s software. Implement a Software Bill of Materials (SBOM) scan to obtain provenance information for each software component. Establish one or more software repositories to host sanctioned and vetted open-source components.

Open-Source Tools to Achieve:

SBOM Generation and Attestation Tools:

Binary Repositories:

Git Commit Signing:

Repo Security Scanning

PW.7 Review and/or Analyze Human-Readable Code

Help identify vulnerabilities so that they can be corrected before the software is released to prevent exploitation. Using automated methods lowers the effort and resources needed to detect vulnerabilities. Human-readable code includes source code, scripts, and any other form of code that an organization deems human-readable.

Open-Source Tools to Achieve:



4 - Respond to Vulnerabilites

Respond to Vulnerabilities (RV) CI/CD Steps

Respond to Vulnerabilities (RV)

Task: Identify and Respond to Vulnerabilities How to Achieve: Organizations should identify residual vulnerabilities in their software releases and respond appropriately to address those vulnerabilities and prevent similar ones from occurring in the future.

RV.1 Identify and Confirm Vulnerabilities on an Ongoing Basis

Open-Source Tools to Achieve:

Identify Vulnerabilities

Static Application Security Testing (SAST):

Dynamic Application Security Testing (DAST):

Software Composition Analysis (SCA):

RV.2 Assess, Prioritize, and Remediate Vulnerabilities

RV.3 Identify Root Cause and help to reduce frequency of vulnerabilities in the future