Skip to content
Tutorials Center
My learning

Topics

Lesson 3 of 80 ยท Security Foundations

The CIA Triad and Core Principles

Learn confidentiality, integrity and availability, plus least privilege, defense in depth, fail-safe defaults and AAA, with a small access-check demo in Python.

Almost every security idea can be traced back to three goals: keep secrets secret, keep data correct, and keep things working. Security people call them confidentiality, integrity and availability, the CIA triad (no relation to the intelligence agency). When you review a design or an incident, asking "which of the three is at stake?" is the quickest way to get your bearings.

Around the triad sits a set of design principles that guide how we build defenses: least privilege, defense in depth, fail-safe defaults and the AAA trio of authentication, authorization and accounting. This lesson explains each one in plain terms and finishes with a small access-control function that uses several of them at once. It follows What Is Cybersecurity?.

The three goals

Confidentiality

Confidentiality means information is visible only to people and systems that are allowed to see it. It is broken by data leaks, stolen laptops, misconfigured storage buckets, shoulder surfing and over-broad database permissions. Typical controls: encryption, access control, data classification, and careful handling of logs and backups, which often hold copies of sensitive data.

Integrity

Integrity means data and systems are changed only in authorized ways, and that changes can be detected. A tampered bank transfer, a modified software update or a database row edited by an attacker are integrity failures. Typical controls: hashing, digital signatures, message authentication codes (you will build one in HMAC and Message Authentication), version control, input validation, and audit trails.

Availability

Availability means systems and data are usable when they are needed. Denial-of-service floods, ransomware, hardware failures and a forgotten certificate renewal all hurt it. Typical controls: redundancy, backups, capacity planning, rate limiting and tested recovery plans.

flowchart TD
    C["Confidentiality<br/>who may see it"]
    I["Integrity<br/>is it correct and unaltered"]
    A["Availability<br/>can we use it when needed"]
    D(("Protected<br/>asset"))
    C --- D
    I --- D
    A --- D

Every asset is judged on all three goals. Which one matters most depends on the asset.

The goals can pull against each other. Locking a system down hard improves confidentiality but may hurt availability for legitimate users. Strong replication improves availability but creates more copies that must be kept confidential. Security design is largely the art of balancing them for the asset at hand: a public news site weights availability and integrity, a diary app weights confidentiality.

Two extra properties are often added. Non-repudiation means someone cannot credibly deny an action they performed (digital signatures and audit logs provide it). Authenticity means a message or user really is who or what it claims to be.

Core design principles

Least privilege

Give every user, program and service only the permissions it needs for its job, for only as long as it needs them. A web application that only reads products should connect to the database with a read-only account. If an attacker takes over that application, the damage is limited to what the account could do.

Defense in depth

Use several independent layers so that when one fails, the next one still stands. A login page might be protected by input validation, rate limiting, multi-factor authentication, monitoring and an alert on unusual sign-ins. Each layer is imperfect; together they are hard to get through.

flowchart LR
    U["Request"] --> L1["Network filter"]
    L1 --> L2["Authentication"]
    L2 --> L3["Authorization"]
    L3 --> L4["Input validation"]
    L4 --> L5["Encrypted data"]
    L1 -.-> M["Logging and alerts"]
    L2 -.-> M
    L3 -.-> M
    L4 -.-> M

Independent layers, with monitoring watching all of them. An attacker must defeat each one, and every failed attempt leaves a trace.

Fail-safe defaults (deny by default)

When there is no explicit rule that says "allow", the answer is no. A new user starts with no permissions; a new firewall port starts closed; an unknown file type is rejected rather than accepted. The opposite habit, "allow unless forbidden", means every forgotten rule is a hole. A related idea is failing securely: if a security check crashes or times out, the system should refuse access, not skip the check.

Other principles worth knowing

  • Economy of mechanism (keep it simple): complexity hides bugs. Prefer small, understandable security code.
  • Complete mediation: check authorization on every access, not only the first.
  • Separation of duties: no single person should be able to complete a sensitive process alone, such as both creating and approving a payment.
  • Open design: security should not depend on the design being secret. Keys are secret; algorithms are public and well reviewed. Hiding how something works ("security through obscurity") is not a protection by itself.
  • Psychological acceptability: if a control is too painful, people route around it. Usable security is stronger security.

AAA: authentication, authorization, accounting

Three questions come up every time someone uses a protected system, and each has its own mechanism:

Step Question Examples
Authentication Who are you, really? Password, one-time code, passkey, certificate
Authorization What are you allowed to do? Roles, permissions, policies
Accounting (auditing) What did you do? Audit logs, session records

Mixing them up is a classic source of bugs. Being authenticated (the system knows who you are) does not mean you are authorized to open every record. Chapter 3 covers authentication in depth, starting with Password Storage Done Right, and ends with Authorization and Access Control Models.

Python An access check built on three principles

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Look at what the code does not do. It never lists what is forbidden; it lists what is allowed and denies everything else. If someone adds a new resource called payroll and forgets to write rules, nobody gets in by accident.

Seeing defense in depth fail and hold

Imagine three independent checks on a file download, each of which can be fooled alone. Defense in depth means an attack succeeds only if it beats all of them.

Python Layers: one weak layer is not the end

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The last line should print 6 of 8: the attack only gets through when both the role layer and the path layer are broken (the login layer does not matter here, because this attacker really is logged in, so breaking it changes nothing). Real layers are not this clean, but the arithmetic of "the right layers must all fail" is why layering works.

Applying the principles

When you evaluate a design, run through a short mental checklist:

  1. Which asset is this, and which of C, I, A matters most for it?
  2. Does every identity (people and programs) have the least privilege that works?
  3. What happens if this component fails or is bypassed? Is there a second layer?
  4. Is the default "deny"? Does an error leave the door closed?
  5. Can we later prove who did what (accounting)?

The next lesson gives you a way to quantify these questions as risk.

Check your understanding

Quick check ยท 5 questions

of 5 answered You scored / 5 ยท perfect!

  1. 1. An attacker alters an invoice amount in transit and nobody notices. Which goal failed?

    The data was changed in an unauthorized way without detection. That is an integrity failure. Nothing was disclosed and the service stayed up.
  2. 2. A reporting service only needs to read two tables but connects as the database owner. Which principle does this violate?

    The account has far more rights than the job requires. If the service is compromised, the attacker inherits all those rights.
  3. 3. What does 'deny by default' mean?

    Fail-safe defaults mean the absence of a rule results in refusal. Forgotten or missing rules then create no access.
  4. 4. A user is logged in. Why must the application still check permissions for each record?

    Authentication and authorization are separate steps. Skipping the per-record check is the root of insecure direct object reference bugs, covered later in the course.
  5. 5. Why is defense in depth valuable if every layer can be flawed?

    Layers are imperfect but independent. The attack only succeeds if it defeats every one of them, and failed attempts can be detected.

Summary

  • The CIA triad: confidentiality (who can see it), integrity (is it correct), availability (can we use it). Goals often trade off.
  • Least privilege, defense in depth, deny by default and fail securely are the most reused design principles.
  • Keep security mechanisms simple, mediate every access, separate duties, and do not rely on secret designs.
  • AAA: authentication identifies, authorization decides, accounting records.
  • An allow-list policy with a default deny and an audit trail is a small model of all of these.

Next: Threats, Vulnerabilities and Risk