Library / Blogs
AWS Security Blog
Amazon GuardDuty Extended Threat Detection correlates weak GuardDuty signals into a single, critical-severity attack sequence finding when their composition crosses a threshold of credibility. On May 20, 2026, the service started attaching five new indicator types to those sequences: MALICIOUS_PACKAGE,…
By Amazon Web Services engineers · Amazon Web Services · Added 2026-10-12
All content belongs to Amazon Web Services engineers / Amazon Web Services. We only link to it and give credit. Report a problem
Learn this article
About 37 min left. Your work is saved as you go.
What you are about to study
Amazon Web Services wrote this to explain how they thought about a problem. You should know the basics: caching, queues and replication.
Ideas you will meet
- Web Security
- OWASP risks, XSS, CSRF, CORS and secure design.
What we already know about this
Our own lessons on these ideas. Read them here before you start, so it makes sense.
Real-World Systems · 10 minSecuring a web APIAuthentication, authorisation, input handling and abuse protection: the layers that keep an API safe.Read here
Think in layers
No single control secures an API. Defence comes from several layers, each assuming the others may fail.
100%Figure SDA-RWS-14-1 · API security layers · © forcsguy.com
1. Transport
Use HTTPS everywhere, with modern TLS and HSTS. Never accept credentials over plain HTTP.
2. Authentication: who is calling?
- Users: OAuth 2.0 / OpenID Connect access tokens, or secure session cookies for browsers (see the earlier lessons).
- Machines: API keys or client credentials, stored as hashes, scoped, and rotatable.
- Send credentials in the
Authorizationheader, never in URLs. - Keep token lifetimes short, support revocation, and protect refresh tokens carefully.
- Add multi-factor authentication for sensitive accounts, and protect login endpoints with rate limits.
3. Authorisation: what may they do?
This is where most real API breaches happen.
- Check on every request, on the server, both the action (role or scope) and the specific object. "Is this user logged in?" is not enough; ask "may this user read order 123?" (broken object-level authorisation is the top API risk).
- Apply least privilege: tokens carry only the scopes they need.
- Never rely on the client hiding buttons.
- Do not expose sequential ids as a security measure. Use authorisation checks (random ids only help a little).
4. Input and output
- Validate every input against a schema: types, lengths, ranges, allowed values. Reject unknown fields (prevents mass assignment, where a caller sets fields like
isAdmin). - Use parameterised queries to prevent SQL injection, and encode output to prevent injection into other systems.
- Limit request size and file types, and scan uploads.
- Return only the fields needed (avoid excessive data exposure), and paginate lists.
- Return generic error messages to clients and keep detail in logs, so errors do not leak internals.
100%Figure SDA-RWS-14-2 · Two ways a caller proves who it is · © forcsguy.com
100%Figure SDA-RWS-14-3 · Signing each request with a shared secret (HMAC) · © forcsguy.com
Image: Spanish Coches · CC BY 2.0 · Source · Wikimedia Commons: Peaje - Toll - Péage (5020183265)5. Abuse protection
- Rate limiting per user, key and IP, with stricter limits on expensive or sensitive endpoints.
- Quotas and timeouts; protect against huge queries (depth limits in GraphQL, page size caps).
- Bot and credential-stuffing defences: lockouts, delays, CAPTCHAs, breached-password checks.
6. Webhooks and service-to-service calls
- Sign outgoing webhooks with an HMAC over the body and a timestamp. Receivers verify the signature in constant time, reject old timestamps and handle events idempotently.
- Between services use mutual TLS or signed tokens, and network policies, instead of trusting "internal" traffic.
7. Browsers: CORS and cookies
- Configure CORS with an explicit allow-list of origins. Never reflect any origin with credentials enabled.
- Cookies:
HttpOnly,Secure,SameSite. Protect state-changing requests from CSRF.
An example worth knowing: in 2021 a flaw in a popular Java logging library (Log4Shell) let attackers run their own code simply by getting a crafted string written to a log.
100%Figure SDA-RWS-14-4 · How untrusted text became remote code execution · © forcsguy.com
8. Secrets, data and visibility
- Keep secrets in a secrets manager, not in code or images, and rotate them.
- Encrypt sensitive data at rest, and minimise what you store.
- Log authentication events and authorisation failures (never secrets), and alert on anomalies. Keep an inventory of your APIs so old versions and forgotten endpoints do not stay exposed.
- Keep dependencies patched, and test: security tests, dependency scanning, and periodic penetration testing.
More on this site
Related reading
- MDN: Cross-Origin Resource Sharing (CORS)MDN contributors · MozillaDocumentation
- Introduction to JSON Web TokensAuth0 · jwt.ioDocumentation
- RFC 6749: The OAuth 2.0 Authorization FrameworkIETFDocumentation
- AWS Security BlogAmazon Web Services engineers · Amazon Web ServicesBlogs
Show 6 moreShow fewer
- OWASP Cheat Sheet SeriesOWASP · OWASP FoundationDocumentation
- Google Security BlogGoogle engineers · GoogleBlogs
- How we built rate limiting capable of scaling to millions of domainsCloudflare engineering · CloudflareCase Studies
- OWASP Top 10OWASP · OWASP FoundationDocumentation
- Rate LimitingKeycdn engineers · KeycdnCase Studies
- Scalability and Authentication at TwitchTwitch engineers · TwitchCase Studies
Networking and Web Security Deep Dive · 13 minThe OWASP Top 10 and secure designA map of the most common web application risks, what each means in practice and a short review checklist you can apply to any design.Read here
What the Top 10 is
OWASP (the Open Worldwide Application Security Project) publishes an awareness list of the most critical web application risks, updated every few years from real data. Treat it as a checklist of categories to think about, not a complete standard. The names and order change between editions, so below the themes are described in stable terms with the current style of names in brackets.
The recurring risk categories
100%Figure SDA-NSD-05-1 · The risk categories as a review map · © forcsguy.com
Category In plain words Typical prevention Broken access control Users can act outside their permissions (view others' data, call admin features) Check authorisation on the server for every request and object; deny by default; test with two users Cryptographic failures Sensitive data exposed (no TLS, weak or home-made crypto, plaintext storage) TLS everywhere, strong standard algorithms, hash passwords with a slow salted hash, manage keys properly Injection Input interpreted as code or commands Parameterised queries, validation, least privilege (see the attacks lesson) Insecure design The design itself lacks controls Threat modelling, abuse cases, secure patterns, limits on resources Security misconfiguration Default passwords, open storage buckets, verbose errors, missing headers Hardened baselines, infrastructure as code, regular scans Vulnerable and outdated components Known flaws in libraries or platforms Inventory dependencies, update, use automated advisories Identification and authentication failures Weak passwords, no MFA, bad session handling MFA, rate limiting, safe recovery, strong session management Software and data integrity failures Untrusted updates, insecure CI/CD, unsafe deserialisation Signed artefacts, protected pipelines, verify dependencies Security logging and monitoring failures Attacks go unnoticed Log security events, alert, practise incident response Server-side request forgery The server fetches attacker-chosen URLs Allow-lists, block internal ranges, isolation Authentication, authorisation, encryption, hashing
- Authentication answers "who are you?"; authorisation answers "what may you do?". Do both on the server, every request.
- Encryption is reversible with a key (protect data in transit and at rest). Hashing is one-way (verify without storing the original): for passwords use a slow, salted algorithm such as Argon2, bcrypt or scrypt, never plain SHA of the password. A salt is a unique random value per password that defeats precomputed tables. (Details in the passwords lesson.)
- Never invent your own cryptography.
Secure design in practice
- Threat model early. Draw the data flows, list assets, ask "who might attack this and how?" (a simple method: for each component consider spoofing, tampering, repudiation, information disclosure, denial of service and elevation of privilege).
- Least privilege everywhere: users, services, database accounts, cloud roles.
- Defence in depth: several independent controls.
- Secure defaults: deny first; features off until needed.
- Fail safe: on error, do not grant access; do not leak details.
- Minimise data: do not collect or keep what you do not need.
- Automate: dependency scanning, static analysis, secret scanning, container scanning in CI.
- Test: unit tests for authorisation rules, automated scans, periodic penetration tests.
- Prepare for incidents: logs, alerts, runbooks, key rotation, backups.
A short review checklist for any feature
- Who is allowed to do this, and where is that checked?
- What input comes from users, and how is it validated and encoded?
- What secrets and personal data are involved, and how are they protected and logged?
- What can an attacker abuse in volume (rate limits, size limits, cost)?
- What third-party code or services does it add, and are they maintained?
- How would we notice if it were abused?
Where this fits
Security is a property of the whole system: network edge (previous lessons), application code (attacks lesson), identity (SSO and passwords lessons), data (encryption) and operations (monitoring and incident response). Make it a routine part of design reviews, not a final gate.
Real-world reading
Related reading
- OWASP Cheat Sheet SeriesOWASP · OWASP FoundationDocumentation
- AWS Security BlogAmazon Web Services engineers · Amazon Web ServicesBlogs
- Google Security BlogGoogle engineers · GoogleBlogs
- OWASP Top 10OWASP · OWASP FoundationDocumentation
Show 6 moreShow fewer
- Building Secure and Reliable SystemsGoogle engineers · O'Reilly / GoogleBooks
- Athenz: Fine-Grained, Role-Based Access Control at YahooYahoo engineers · YahooCase Studies
- Scalable IAM Architecture to Secure Access to 100 AWS Accounts at SegmentSegment engineers · SegmentCase Studies
- Security Development Lifecycle at SlackSlack engineers · SlackCase Studies
- Centralized Application Logging at eBayeBay engineers · eBayCase Studies
- Enterprise Key Management at SlackSlack engineers · SlackCase Studies
Go deeper on this
A path through videos, articles, other case studies and code on the same ideas as AWS Security Blog.
Warm upGet the vocabulary first.
Documentation
MDN: Cross-Origin Resource Sharing (CORS)
The clearest reference for how the browser's cross-origin rules and preflight requests work.
MozillaIntermediate
Documentation
OWASP Cheat Sheet Series
Short, practical guides for defending against each class of web vulnerability.
OWASP FoundationIntermediate
WatchHow others solve the same problem, on video.
Videos belong to their creators and play from YouTube. More on YouTube (opens in a new tab)
ReadEngineers explain it in their own words.
Blogs
Google Security Blog
Google's security blog: news and updates on security topics, such as new Android protections.
GoogleIntermediate
See it in another companyThe same ideas, a different system.
Case Studies · Read here
Clock Skew when Syncing Password Payloads at Drobbox
How Dropbox Passwords fixed sync errors from clock skew by replacing a two-way timestamp merge with a three-way merge against a base payload.
DrobboxIntermediate
Case Studies · Read here
OAuth Audit Toolbox at Indeed
Integrating third party apps with GSuite can be risky. Indeed's OAudit Toolbox allows you to educate your users and improve application security.
IndeedIntermediate
Keep learning
Loading community…