🔐Security
Protecting your app from threats · 37 terms
Security Basics
10The ideas every app's safety rests on: weak spots, how they are named, and the habits that limit them.
A weak spot in code that an attacker could use to do harm.
A hole that bad people find before the maker does. There is no fix yet.
A 2021 hole in Log4j, a Java tool for logs. One line of text could run code.
When an app lets people see or change things that are not theirs.
A public list that gives each known flaw its own ID, like CVE-2024-3094.
A list of the ten biggest risks for web apps, kept up by OWASP.
Give each user or app just the access it needs, and no more.
Making sure what users send fits the rules. Then your code uses it.
Code or steps that use a security hole to do harm. Fix the hole and it stops working.
Working out how bad people could break in, so you can plan the locks.
Attacks
12The common ways attackers break into web apps, and the mistake each one feeds on.
An attack that hides a script in a page. It runs for everyone who visits.
An attack that tricks your browser. It sends a request you never meant to send.
An attack that hides bad code in a package. Other apps then pull it in.
Hiding commands in what a user types. The program then runs them.
An attack that hides database commands in a form. The app then runs them.
Slipping a command into a form so the web app runs it.
Adding ../ to a file name to climb out of the folder an app should use.
Making a server fetch a link of the attacker's choice. Often it is a private one.
Someone far off makes your machine run their code.
Login Attacks
3Ways into someone else's account: guessing the password, reusing a leaked one, or stealing the login itself.
Trying a password, then the next, and the next, until one works.
Trying passwords leaked from one site on many other sites.
Stealing someone's login so you can act as them. No password is needed.
Defences
12The tools that keep data private and code safe: safe queries, encoded output, locks, fingerprints and secrets.
Keeping passwords and keys out of your code, in a safe place apps read from.
A query with blank spots for the data. What a user types can never become a command.
Turning signs like < into safe codes. Then user text can go on a page.
Cryptography
4The maths that locks data, fingerprints it and proves who sent it.
Locking data with a key. Only someone with the key can read it.
Turning any data into a short code. It can never be turned back.
Two keys that work as a pair. One is shared, and one is kept secret.
A stamp made with a private key. It proves who sent a message and that nobody changed it.
Browser Security
5The rules a browser follows to keep sites apart and to block scripts that should not run.
A browser rule. It decides if a page on one site may read another site's data.
A browser rule. It stops one site from reading what another site sends.
A header that tells the browser where scripts may load from.
A cookie setting. It keeps the cookie off requests that start on other sites.
A cookie setting. Scripts on the page can never read the cookie.
Security Testing
3The checks that hunt for holes in your own code before an attacker does, from scans to hired testers.
A check of the packages you use. It looks for known holes.
A check for keys and passwords left in code. It runs before others see it.
Hiring people to break in on purpose. They find the holes first.