Security

Security controls in the coding stage of the SDLC

Updated November 19, 2026

The coding stage needs seven kinds of control: a secure coding standard, developer tooling that applies it, peer review with a security checklist, automated code analysis, protected branches with least-privilege repository access, hardened developer endpoints and accounts, and a rule for choosing dependencies. In NIST SP 800-218 v1.1 they are tasks PW.5.1, PW.7.1, PW.7.2, PS.1.1, PO.5.2, PW.4.1 and PW.4.4. Each leaves a record: the standard, the pull request history, scan results with triage entries, and repository rule settings. A table below gives owner and evidence for each, and a worked pull request follows. Read November 19, 2026.

Stage 3 of 7

Code in the Stage Map

6 controls. SSDF tasks at this stage:

PW.5.1PW.7.1PW.7.2PS.1.1PO.5.2PW.4.4

Open this stage on the Stage Map

The controls, who owns them and what they leave behind

ControlSSDF v1.1 taskWhat it means in practiceOwnerEvidence
Secure coding standardPW.5.1Follow secure coding practices suited to your languages and environment: validate inputs and encode outputs, avoid unsafe functions, handle errors, provide loggingEngineering lead with securityThe standard, versioned, with the date of the last review
Developer tooling that applies itPW.5.1 (examples 5 and 7)Editor and build features that encourage or require secure practices; linters and formatters to standardize codePlatform or developer experienceTool configuration stored as code in the repository
Developer self-reviewPW.5.1 (example 9)The author reads their own change first; this complements, not replaces, review by othersAuthorPull request description or checklist ticked
Decide where review and analysis applyPW.7.1Policy that says when code review and when code analysis are used, including third-party and reusable codeSecurity leadReview policy, reviewed on schedule
Peer review against the standardPW.7.2Review the change against the coding standard, with checklists, and record the discussionReviewer and code ownerPull request approvals and comments
Automated code analysisPW.7.2 (example 4)Static analysis checks code for vulnerabilities and standard violations, with a human reviewing what it reportsSecurity champion triages, developer fixesScan result per change; findings in the tracker
Record and triage findingsPW.7.2Every issue from review or analysis, and each recommended fix, goes into the team's workflow or issue trackerTeam leadTracker entries with status and owner
Check-in checks for unsafe practicesPW.7.2 (example 6)Automated tools find and remediate documented unsafe practices as code is checked in (a secrets check is one such category)Platform with securityCheck result per push or pull request
Repository access and change controlPS.1.1Store all code, including configuration as code, with least-privilege access; track every change to an individual account; code owner approves changes by others; sign commitsRepository administrator, code ownersRepository rules, audit log, signed commit history
Designated code ownersPO.2.1 (example 7)A group or team is the code owner for each projectEngineering managerCode owner file, current membership
Developer endpoints and accountsPO.5.2Harden endpoints with a risk-based approach; multi-factor authentication for access to development endpoints and resourcesIT and platformEndpoint baseline, authentication settings
Choosing and checking dependenciesPW.4.1, PW.4.4Take components from sanctioned, vetted sources, get provenance data, and check that components keep meeting your requirements through their lifeDevelopers, with securityApproved component list, component inventory, vulnerability check results

OWASP ASVS says it can be the basis for a secure coding reference, and that an organization should write its own specific guidance, ideally with approved security mechanisms and libraries that developers can reference. A standard of that kind is the document to cite for PW.5.1.

Two build-time items are named elsewhere in the framework (PW.6.1 and PW.6.2 on compiler and build tool settings) and belong to the build stage, not here.

Code review rules that hold up

SP 800-218 asks you to decide when review applies (PW.7.1) and to review against your own standard, record the discussion and track the results (PW.7.2). Its examples include peer review with the existing analysis results in hand, review checklists, and expert reviewers for code that needs particular care.

OWASP's Secure Code Review Cheat Sheet separates two kinds of review, which suits a policy:

  • Diff-based review looks at changes only: pull requests, commits, completed features. It is the daily workflow, and its steps include assessing the impact on existing controls, checking modified trust boundaries and new integrations, and ensuring no regression.
  • Baseline review examines the whole codebase: new applications, major releases, legacy onboarding, compliance needs and post-incident analysis.

The same sheet says manual review is the way to find what automated tools often miss, such as business logic and complex security implementations, and lists the high-risk code patterns to focus on: input handling, query construction, file operations, authentication and session logic, authorization checks, cryptographic operations, error handling and logging, configuration loading.

Example rules a team might adopt (values are examples to adjust):

RuleWhy
Every change to the main branch needs at least one approving review from someone other than the authorPS.1.1 and PW.7.2: change accountability and a second reader
Changes under the authentication, authorization and cryptography directories also need approval from the code owner for that pathPO.2.1 code owners; PW.1.1 treats authentication and credential management as high-risk
The reviewer uses the security checklist for the kinds of code the change touchesPW.7.2 example 5
Findings from review and analysis go to the tracker, not into chatPW.7.2: record and triage in the workflow system
A change that adds a dependency names it in the pull request and links the approvalPW.4.1

How strict the rules are, and which findings block a merge, is a gate decision; see security gates.

Automated checks in the coding stage and what each misses

PW.7.2 lists static analysis as one method: use a tool to check code for vulnerabilities and compliance with the coding standard, with a person reviewing what it reports and fixing as needed. Treat each category by what it can and cannot see:

Check (category)FindsDoes not replaceWhere the result goes
Linters and formattersStyle and some unsafe constructsReview of logicEditor and pull request
Static analysisKnown classes of flaws in source, standard violationsBusiness logic review, design reviewPull request status, tracker
Secrets checkCredentials committed in code or configurationManaging and rotating the credentials themselvesCheck on push or pull request
Dependency checkKnown vulnerabilities and unapproved components in what you pull inJudging whether a component is a good fitPull request status, inventory

Triage is where these checks succeed or fail. Findings that nobody owns turn into noise. Give each class a rule: which severity blocks a merge, which warns, who triages and within what time, and how a false positive is closed with a reason. Tests that run the code are covered in the test stage.

Repository settings that enforce the controls

SP 800-218 is not tied to one platform. PS.1.1 says to store all code under least privilege and gives examples: track changes to individual accounts, use commit signing, have the code owner review and approve changes by others. Source hosts expose these as branch or ruleset settings. GitHub's documentation on protected branches is one concrete reference; other hosts offer equivalents. As documented there:

SettingWhat it enforcesSSDF link
Force pushes disabled and branch deletion blockedOn by default for a protected branch; history cannot be rewritten or the branch removedPS.1.1 (tracked changes)
Require pull request reviews, with a set number of approvalsChanges reach the branch only through an approved pull requestPS.1.1, PW.7.2
Require review from code ownersA pull request touching owned code needs that owner's approvalPS.1.1 example 4, PO.2.1
Require approval of the most recent push by someone other than the pusherA second person has looked at the final state of the changePW.7.2
Require status checks to passRequired checks (tests, analysis) must succeed before merging; "strict" also requires the branch to be up to datePW.7.2, PO.4.1
Require conversation resolutionAll review comments are resolved or acknowledgedPW.7.2
Require signed commitsOnly signed and verified commits are accepted on the branchPS.1.1 example 3
Do not allow bypassing the above settingsBy default admins and custom roles with the "bypass branch protections" permission are exempt; this setting applies the rules to them tooPO.4.1 (record exceptions)

Export the rule settings or keep them as configuration so an assessor can see them, and keep the host's audit log; those are your evidence for PS.1.1. Review who holds admin or bypass permissions on the same schedule as other exceptions.

Worked example: reviewing the password reset pull request

The feature is the password reset by email link from the design page, with the requirements R1 to R11 from the requirements page. The pull request adds the reset service. The reviewer turns the model's threats into things to check in the diff. All threat and requirement IDs are from those pages; the example is illustrative.

ThreatWhat the reviewer looks for in the changeAutomated helpEvidence
T1The code path for unknown addresses does the same work and returns the same message as for known ones, rather than leaving earlyTest comparing both responsesTest result linked to R6
T2, T3Tokens come from the secure random generator the standard names; only a hash is stored; the record is marked used on consumption; expiry is checked on the serverStatic analysis rule for weak random sources; unit tests for single use and expiryReview comment, tests passed
T4The link is built from configured settings, not request values; the reset page sets a no-referrer policy; log statements do not print tokens or passwordsSecrets and log checks; header testChecklist ticked in the pull request
T5The final step checks for a second factor when the account has oneTest with a multi-factor accountTest result linked to R1
T6Rate limits are applied on request and on token attempts, and a request never changes the accountTest that the limit appliesLimit documented in the decision record
T7The server tracks the step and refuses to skipTest calling the last step directlyTest result linked to R4
T8Security events are logged with who, what, when in UTCLog review in testLog samples attached
T9The password update ends the account's other sessionsTest: old session failsTest result linked to R9
T10Support tooling cannot set a passwordReview of the admin interface diffReview comment

What the pull request leaves behind: the approving review from someone other than the author, code owner approval for the authentication path, passing required checks, resolved conversations, tracker entries for any findings with owner and status, and the link from each test to the requirement it covers. That is the PW.7.2 record and most of the PS.1.1 record for this change.

When the reviewer finds a gap, such as a log statement that prints a token, the finding is a tracker entry linked to T4 and R10, not a chat message. When the team decides to merge with a known gap, that is an exception with an owner and an expiry; see security gates.

Questions people ask

What are the security controls in the coding stage of the SDLC?

A secure coding standard, tooling that applies it, peer review with a security checklist, automated code analysis with triage, protected branches with least-privilege access and signed commits, hardened developer endpoints and accounts, and rules for choosing dependencies. SP 800-218 covers them in tasks PW.5.1, PW.7.1, PW.7.2, PS.1.1, PO.5.2, PW.4.1 and PW.4.4.

Is automated code analysis enough without code review?

No. SP 800-218 PW.7.2 describes static analysis with a human reviewing what it reports, and OWASP says manual review is how you find what automated tools often miss, such as business logic and complex security implementations.

Sources

  1. NIST SP 800-218, Secure Software Development Framework (SSDF) Version 1.1, read November 19, 2026
  2. OWASP Secure Code Review Cheat Sheet, read November 19, 2026
  3. GitHub Docs, About protected branches, read November 19, 2026
  4. OWASP Application Security Verification Standard 5.0.0, What is the ASVS, read November 19, 2026
  5. OWASP Forgot Password Cheat Sheet, read November 19, 2026

Last reviewed November 19, 2026