الـ Prototype Pollution والـ Resource DoS: request واحد يخلّي الكل admin أو يوقّع الـ server
deep merge عادي بيخلّي أي user يضيف isAdmin لكل الـ objects في الـ app، و regex للـ email بيوقّف الـ event loop تانية ونص بـ تسعة وعشرين حرف، و JSON بعشرين ميجا بيتقبل. بنفهم الـ prototype chain، و __proto__ و constructor، و Object.create(null) و Map، و ReDoS و catastrophic backtracking، وحدود الـ body والعمق والـ arrays، والـ event loop. والتحدي: hardening.js قصاد خمسة وتلاتين حالة.
نص شرح المعلم والكود الذي كتبه ونتيجة تشغيله، بنفس ترتيب الدرس.
أهلًا بيك. آخر درس في قسم الأمن، وفيه نوعين من الهجمات خاصين بـ JavaScript و Node. الأول: prototype pollution. في JavaScript كل object ليه prototype، وأغلب الـ objects بيشاوروا على نفس الـ prototype، اللي اسمه Object dot prototype. لو قريت property مش موجودة في الـ object، JavaScript بتدوّر عليها في الـ prototype. فلو حد قدر يكتب حاجة في Object dot prototype، كل object في الـ app كله هيشوفها. التاني: الـ resource DoS. Node بيشتغل على thread واحد، الـ event loop. لو request واحد قعد يحسب تانيتين، كل الـ requests التانية، لكل المستخدمين، بتستنى. server dot js فيه الاتنين: deep merge للـ settings، و regex للـ email، و express json بـ limit خمسين ميجا. attack dot js: واحد، محمود بيغيّر الـ settings بتاعته، بس الـ JSON فيه key اسمه underscore underscore proto. اتنين، email طوله تسعة وعشرين حرف، وآخره علامة تعجب. تلاتة، JSON بعشرين ميجا. ومع كل واحد بنبعت health check في نفس الوقت، علشان نشوف باقي المستخدمين حصلهم إيه. نشغّل.
// attack.js: تلات هجمات، ومعاها health check بنقيس بيه الـ server واقف ولا لأ
const URL = "http://localhost:3000";
const send = (method, path, body) =>
fetch(URL + path, { method, headers: { "content-type": "application/json" }, body: typeof body === "string" ? body : JSON.stringify(body) })
.then(async (r) => ({ status: r.status, json: await r.json().catch(() => null) }))
.catch((e) => ({ status: "error", json: e.cause?.code ?? e.message }));
// health check في نفس الوقت: لو الـ event loop واقف، ده هيستنى
async function healthDuring(attack) {
const t = Date.now();
const p = attack();
await new Promise((r) => setTimeout(r, 30));
const h0 = Date.now();
await send("GET", "/health");
const healthMs = Date.now() - h0;
const result = await p;
return { result, total: Date.now() - t, healthMs };
}
// ١) prototype pollution: الـ key اسمه __proto__
console.log("قبل: sara admin؟", (await send("GET", "/users/u2/can-delete")).json);
await send("PATCH", "/users/u1/settings", '{"theme":"dark","__proto__":{"isAdmin":true}}');
console.log("١) بعد settings بتاعة mahmoud: sara admin؟", (await send("GET", "/users/u2/can-delete")).json);
// ٢) ReDoS: email طويل آخره غلط
const evil = "a".repeat(28) + "!";
const r = await healthDuring(() => send("POST", "/subscribe", { email: evil }));
console.log(`٢) ReDoS بـ ${evil.length} حرف: الـ request خد ${r.total}ms، والـ health استنى ${r.healthMs}ms`);
// ٣) JSON ضخم: عشرين ميجا
const big = JSON.stringify({ rows: Array.from({ length: 400_000 }, (_, i) => ({ id: i, name: "x".repeat(30) })) });
const b = await healthDuring(() => send("POST", "/import", big));
console.log(`٣) JSON ${(big.length / 1e6).toFixed(0)}MB ← ${b.result.status}: خد ${b.total}ms، والـ health استنى ${b.healthMs}ms`);المخرجات
$ node server.js & S=$!; sleep 1; node attack.js; kill $S
API: http://localhost:3000
قبل: sara admin؟ { user: 'sara', isAdmin: false }
١) بعد settings بتاعة mahmoud: sara admin؟ { user: 'sara', isAdmin: true }
٢) ReDoS بـ 29 حرف: الـ request خد 1588ms، والـ health استنى 1557ms
٣) JSON 21MB ← 200: خد 243ms، والـ health استنى 8msواحد: sara بقت admin. محمود ما لمسش الـ user بتاعها خالص، غيّر الـ settings بتاعته بس. الـ merge عمل settings dot underscore proto dot isAdmin، وده بيكتب في Object dot prototype، فكل object في الـ process بقى عنده isAdmin بـ true. وده حصل بجد: lodash و jQuery وكتير من مكتبات الـ merge والـ query string كان فيهم ده. اتنين: تسعة وعشرين حرف بس، والـ request خد أكتر من تانية ونص، والـ health check استنى نفس الوقت. يعني كل الـ app وقف. ولو زوّدت حرف أو اتنين، الوقت بيتضاعف. تلاتة: عشرين ميجا اتقبلوا واتعمل لهم parse. هنا الوقت كان معقول، بس الـ memory اللي اتحجزت كبيرة، وعشرة requests زي ده في نفس الوقت ممكن يوقّعوا الـ process.
نقفل الـ prototype pollution إزاي؟ الـ keys الخطيرة تلاتة: underscore underscore proto، و constructor، و prototype. لأن constructor dot prototype بيوصل لنفس المكان. ارفضهم، ما تتجاهلهمش بس، علشان اللي بيبعتهم بيحاول يهاجم. لف على الـ own keys بس، بـ Object dot keys، مش for in. الـ objects اللي بتعملها في الـ merge اعملها بـ Object create null: object مالوش prototype خالص، فمفيش حاجة توصل لها. واستخدم Map للـ lookups بالـ id بدل object عادي. لو الـ users في object، و id اسمه underscore underscore proto، هترجع الـ prototype نفسه. وفي الشيك على الصلاحيات: Object hasOwn، مش مجرد قراية الـ property. وفي Node فيه flag اسمه disable-proto، بيشيل underscore underscore proto من الـ language نفسها. وأحسن من كل ده: ما تعملش merge لـ input المستخدم أصلًا. اعمل validation بـ zod لشكل الـ settings، وخد الـ fields اللي إنت عارفها بس.
والـ ReDoS. الـ regex engine في JavaScript بيعمل backtracking: لو جرّب طريقة وفشل، يرجع ويجرّب تقسيمة تانية. والـ regex بتاعنا فيه group جُوّاه plus، وعلى الـ group نفسه plus. فالـ string اللي فيها تسعة وعشرين حرف ممكن تتقسم بعدد طرق رهيب، والـ engine بيجرّبهم كلهم قبل ما يقول لأ، لما يلاقي علامة التعجب في الآخر. ده اسمه catastrophic backtracking. الحل: حط حد للطول قبل الـ regex. الـ email أقصاه ميتين أربعة وخمسين. ما تكتبش quantifier جُوّه group عليه quantifier. ولو الـ regex جاي من المستخدم، أو معقد أوي، استخدم engine من غير backtracking زي RE2. وفيه أدوات زي safe-regex و eslint plugins بتكشف الـ regex الخطير.
وباقي الـ resource DoS: حجم الـ body: limit على قد الـ API. الـ settings مش محتاجة أكتر من مِيّة kilobyte. والـ uploads الكبيرة ليها route لوحدها، بـ streaming، مش JSON. شكل الـ JSON: حتى body صغير ممكن يبقى عمقه ألف مستوى، و recursive function تقع بـ stack overflow، أو array فيها مِيّة ألف رقم صغير. فبنشيك العمق وعدد الـ keys وطول الـ arrays. وحدود تانية شفناها قبل كده: rate limiting، و timeout لكل request، و pagination بحد أقصى، وحد لعدد الـ files في الـ upload. القاعدة: أي حاجة المستخدم بيتحكم في حجمها، لازم يبقى ليها حد. server dot js الجديد: limit مِيّة kilobyte، و limitShape middleware على كل الـ requests، و Map للـ users بـ settings من غير prototype، و safeMerge، و isEmail، وشيك isAdmin بـ Object hasOwn. التحدي: اكتب hardening dot js. test dot js فيه خمسة وتلاتين حالة.
hardening.js: safeMerge (own keys، ويرفض __proto__ و constructor و prototype، و Object.create(null)، وحد للعمق)، و isEmail بحد للطول و regex من غير nested quantifiers، و checkShape للعمق والـ keys والـ arrays، و limitShape بيرجّع four thirteen.
الحل. safeMerge: Object dot keys، والـ keys الممنوعة بـ throw، وأي object جديد بـ Object create null، والعمق بيتعد. isEmail: الطول الأول، وبعدين regex كل quantifier فيه على character class بحد أقصى، ومفيش group عليه plus وجُوّاه plus. وقته linear. checkShape: function واحدة recursive، وعدّاد keys واحد لكل الـ JSON، مش لكل مستوى. limitShape بيلف عليه في middleware. نشغّل الهجمات تاني.
// hardening.js: merge آمن، و email validation من غير ReDoS، وحدود لشكل الـ JSON
const FORBIDDEN = new Set(["__proto__", "constructor", "prototype"]);
const isPlain = (v) => v !== null && typeof v === "object" && !Array.isArray(v);
// deep merge بس للـ own keys، ومن غير الـ keys الخطيرة، وبحد للعمق
export function safeMerge(target, source, maxDepth = 5, depth = 0) {
if (depth > maxDepth) throw new Error("العمق كبير");
for (const key of Object.keys(source)) {
if (FORBIDDEN.has(key)) throw new Error(`key ممنوع: ${key}`);
const v = source[key];
if (isPlain(v)) {
if (!Object.hasOwn(target, key) || !isPlain(target[key])) target[key] = Object.create(null);
safeMerge(target[key], v, maxDepth, depth + 1);
} else target[key] = v;
}
return target;
}
// email: طول محدود الأول، وبعدين regex مفيهوش nested quantifiers (وقته linear)
const EMAIL = /^[A-Za-z0-9._%+-]{1,64}@[A-Za-z0-9-]{1,63}(\.[A-Za-z0-9-]{1,63})*\.[A-Za-z]{2,24}$/;
export const isEmail = (s) => typeof s === "string" && s.length <= 254 && EMAIL.test(s);
// بيلف على الـ JSON بعد الـ parse ويرفض أي شكل أكبر من الحدود
export function checkShape(value, { maxDepth = 10, maxKeys = 1000, maxArray = 1000 } = {}) {
let keys = 0;
const walk = (v, d) => {
if (d > maxDepth) throw new Error("JSON عميق زيادة");
if (Array.isArray(v)) {
if (v.length > maxArray) throw new Error("array كبيرة زيادة");
for (const x of v) walk(x, d + 1);
} else if (v !== null && typeof v === "object") {
for (const k of Object.keys(v)) {
if (++keys > maxKeys) throw new Error("keys كتير زيادة");
walk(v[k], d + 1);
}
}
};
walk(value, 0);
return true;
}
// middleware: أي body شكله برّه الحدود ← four thirteen
export const limitShape = (limits) => (req, res, next) => {
try {
checkShape(req.body, limits);
next();
} catch (e) {
res.status(413).json({ error: e.message });
}
};المخرجات
$ node server.js & S=$!; sleep 1; node attack.js; kill $S
API: http://localhost:3000
قبل: sara admin؟ { user: 'sara', isAdmin: false }
١) بعد settings بتاعة mahmoud: sara admin؟ { user: 'sara', isAdmin: false }
٢) ReDoS بـ 29 حرف: الـ request خد 37ms، والـ health استنى 6ms
٣) JSON 21MB ← 413: خد 77ms، والـ health استنى 6mssara لسه مش admin. الـ ReDoS خلص في ملي تانية، والـ health ما استناش. والعشرين ميجا اترفضوا بـ four thirteen قبل الـ parse. ونشغّل test dot js.
المخرجات
$ node server.js & S=$!; sleep 1; node test.js; kill $S API: http://localhost:3000 ✅ safeMerge عادي و nested ✅ safeMerge بيكمّل على الموجود ✅ __proto__ من JSON.parse ← throw ✅ constructor.prototype ← throw ✅ __proto__ nested ← throw ✅ Object.prototype نضيف بعد كل ده ✅ عمق عشرين ← throw ✅ arrays بتتنسخ زي ما هي ✅ الـ objects الجديدة من غير prototype ✅ isEmail([email protected]) ← true ✅ isEmail([email protected]) ← true ✅ isEmail([email protected]) ← true ✅ isEmail("") ← false ✅ isEmail("abc") ← false ✅ isEmail("a@b") ← false ✅ isEmail("@b.co") ← false ✅ isEmail("a [email protected]") ← false ✅ isEmail(42) ← false ✅ isEmail(null) ← false ✅ email خمسين ألف حرف آخره غلط ← false في أقل من خمسين ms 0.0ms ✅ email طويل جُوّه الحد ← سريع برضه ✅ checkShape عادي ← true ✅ عمق خمستاشر ← throw ✅ array ألفين ← throw ✅ keys كتير ← throw ✅ الـ keys بتتعد في كل المستويات ✅ null و strings و numbers ← true ✅ server: __proto__ ← 400 و sara لسه مش admin ✅ server: settings عادية ← two hundred ✅ server: id اسمه __proto__ ← 404 ✅ server: body أكبر من مية kb ← 413 ✅ server: array ألفين عنصر صغيرين ← 413 ✅ server: JSON بايظ ← 400 ✅ server: ReDoS payload ← false بسرعة 3ms ✅ server: heal …
كله نجح. وكده خلّصنا قسم الأمن التطبيقي: من الـ cookies والـ CSRF، لحد الـ supply chain والـ AppSec testing. القسم الجاي: الأداء والمراقبة. وأول درس: SLI و SLO. إزاي تقول الـ app سريع ولا بطيء بأرقام، مش بإحساس، و error budgets، وإمتى تصحّى الـ on-call بالليل وإمتى لأ.
// server.js: نفس الـ API، بس بحدود في كل حتة
import express from "express";
import { safeMerge, isEmail, limitShape } from "./hardening.js";
const app = express();
app.use(express.json({ limit: "100kb" })); // أكبر body معقول للـ API ده
app.use(limitShape({ maxDepth: 10, maxKeys: 1000, maxArray: 1000 }));
// Map بدل object: مفيش __proto__ ولا constructor كـ id
const users = new Map([
["u1", { name: "mahmoud", settings: Object.create(null) }],
["u2", { name: "sara", settings: Object.create(null) }],
]);
app.patch("/users/:id/settings", (req, res) => {
const user = users.get(req.params.id);
if (!user) return res.status(404).json({ error: "مش موجود" });
try {
safeMerge(user.settings, req.body);
} catch (e) {
return res.status(400).json({ error: e.message });
}
res.json(user.settings);
});
app.get("/users/:id/can-delete", (req, res) => {
const user = users.get(req.params.id);
if (!user) return res.status(404).json({ error: "مش موجود" });
res.json({ user: user.name, isAdmin: Object.hasOwn(user, "isAdmin") && user.isAdmin === true });
});
app.post("/subscribe", (req, res) => res.json({ ok: isEmail(req.body.email) }));
app.post("/import", (req, res) => res.json({ rows: req.body.rows?.length ?? 0 }));
app.get("/health", (req, res) => res.json({ ok: true }));
// أي error من express.json (body كبير أو JSON بايظ) ← رد واضح من غير stack
app.use((err, req, res, next) => res.status(err.status ?? 500).json({ error: err.type ?? "error" }));
app.listen(3000, () => console.log("API: http://localhost:3000"));import { safeMerge, isEmail, checkShape } from "./hardening.js";
let ok = 0, all = 0;
const check = (name, cond, extra = "") => { all++; if (cond) ok++; console.log(cond ? "✅" : "❌", name, extra); };
const throws = (fn) => { try { fn(); return false; } catch { return true; } };
const URL = "http://localhost:3000";
const send = async (method, path, body) => {
const r = await fetch(URL + path, { method, headers: { "content-type": "application/json" }, body: typeof body === "string" ? body : JSON.stringify(body) });
return { status: r.status, json: await r.json().catch(() => null) };
};
check("safeMerge عادي و nested", JSON.stringify(safeMerge({}, { a: 1, b: { c: 2 } })) === '{"a":1,"b":{"c":2}}');
check("safeMerge بيكمّل على الموجود", JSON.stringify(safeMerge({ b: { x: 1 } }, { b: { y: 2 } })) === '{"b":{"x":1,"y":2}}');
check("__proto__ من JSON.parse ← throw", throws(() => safeMerge({}, JSON.parse('{"__proto__":{"polluted":1}}'))));
check("constructor.prototype ← throw", throws(() => safeMerge({}, JSON.parse('{"constructor":{"prototype":{"polluted":1}}}'))));
check("__proto__ nested ← throw", throws(() => safeMerge({}, JSON.parse('{"a":{"__proto__":{"polluted":1}}}'))));
check("Object.prototype نضيف بعد كل ده", ({}).polluted === undefined);
let deep = {}; let cur = deep; for (let i = 0; i < 20; i++) cur = cur.n = {};
check("عمق عشرين ← throw", throws(() => safeMerge({}, deep)));
check("arrays بتتنسخ زي ما هي", JSON.stringify(safeMerge({}, { tags: [1, 2] })) === '{"tags":[1,2]}');
check("الـ objects الجديدة من غير prototype", Object.getPrototypeOf(safeMerge({}, { a: { b: 1 } }).a) === null);
const good = ["a" + "@b.co", "mahmoud.ali" + "@baassma.tech", "x_y-z" + "@mail.example.com"];
for (const e of good) check(`isEmail(${e}) ← true`, isEmail(e) === true);
for (const e of ["", "abc", "a" + "@b", "@b.co", "a b" + "@c.co", 42, null]) check(`isEmail(${JSON.stringify(e)}) ← false`, isEmail(e) === false);
const t0 = performance.now();
const evil = isEmail("a".repeat(50000) + "!");
const ms = performance.now() - t0;
check("email خمسين ألف حرف آخره غلط ← false في أقل من خمسين ms", evil === false && ms < 50, `${ms.toFixed(1)}ms`);
const t1 = performance.now();
isEmail("a".repeat(64) + "@" + "b".repeat(60) + "." + "c".repeat(40) + "!");
check("email طويل جُوّه الحد ← سريع برضه", performance.now() - t1 < 50);
check("checkShape عادي ← true", checkShape({ a: [1, 2, { b: 3 }] }) === true);
let d = []; for (let i = 0; i < 15; i++) d = [d];
check("عمق خمستاشر ← throw", throws(() => checkShape(d, { maxDepth: 10 })));
check("array ألفين ← throw", throws(() => checkShape({ rows: new Array(2000).fill(0) }, { maxArray: 1000 })));
check("keys كتير ← throw", throws(() => checkShape(Object.fromEntries(Array.from({ length: 50 }, (_, i) => ["k" + i, i])), { maxKeys: 20 })));
check("الـ keys بتتعد في كل المستويات", throws(() => checkShape({ a: { b: 1, c: 2 }, d: { e: 3 } }, { maxKeys: 4 })));
check("null و strings و numbers ← true", checkShape(null) && checkShape("x
…03 / دروس المسار (122)
- 01أهلًا بيك: يعني إيه backend، والكورس ده ماشي إزاي
- 02الملفات والفولدرات والـ terminal: تتحرك على جهازك زي المبرمجين
- 03Node وأول برنامج: تشغّل وتقرا رسالة الخطأ
- 04القيم والمتغيرات والأنواع: const و let و typeof
- 05القرارات والتكرار: if و === والـ truthy والـ loops
- 06الـ functions: parameters و return والـ arrow functions والـ scope
- 07الـ objects والـ arrays: destructuring و spread و map و filter و reduce
- 08JSON والنصوص والتواريخ: اللغة اللي الـ backend بيتكلم بيها
- 09الـ callbacks والـ closures وأول لمسة async: setTimeout
- 10الـ classes والـ errors: throw و try/catch و stack trace
- 11git: تحفَظ كل خطوة وترجعلها، وما تسرّبش أسرارك
- 12ESM و CommonJS و package exports: Node بيلاقي الـ modules إزاي
- 13الـ Promises و async/await: sequential و parallel والأخطاء والإلغاء
- 14الـ event loop والـ microtasks: Node بيعمل كل حاجة بـ thread واحد إزاي
- 15الـ Streams والـ Backpressure: ملفات أكبر من الـ memory
- 16الـ File System والـ paths: قراية وكتابة صح، ومن غير path traversal
- 17الـ Buffers والبيانات الـ binary: الـ bytes من جُوّه
- 18Crypto APIs والأسرار: random و hash و HMAC و AES-GCM
- 19الـ Worker Threads: شغل CPU تقيل من غير ما توقف الـ server
- 20الـ Errors على مستوى الـ process: operational و programmer و crash-only
- 21الـ Node test runner والـ debugging: tests من غير مكتبات
- 22HTTP من جُوّه: الـ methods والـ status codes والـ headers
- 23Express والـ Routing: الـ params والـ query والترتيب والـ Router
- 24Express 5: إيه اللي اتغيّر، وإزاي تنقل مشروع قديم
- 25الـ Middleware ودورة حياة الـ request جُوّه Express
- 26Validation للمدخلات بـ Zod: ما تصدّقش أي حاجة جاية من برة
- 27تصنيف الأخطاء و Problem Details: شكل واحد لكل الـ errors
- 28الـ CORS والـ Cookies: المتصفح بيحمي المستخدم إزاي
- 29رفع الملفات وحدود الحجم: multer من غير ثغرات
- 30الـ Realtime: Server-Sent Events و WebSockets
- 31OpenAPI والـ API Versioning: عقد مكتوب، وتغيير من غير ما تكسر حد
- 32PostgreSQL: الـ DDL وأنواع البيانات الصح لكل عمود
- 33الـ Constraints: PK و FK و UNIQUE و CHECK — الـ database بتحمي نفسها
- 34الـ Normalization والـ ERD: تقسّم البيانات صح من أول يوم
- 35الـ JOINs والتجميع: INNER و LEFT و GROUP BY و HAVING و window functions
- 36JSONB في PostgreSQL: إمتى تستخدمه، وإزاي تسأله وتعمله index
- 37الـ Indexes من جُوّه: B-tree و GIN و BRIN
- 38Partial و Covering indexes: indexes أصغر وأسرع
- 39الـ Pagination بالـ Keyset: ليه OFFSET بيبطّأ وبيكرر
- 40Full Text Search في Postgres: بحث بالكلمات، بالعربي والإنجليزي
- 41EXPLAIN ANALYZE والـ Planner: اقرا الـ plan وصلّح الـ query
- 42الـ Transactions بـ node-postgres: كله أو ولا حاجة
- 43الـ MVCC ومستويات الـ Isolation: transactions كتير في نفس الوقت
- 44الـ Locks والـ Deadlocks: مين مستني مين
- 45SKIP LOCKED و Job Leasing: Postgres كـ job queue
- 46Row Level Security والـ Multi-tenancy: كل عميل يشوف بياناته بس
- 47Migrations من غير downtime: expand و backfill و contract
- 48الـ Replication والـ Read Replicas: نسخ حية من الـ database
- 49الـ Connection Pooling و PgBouncer: connections أقل، requests أكتر
- 50الـ Partitioning والـ VACUUM والمراقبة: Postgres على المدى الطويل
- 51Redis وأنواع البيانات: strings و hashes و lists و sets و sorted sets
- 52Cache-aside والـ TTL: Redis قدام الـ database
- 53الـ Cache invalidation والـ Stampede: لما الـ key الشهير يموت
- 54Lua والـ Atomicity في Redis: كام أمر كأنهم أمر واحد
- 55الـ Rate Limiting في Redis: fixed window و sliding window و token bucket
- 56الـ Sessions في Redis: تسجيل دخول تقدر تلغيه في أي وقت
- 57Redis Streams والـ Consumer Groups: log بيتوزع على workers
- 58Pub/Sub و BullMQ: إشارات بين الـ instances، وطوابير شغل محترمة
- 59Redis لما يقع: الـ persistence (RDB و AOF) والـ replication
- 60Redis في الإنتاج: الـ ACLs والـ Cluster والمراقبة
- 61تخزين الـ Passwords بـ Argon2id: صح من أول مرة
- 62Session Fixation والـ Rotation: id جديد مع كل صلاحية جديدة
- 63الـ Cookie Flags والـ CSRF: المتصفح بيبعت الـ cookie، فلازم تتأكد مين اللي طلب
- 64الـ XSS والـ Content Security Policy: ما تخليش النص يتحوّل لـ code
- 65الـ OAuth و OpenID Connect و PKCE: login بـ Google من غير ما تشوف الـ password
- 66التأكد من الـ JWT صح: التوقيع والـ claims والـ scopes
- 67الـ BOLA و BFLA: الـ token السليم مش معناه إن الطلب مسموح
- 68الـ RBAC و ABAC والملكية: policy واحدة بدل ifs متفرقة
- 69الـ MFA والـ recovery: التاني factor اللي بجد
- 70الـ Passkeys و WebAuthn: login من غير password وضد الـ phishing
- 71الـ Threat Modeling بـ STRIDE: فكّر زي المهاجم قبل ما تكتب code
- 72الـ SQL Injection والـ Parameterization: الـ data ما تبقاش code
- 73الـ SSRF والـ Egress: ما تخليش الـ server بتاعك يزور الشبكة الداخلية
- 74الـ Security Headers والـ TLS: كل response يقول للـ browser يحمي المستخدم إزاي
- 75توقيع الـ Webhooks والـ Replay: الـ webhook ده جاي فعلًا من Stripe؟
- 76تغيير الأسرار والـ HMAC: إزاي تغيّر مفتاح من غير ما كل حاجة تقع
- 77سلسلة التوريد والـ SBOM: إنت واثق في ألف package ما تعرفهمش؟
- 78الـ Audit والـ Privacy Logs: سجّل مين عمل إيه، من غير ما تسجّل الأسرار
- 79اختبار الأمان و OWASP ASVS: الأمن جُوّه الـ CI، مش audit آخر السنة
- 80الـ Prototype Pollution والـ Resource DoS: request واحد يخلّي الكل admin أو يوقّع الـ serverانت هنا
- 81الـ SLI والـ SLO والـ Error Budget: إمتى تصحّي الـ on-call وإمتى تسيبه نايم
- 82الـ Event Loop Delay والـ ELU: لما Node نفسه يتخنق
- 83الـ Worker Threads والـ CPU Profiling: الشغل التقيل بره الـ event loop، والوقت راح فين
- 84الـ Memory والـ GC والـ Leaks: الـ process اللي بيكبر لحد ما يقع
- 85الـ N+1 Queries والـ DataLoader: صفحة واحدة بمِيّتين query
- 86الـ HTTP Caching والـ Compression: أسرع request هو اللي ما بيوصلش
- 87الـ Load Testing والـ Soak Testing: الـ server بيستحمل قد إيه بجد
- 88الـ Concurrency Limits والـ Bulkheads: dependency بطيئة ما توقعش الـ app كله
- 89الـ Timeouts والـ Retries والـ Circuit Breakers: إزاي تتعامل مع dependency بطيئة أو واقعة
- 90OpenTelemetry والـ Distributed Tracing: الـ request راح فين وضاع وقته فين
- 91Docker Layers والـ Build Context: ليه الـ build بياخد دقيقة وفيه الـ .env بتاعك
- 92Multi-stage Builds و Non-root: image صغيرة ومن غير root
- 93Docker Compose والـ Networks: الـ services بتلاقي بعض إزاي
- 94Docker Volumes: الـ data بتتحفَظ فين
- 95Healthcheck و Restart و Resource Limits: running مش معناها شغّال
- 96BuildKit والـ Build Secrets: الـ token ما يدخلش الـ image
- 97Reverse Proxy و TLS: اللي واقف قدام الـ app
- 98Multi-arch Images والـ Native Modules: اشتغلت عندي
- 99CI/CD و Rollback و Canary: الـ deploy يبقى ممل
- 100Kubernetes من الأول: Pods و Deployments و Services و Probes
- 101Modular Monolith و DDD: حدود واضحة من غير network
- 102Transactional Outbox و Inbox: الـ event ما يضيعش وما يتنفذش مرتين
- 103Sagas: عملية واحدة على تلات services من غير transaction واحدة
- 104CQRS و Event Sourcing: الـ events هي الحقيقة
- 105الـ Queues والـ Brokers: BullMQ و RabbitMQ و Kafka و SQS
- 106Realtime على أكتر من instance: Redis pub/sub و presence و resume
- 107الـ Object Storage والـ Media: presigned URLs و uploads مباشرة
- 108التكامل مع الـ Email والـ Search: retries و webhooks و indexes
- 109GraphQL و gRPC في الإنتاج: contracts و DataLoader و limits و deadlines
- 110Kafka على أكتر من zone و region: الـ replication والـ ISR والـ acks والـ MirrorMaker والـ failover
- 111TypeScript و runtime boundaries: الـ types بتختفي، والـ schemas لأ
- 112ORM ولا SQL: query builders و repositories و migrations و transactions
- 113الـ Serverless من جُوّه: cold starts و freeze و timeouts و connections
- 114الـ Testing Pyramid: unit و integration و e2e على Postgres حقيقية
- 115Contract Testing و Property-Based Testing بـ fast-check
- 116الـ Payments: idempotency و webhooks و refunds و reconciliation
- 117الـ Timezones والـ Internationalization: UTC و DST والـ locales والـ plurals والفلوس
- 118الـ Privacy والـ Data Retention: consent و export و erasure و crypto shredding
- 119الـ ADRs والـ Feature Flags: القرارات المكتوبة والـ rollout من غير deploy
- 120Multi-region active-active: حل الـ conflicts بـ HLC و CRDTs
- 121Readiness و Liveness و Startup Probes: الـ pod جاهز ولا عايش؟
- 122Incident Runbooks: من الـ alert للـ postmortem