Beginner course for developers

AI cybersecurity course: security basics for apps that call a model

You build applications, and now some of them call a language model. The course teaches security basics for building and reviewing them, from logins and databases to the bugs attackers look for, along with what the model adds to the attack surface.

Open the courseSee where the trust boundary sits

Chapter 1

Find the trust boundary before you look for bugs

The course follows one loop: model the threats, protect access, code securely, then review each change. Chapter 1 starts with what you protect and where outside input crosses into your code.

Still from the intro video for the course Cybersecurity Foundations for Modern AI Applications
Intro video, 1 min 10 s. Transcript below.
Read the transcript

You build applications, and now some of them call a language model. This course gives developers the security basics to build and review them, including the attack surface AI adds. The course follows one loop. First you model the threats. Then you protect access to identity, APIs and databases. You code securely against common vulnerabilities and leaked secrets. Then you review each change, because each one opens new paths. Here is what changes. On login, you separate authentication from authorisation. On APIs, you guard endpoints and databases. On secrets, you keep keys out of code. On AI features, you treat the model as new attack surface. It ends with a capstone: you threat-model and secure an AI-powered web app yourself. If you build or review applications, start with the first chapter.

A general reading of each property, not lesson content

  • ConfidentialityWho can read it?
  • IntegrityWho can change it?
  • AvailabilityDoes it work when it is needed?

Outside: not trusted

What a user sends

Trust boundary

Your app

Language model

Text the model reads

Text the model writes

Database

  1. 1

    Assets and the Three Security Properties

    A lesson on assets and the three security properties.

  2. 2

    Threats, Vulnerabilities, Risk and the NIST CSF 2.0

    A lesson on threats, vulnerabilities and risk, with the NIST CSF 2.0.

  3. 3

    Attack Surface, Trust Boundaries and Prompt Injection

    A lesson on attack surface, trust boundaries and prompt injection.

  4. 4

    Four Secure Design Principles

    A lesson on four secure design principles.

  5. 5

    Reading an Access Log to Detect Attacks

    Read an access log to detect attacks.

The course intro video with its transcript, then a map of an AI app: the internet outside, a dashed trust boundary, the app, its database and the model. Three marks show where untrusted text enters or leaves.

AI for beginners: start from zero →

Chapter 2

Two gates: who are you, and what may you do

Chapter 2 covers authentication and authorization, plus MFA and rate limits.

A request arrives

Gate 1: authenticationWho are you?
  • Storing passwords

    A lesson on storing passwords.

  • Password policy

    A lesson on password policy.

  • Sessions and tokens

    A lesson on sessions and tokens.

  • MFA and rate limits

    A lesson on MFA and rate limits.

Gate 2: authorizationWhat may you do?
  • Authorisation

    A lesson on authorization.

The data or action

A request passes two gates in order. The first checks who is asking, the second checks what that person may do. A general picture of the two ideas, not a summary of the lessons.

Chapter 3

Type the same name two ways and watch the query change

Chapter 3 protects APIs and databases, and it starts with SQL injection. This example builds one lookup in two ways.

Same name, two queries

Invented inputs for teaching. Nothing is sent anywhere.

How the query is built
Typed into the name field

What the database receives

SELECT id FROM users WHERE name = 'x' OR '1'='1'

Fixed queryRead as dataRead as SQL

Part of the input became code

The condition is true whatever the name, so in this example the lookup matches all users.

Paste the text into the SQL, typed text x' OR '1'='1. Part of the input became code. The condition is true whatever the name, so in this example the lookup matches all users.

  • SQL injection

    The example above shows the idea.

  • Database privileges

    A lesson on database privileges.

  • Rate limiting

    A lesson on rate limiting.

  • Validating input

    A lesson on validating input.

  • Webhooks and signatures

    A lesson on webhooks and signatures.

A name lookup built two ways, as a general example. Pick how the query is built and what is typed, and the SQL the database receives is shown in three colors with a verdict in words.
  • The rule in this example: when the query is built by pasting the typed text into the SQL, a single quote ends the text early and the rest is read as SQL. When the query uses a placeholder, the database gets the SQL text and the value separately, so in this example the value stays data.
  • Database privileges is the lesson that follows SQL injection in this chapter.

Chapter 4

Follow untrusted text to the place where it does harm

Chapter 4 covers five web vulnerabilities, and the fifth lesson turns to the model's own output. The lanes below sketch how each kind of attack is shaped.

  1. 1Cross-site scripting

    Number one of the five web vulnerabilities in the chapter.

    An outsider controls: Text a user enteredAnd it reaches: A page in someone's browser
  2. 2Cross-site request forgery

    Number two of the five web vulnerabilities in the chapter.

    An outsider controls: A link or form on another siteAnd it reaches: A request your user's browser sends with their login
  3. 3Server-side request forgery

    Number three of the five web vulnerabilities in the chapter.

    An outsider controls: An address a user suppliesAnd it reaches: A request your server sends from inside your network
  4. 4Path traversal

    Number four of the five web vulnerabilities in the chapter.

    An outsider controls: A file name a user suppliesAnd it reaches: A path on your server's disk
  5. 5Model output is untrusted

    The fifth lesson turns to the output of the model itself.

    An outsider controls: Text the model wroteAnd it reaches: A page, a query or a command
Five lanes, one per lesson, as a general example. Each starts with something an outsider controls and ends where the app or the browser acts on it.

AI safety guardrails course: controls around the model →

Chapter 5

Keep keys out of code, and know what to do when one leaks

Chapter 5 covers secrets from where they leak to responding to a leak.

A scan flags this line

api_key = "EXAMPLE-KEY-0000"

(invented example)

No key in the file

api_key = os.environ["SERVICE_KEY"]

The chapter, in order

  1. Where secrets leak

    A lesson on where secrets leak.

  2. Storing and giving out secrets

    A lesson on storing and giving out secrets.

  3. Finding secrets in code

    A lesson on finding secrets in code.

  4. Responding to a leak

    A lesson on responding to a leak.

  5. Secrets and AI

    A lesson on secrets and AI.

Two invented lines of code. A scan flags the one with the key written in the file, and the other reads the key when the program runs. Below, the five lessons of the chapter in order.

Chapter 6

Review code the way an attacker reads it

Chapter 6 covers habits at the keyboard and in review. Five invented lines of code each carry one flag, one per lesson.

A change to review(invented example)

  1. result = eval(user_text)

    Unsafe constructs

    A lesson on unsafe constructs.

  2. except Exception as error: return str(error)

    Errors and exceptions

    A lesson on errors and exceptions.

  3. some_library>=0

    Dependencies

    A lesson on dependencies.

  4. log.info("login", password)

    Safe logging

    A lesson on safe logging.

  5. # written by an assistant, not reviewed yet

    Reviewing AI-generated code

    A lesson on reviewing AI-generated code.

A short invented code panel. Each numbered flag points at one line and names the lesson that teaches how to read it.

Chapters 7 and 8

Threat model an AI web app, then fix three threats and write the report

Chapter 7 covers threat modeling. The capstone, to threat-model and secure an AI-powered web app, applies it to a real build.

STRIDE: six kinds of threat, general definitions

  • Spoofing

    Pretending to be someone else

  • Tampering

    Changing data or code

  • Repudiation

    Denying an action that left no trace

  • Information disclosure

    Data seen by the wrong people

  • Denial of service

    Making the system unavailable

  • Elevation of privilege

    Gaining rights you should not have

Chapter 7: threat modeling

  1. 1Four questions
  2. 2Data-flow diagrams
  3. 3STRIDE
  4. 4Score and mitigate
  5. 5AI threats

Capstone: threat-model and secure an AI-powered web app

  1. 1Scope and diagram

    Step one of the capstone.

  2. 2Threats

    Step two of the capstone.

  3. 3Fix three

    Step three of the capstone.

  4. 4Detect

    Step four of the capstone.

  5. 5The report

    The final capstone lesson is the written report.

Open the course: Cybersecurity Foundations for Modern AI Applications

Left, the six kinds of threat that STRIDE names, in general terms, and the five lessons of the threat modeling chapter. Right, the five steps of the capstone.

AI agents course: what changes when a model can act →

Questions about the course

  • What is the AI cybersecurity course about?

    In the course description's words: building and reviewing applications, including the new attack surface that AI adds.

  • Who is the AI cybersecurity course for?

    Per the catalogue, the audience is software engineers and technical product people who build AI features.

  • What level is it?

    The catalogue lists it at the beginner level.

  • What can I do after the security course?

    The course lists six outcomes: security fundamentals and threat thinking, authentication and authorization, protecting APIs and databases, common web vulnerabilities, secrets management, and secure coding practices.

  • What do I build?

    The capstone is to threat-model and secure an AI-powered web app: a scope and diagram, the threats, three fixes, a way to detect attacks, and a report.

  • How is the course organized?

    The program has 40 lessons spread over eight chapters, and chapter 8 is where the capstone sits.

  • Is a certificate part of the cybersecurity course?

    Yes, the Academy offers one. Going by the app's legal text, what you receive is a certificate or a confirmation of participation, depending on the course and on how you went through it, and a certificate downloads as a PDF from your learning page.

  • Can the AI coach fail me?

    No. Your levels come from graded work under fixed rules, as the app's legal text puts it, so the Academy's AI coach has no vote and cannot predict a certificate.