Topics in this domain

Secure Coding Practices (Annex A 8.28)

Secure development · 1 min read

Before, during and after

Most application vulnerabilities come from common coding mistakes. Annex A control 8.28, new in 2022, calls for secure coding principles to be applied to software development. ISO/IEC 27002 organises the guidance by stage, as the diagram shows.

Before coding: agree coding standards, train developers, and choose safe libraries. While coding: validate input and encode output, keep secrets out of code, review changes, and run static analysis in the pipeline. After release: track component vulnerabilities, patch quickly, and learn from defects.

Before coding: standards, training, safe libraries. While coding: validate input, encode output, no secrets in code, peer review, static analysis. After release: track component vulnerabilities, patch quickly, learn from defects.

Common flaws to code against

A handful of flaws cause most problems.

FlawDefence
Injection (SQL, command)Parameterised queries, input validation
Cross-site scriptingOutput encoding
Broken access controlServer-side authorisation checks
Secrets in codeSecret managers, scanning
Vulnerable componentsDependency scanning, updates

Industry lists of the most common web application risks are a good basis for coding standards and developer training.

Reviewing code

Review catches what developers miss:

  • peer review for every change;
  • extra scrutiny for security-sensitive code;
  • static analysis in the pipeline;
  • secret scanning on commits;
  • findings fixed before merge.

If a secret is committed, treat it as compromised: revoke and replace it, even if the commit is deleted, because repository history keeps it.

How the exam asks about it

If the question asks…The answer is usually…
New 2022 control for secure coding8.28
API key found in a repositoryRevoke it and move to a secret manager
Defence against SQL injectionParameterised queries
Vulnerable open source libraryTrack and update components

In short

  • Annex A 8.28 calls for secure coding principles to be applied to software development.
  • Before coding: agreed standards, trained developers and approved libraries.
  • During coding: validate input, encode output, handle errors safely, keep secrets out of code, and review changes.
  • After release: track and patch vulnerable components and learn from defects.
  • Automated tools, such as static analysis and dependency scanning, support but don't replace review.

Exam traps

  • Passwords and API keys committed to code repositories.
  • Libraries used without tracking their vulnerabilities.
  • No peer review for changes to security-sensitive code.
  • Untrained developers repeating well-known flaws.

Check yourself

  1. Developers store database passwords in source code. What should change?

  2. Which statement about automated code scanning tools is correct?

  3. Which practice prevents injection flaws?

Slides

Click the slide and use the arrow keys. F toggles full screen.

Turn your phone sideways for a bigger view. Tap any diagram to enlarge it.

ISO 27001 LI · Domain 6 · Secure development

Secure Coding Practices (Annex A 8.28)

How Annex A 8.28, new in 2022, applies secure coding principles: preparing with standards, training and safe components, coding defensively, reviewing and scanning code, and maintaining it after release.

1 / 7

Turn your phone sideways or scroll to see all of it.