Securing the tools and pipeline that build software

8 min 5 sections 5 practice questions 8 sources citedISC2 objectives 8.2, 8.5

Software is made with tools: an editor, translators, test programs and an automated line that builds and releases each change. Whoever controls those tools controls what the finished product contains, so an attacker who cannot break into a product may break into the place where it is made. The same automation also lets security controls themselves be written as code. No programming background is assumed.

By the end of this unit you will be able to:

  • Explain why a development tool or editor extension is a route into every product it touches
  • Tell apart continuous integration, continuous delivery and continuous deployment
  • Put the security gates of a delivery pipeline in order from commit to production
  • Explain why development, test and production are kept apart and what test data may contain
  • Explain software-defined security with an example

The helpful add-on

An illustrative example

A developer at an online florist installs a free add-on for her code editor. It colours the code neatly and suggests the next line as she types. Twenty colleagues install it too.

Four months later a security firm reports that the add-on has been sending every file it opened to a server abroad, including the files that held the shop's payment settings. Nothing had broken into the shop's website. The website's own code had passed every test.

The shop's code was tested and its website was not attacked. How did its secrets leave the building?

From editor to production: the chain that makes software

A program passes through a chain on its way to users. A developer writes it in an editor. It is stored in a repository, built into a runnable form by build tools, tested, and released into production. Each link is a piece of software with its own makers and its own flaws.

An attacker who controls a link can change everything that passes through it. In 2020 attackers added malicious code to the SolarWinds Orion product inside the supplier's own development process. The poisoned version was signed with the supplier's genuine and reached customers in normal releases. Testing the product's own code could not reveal it.

Once a tampered release has reached customers, the supplier tells them promptly in a security advisory: which versions are affected, how to find them and what to do. It then issues a clean update, rebuilt and signed, through its trusted delivery channel.

The food factory

A food factory can check every ingredient and still poison its customers if someone has tampered with the mixing machine. The machine is part of the product's safety, even though it never appears on the label.

Tool sets and the integrated development environment

A tool set is the collection of programs used to make software: compilers, build tools, tools that fetch libraries, testing tools and scanners. An integrated development environment (IDE) is the developer's main workbench. It combines an editor, a way to build and run the code, and a debugger, which lets the developer pause a program and inspect it. Most IDEs accept add-ons called extensions.

An IDE extension runs with the same permissions as the editor itself. It can read and write files, connect to the network and start other programs. The florist's add-on needed no break-in: the developers installed it and gave it everything they could reach.

  • Obtain tools only from trusted sources, check their signatures or published , and keep them patched.
  • Allow only approved extensions from trusted publishers, and review the list.
  • Harden developers' computers like any other privileged device, with multi-factor sign-in and monitoring.
  • Keep secrets out of project files, where an extension or a commit can carry them away.
  • Run builds on controlled build servers, not on individual laptops.

Common misconception

“Development tools are internal and never face customers, so they need little protection.”

Every product passes through them. A compromised tool alters every product it touches, so tools are protected as strongly as the products they make.

Continuous integration, delivery and deployment

A pipeline is an automated sequence of steps that takes a change from the repository to a running system. Continuous integration (CI) means developers merge small changes into the shared repository often, and each merge is automatically built and tested. Continuous delivery goes further: every change that passes is placed in a test or staging environment and kept ready to release, and a person decides when it goes to production. Continuous deployment releases every change that passes the pipeline to production automatically, with no manual step.

Continuous integration, delivery and deployment compared
PracticeAutomated as far asWho decides to go liveMain security concern
Continuous integrationBuild and test of each mergeNot reached: release is separateTests must include security checks
Continuous deliveryA release ready in stagingA person, at the push of a buttonThe approval must be separate from the author
Continuous deploymentProductionThe pipeline, if every gate passesThe gates are the only approval, so they must be strong

A change meets the pipeline's security gates in this order.

  1. Commit: the change is scanned for secrets, such as passwords left in the code, and the commit is signed.
  2. Merge: someone other than the author reviews the change.
  3. Build: and run, and the build fails on severe findings.
  4. Package: the built artefact, the file that will be released, is signed, and its (SBOM), the list of its components, is recorded.
  5. Test: attacks the running build in the test environment.
  6. Release: a person approves, or every gate passes, and only the signed artefact is deployed.

The security gates a change passes in a pipeline

The security gates a change passes in a pipelineSix gates in order, then production. Commit: secret scan and signed commit. Merge: review by another person. Build: SAST and SCA. Package: artefact signed and SBOM recorded. Test: DAST. Release: a person approves, or every gate passes.Commitsecret scan,signed commitMergeanother personreviews itBuildSAST, SCA;fail on severePackageartefact signed,SBOM keptTestDAST attacksthe test buildReleasea person, orevery gateProductiononly the signedartefactThe security gates a change passes in a pipelineSix gates in order, then production. Commit: secret scan and signed commit. Merge: review by another person. Build: SAST and SCA. Package: artefact signed and SBOM recorded. Test: DAST. Release: a person approves, or every gate passes.Commitsecret scan,signed commitMergeanother personreviews itBuildSAST, SCA;fail on severePackageartefact signed,SBOM keptTestDAST attacksthe test buildReleasea person, orevery gateProductiononly the signedartefact
Read this figure as text

A pipeline is an automated sequence of steps that takes a change from the repository to a running system. A change meets its security gates in a fixed order, and a failed gate stops it.

  1. Commit: the change is scanned for secrets, such as passwords left in the code, and the commit is signed.
  2. Merge: someone other than the author reviews the change.
  3. Build: static testing and software composition analysis run, and the build fails on severe findings.
  4. Package: the built artefact, the file that will be released, is signed, and its software bill of materials (SBOM), the list of its components, is recorded.
  5. Test: dynamic testing attacks the running build in the test environment.
  6. Release: in continuous delivery a person approves; in continuous deployment every gate passing is the only approval, so the gates must be strong.
  7. Only the signed artefact is deployed to production. A canary release or blue-green deployment, with a tested rollback, limits the harm of a bad version.

Because the pipeline decides what reaches production, it is a prime target. It holds powerful credentials, and an attacker who can edit its instructions can release anything. Its configuration is kept in the repository and reviewed like code. No account that can commit unreviewed code may also trigger a production release. Only artefacts built by the pipeline's own account are accepted.

Separate environments, safe test data and careful releases

Software moves through separate environments, each a distinct set of computers and data. Code is written in development and checked in test. Staging is a close copy of production for final checks. Production is the live system people rely on. Separation, by physical or logical means, keeps an experiment in test from damaging live service and keeps live data from leaking into test.

  • Test with invented or masked data. Live in a test environment needs approval, and that environment must then be protected to the level of the live data.
  • Developers do not change production directly. Their access there, if any, is read-only and logged.
  • Each environment has its own credentials, so a secret stolen from test does not open production.

Release patterns limit the harm of a bad release. A canary release sends the new version to a small share of users first and widens it only if nothing goes wrong. A blue-green deployment keeps two identical production environments: the new version goes live on the idle one, and switching back is immediate. Both depend on a tested rollback, a prepared return to the previous version.

Software-defined security: controls written as code

In a data centre of physical machines, a rule was typed into one device by hand. In cloud and virtualised systems, servers, networks and storage are created by software. Infrastructure as code describes those resources in files that a tool reads to build them the same way every time.

Software-defined security applies the same idea to protection. Security controls such as firewall rules, segmentation, access rules and settings are written as code or and applied through software. They are created, changed and removed with the workloads they protect. Policy as code is security policy written as rules a machine enforces, such as: only the payments service may reach the card database.

A new server that is born protected

A council's housing system needs three more web servers for the winter rush. The infrastructure code builds them, and the policy code places them in the right network segment with the right rules at the same moment. Nobody has to remember to add them to a firewall, and when they are removed in spring their rules go with them.

Because these controls are code, they pass through the same pipeline: stored in a repository, reviewed, tested, versioned and released. An error in one file now changes every server built from it, so review matters more, not less.

A question, worked through

A building society is automating how its mobile banking app is released. The developers want every change that passes the automated tests to go straight to customers. The regulator's rules, which the board has accepted, require a named manager to authorise each release to production. The security manager is asked which practice to adopt.

Which practice BEST meets both needs?

  1. Continuous delivery, with a manager approving each release
  2. Continuous deployment, with strong automated security gates
  3. Continuous integration, with releases planned separately
  4. Blue-green deployment, with automatic switching on success
Decide on your answer, then open the reasoning
  1. The question needs as much automation as possible while keeping a named person's authorisation before production.
  2. Rule out c. Continuous integration builds and tests each merge but does not prepare releases, so it automates less than the developers want.
  3. Rule out d. Blue-green deployment is a way of switching versions safely. It says nothing about who authorises the release, and switching automatically removes the manager.
  4. Between a and b: continuous deployment releases every passing change with no manual step, which breaks the regulator's rule however strong the gates are.
  5. Continuous delivery automates everything up to a ready release and leaves the go-live decision to a person. Option a.

Answer: A. Continuous delivery, with a manager approving each release

Choosing between good answers

A question says a person must approve each release to production
the answer is continuous delivery. Continuous deployment has no manual step.
Malicious code reached customers although the product's code passed its tests
look for a compromised tool, extension, library or pipeline: a control on the development chain, not on the code.
A question asks whether live customer data may be used in testing
prefer invented or masked data. If live data is approved, the test environment is protected like production.
A question asks how to release a risky change safely to many users
choose a canary release or blue-green deployment with a tested rollback.

Try it

Walk a change through the pipeline and name the gate that would stop each problem.

Loading the preview.

Check your understanding

5 questions on this unit, easiest first. Confirm an answer to see the reasoning for it, then the right answer, the other options and the rule to reuse. Your answers are kept in this browser and feed readiness and review.

These questions are drafts that no named reviewer has approved yet.

Question 1 of 5

A streaming service sends a new version of its app first to two per cent of users, and widens it to everyone only if no faults appear.

Which practice is this?

What to remember

  • The tools that build software are part of its security. A compromised editor, extension, build tool or pipeline alters every product it touches.
  • IDE extensions run with the developer's permissions, so only approved extensions from trusted publishers are allowed.
  • Continuous integration builds and tests each merge. Continuous delivery keeps each change ready and a person releases it. Continuous deployment releases automatically.
  • Development, test, staging and production are separate. Developers do not change production, and test data is invented or masked.
  • Canary and blue-green releases limit the harm of a bad version, and a tested rollback returns to the last good one.
  • Software-defined security writes controls as code or policy, so they are built, reviewed and removed with the workloads they protect.

Say it from memory

  1. Why is a development tool set a security concern, and how is it controlled?

    Every product passes through the compilers, build tools and scanners, so a compromised tool alters all of them, as in the SolarWinds case. Tools come from trusted sources with signatures or hashes checked, are kept patched, and builds run on controlled build servers.

    Read this part again

  2. What risk does an IDE extension carry, and what controls the IDE?

    An extension runs with the same permissions as the editor: it can read and write files, use the network and start programs. Controls: only approved extensions from trusted publishers, hardened developer computers with multi-factor sign-in, and no secrets in project files.

    Read this part again

  3. Tell apart continuous integration, continuous delivery and continuous deployment, and name the pipeline's own key control.

    CI: frequent merges, each built and tested automatically. Continuous delivery: each passing change kept ready in staging, released to production by a person. Continuous deployment: each passing change released automatically. The pipeline's configuration is reviewed like code, and no account that commits unreviewed code may trigger a production release.

    Read this part again

  4. What is software-defined security? Give an example.

    Security controls such as firewall rules, segmentation and access rules written as code or policy and applied through software, so they are created and removed with the workloads they protect. Example: new servers built by infrastructure code are placed in the right segment with the right rules at once.

    Read this part again

  5. Name the four environments software moves through, and how a canary release differs from a blue-green deployment.

    Development, test, staging and production. A canary release sends the new version to a small share of users first and widens it only if nothing goes wrong. A blue-green deployment keeps two identical production environments and puts the new version live on the idle one, so switching back is immediate.

    Read this part again

Sources