الـ Threat Modeling بـ STRIDE: فكّر زي المهاجم قبل ما تكتب code

جارٍ التحميل…

01 / ملخص الدرس

الـ Threat Modeling بـ STRIDE: فكّر زي المهاجم قبل ما تكتب code

أول درس في الأمن التطبيقي: بنرسم الـ system كـ Data Flow Diagram فيه external entities و processes و data stores و flows و trust boundaries، وبنطلّع التهديدات بـ STRIDE-per-element، ونقيّمها بـ likelihood و impact، ونربطها بالـ mitigations أو نقبلها بسبب. والتحدي: tool بيطلّع التهديدات من الـ model لوحده، و gate في الـ CI بيكشف حاجات نسيناها فعلًا زي Redis من غير TLS.

02 / شرح الدرس مكتوبًا

نص شرح المعلم والكود الذي كتبه ونتيجة تشغيله، بنفس ترتيب الدرس.

أهلًا بيك في قسم جديد: الأمن التطبيقي. في القسم اللي فات كنا بنصلّح vulnerabilities بعد ما نلاقيها. Threat modeling بيقلب الترتيب: قبل ما تكتب الـ feature، تقعد وتسأل: إيه اللي ممكن يبوز؟ Adam Shostack، واحد من أشهر الناس في المجال ده، بيلخّصه في أربع أسئلة: احنا بنبني إيه؟ إيه اللي ممكن يبوز؟ هنعمل إيه فيه؟ وعملنا مهمتنا كويس؟ السؤال الأول: بنبني إيه؟ الإجابة رسمة اسمها Data Flow Diagram، فيها أربع حاجات: external entities: حاجات برّه سيطرتك، زي المستخدم و Stripe. processes: الـ code بتاعك، زي الـ API والـ worker. data stores: Postgres و Redis. و data flows: الـ arrows بينهم. والأهم: trust boundaries، الخطوط اللي بتفصل مستوى trust عن مستوى تاني. أي arrow بيعدّي خط من دول هو المكان اللي التهديدات بتتجمّع فيه. model dot js هو الرسمة دي كـ data: تلات zones، وست elements، وست flows. والـ mitigations فاضية لسه.

السؤال التاني: إيه اللي ممكن يبوز؟ STRIDE ست حروف، كل حرف تهديد، وكل تهديد عكس security property: S، Spoofing: حد ينتحل شخصية. عكس الـ authentication. T، Tampering: حد يغيّر data. عكس الـ integrity. R، Repudiation: حد يعمل حاجة وينكر. عكس الـ audit. I، Information disclosure: data تتسرّب. عكس الـ confidentiality. D، Denial of service: الخدمة تقع. عكس الـ availability. E، Elevation of privilege: حد ياخد صلاحية مش بتاعته. عكس الـ authorization.

ومش كل حرف ينفع مع كل حاجة. فيه طريقة اسمها STRIDE per element: الـ external entity بتتعرّض لـ S و R بس، لأنها مش بتاعتك. الـ process بتتعرّض للست. الـ store و الـ flow لـ T و I و D. وبعدين كل تهديد ليه risk. فيه طرق معقدة، بس هنا هنستخدم حاجة بسيطة: likelihood ضرب impact. likelihood عالي لو الحاجة دي على الإنترنت أو الـ flow بيعدّي trust boundary. impact عالي لو فيه data شخصية أو فلوس، أو لو التهديد E. وكل تهديد ليه أربع مصاير: mitigate تقفله، أو accept تقبله بسبب مكتوب، أو transfer تديه لحد تاني زي Stripe أو insurance، أو avoid تشيل الـ feature. التحدي: stride dot js. tool بيطلّع التهديدات من الـ model لوحده، بدل ما تكتبها بإيدك في spreadsheet وتنسى نصها. STRIDE و PER TYPE. analyze: لكل element ولكل flow، الحروف المناسبة، والـ risk، والـ status. و gate: التهديدات المفتوحة العالية. و main dot js بيطبع التقرير، ولو فيه blockers بيخرج بـ exit code واحد، علشان الـ CI يوقف.

تمرين

analyze(model): لكل element و flow تهديدات PER_TYPE (external SR، process STRIDE، store/flow TID)، و risk = likelihood (3 لو exposed) × impact (3 لو pii/payments أو E)، و status من mitigations/accepted، مترتبين. و gate للـ open اللي risk ≥ 6.

الحل. zoneOf و byId علشان نعرف zone كل طرف. items: الـ elements والـ flows مع بعض. exposed و sensitive لكل item. وبعدين لكل حرف: key و risk و status و note. والترتيب، و gate filter بسيط. نشغّل test dot js.

stride.js
// stride.js: بيطلّع التهديدات من الـ model لوحده، وبيقيّمها
export const STRIDE = {
  S: ["Spoofing", "حد ينتحل شخصية", "Authentication"],
  T: ["Tampering", "حد يغيّر data", "Integrity"],
  R: ["Repudiation", "حد ينكر إنه عمل حاجة", "Non-repudiation"],
  I: ["Information disclosure", "data تتسرّب", "Confidentiality"],
  D: ["Denial of service", "الخدمة تقع", "Availability"],
  E: ["Elevation of privilege", "حد ياخد صلاحية مش بتاعته", "Authorization"],
};
// STRIDE-per-element: كل نوع بيتعرّض لأنهي تهديدات
export const PER_TYPE = { external: "SR", process: "STRIDE", store: "TID", flow: "TID" };

export function analyze(model) {
  const zoneOf = Object.fromEntries(model.elements.map((e) => [e.id, e.zone]));
  const byId = Object.fromEntries(model.elements.map((e) => [e.id, e]));
  const items = [
    ...model.elements,
    ...model.flows.map((f) => ({ ...f, type: "flow", name: `${f.from} → ${f.to} (${f.what})` })),
  ];
  const threats = [];
  for (const el of items) {
    // exposed: في الإنترنت، أو flow بيعدّي حدود ثقة
    const exposed = el.type === "flow" ? zoneOf[el.from] !== zoneOf[el.to] : el.zone === "internet";
    const touches = el.type === "flow" ? [byId[el.from], byId[el.to]] : [el];
    const sensitive = touches.some((x) => x.data?.some((d) => d === "pii" || d === "payments"));
    for (const letter of PER_TYPE[el.type]) {
      const key = `${el.id}:${letter}`;
      const likelihood = exposed ? 3 : 1;
      const impact = sensitive || letter === "E" ? 3 : 2;
      const status = model.mitigations[key] ? "mitigated" : model.accepted[key] ? "accepted" : "open";
      threats.push({
        key,
        element: el.name,
        category: STRIDE[letter][0],
        text: STRIDE[letter][1],
        risk: likelihood * impact,
        status,
        note: model.mitigations[key] ?? model.accepted[key] ?? "",
      });
    }
  }
  return threats.sort((a, b) => b.risk - a.risk || a.key.localeCompare(b.key));
}

// الـ CI gate: أي تهديد open و risk ستة أو أكتر ← فشل
export const gate = (threats, min = 6) => threats.filter((t) => t.status === "open" && t.risk >= min);

المخرجات

$ node test.js
✅ PER_TYPE صح 
✅ العدد: 2 + 6 + 3 + 3 + 3 + 3 = 20 20
✅ الـ keys بالشكل id:letter 
✅ flow بيعدّي حدود ← likelihood 3 
✅ flow جُوّه نفس الـ zone ← likelihood 1 
✅ store فيه pii ← impact 3 
✅ E دايمًا impact 3 
✅ external في الإنترنت ← likelihood 3 
✅ status: mitigated و accepted و open 
✅ note فيها الـ mitigation 
✅ مترتبين بالـ risk من الكبير 
✅ gate: open و risk ≥ 6 بس f1:D,f1:I,u:S

12/12 نجحوا

تمام. ونشغّل التقرير على الـ model بتاعنا، وهو لسه من غير أي mitigations.

stride.js

المخرجات

$ node main.js; echo "exit code: $?"
❌  9 f3:D      Denial of service       api → pg (SQL queries)             
❌  9 f3:I      Information disclosure  api → pg (SQL queries)             
❌  9 f3:T      Tampering               api → pg (SQL queries)             
❌  9 f6:D      Denial of service       worker → pg (تحديث الـ payments)   
❌  9 f6:I      Information disclosure  worker → pg (تحديث الـ payments)   
❌  9 f6:T      Tampering               worker → pg (تحديث الـ payments)   
❌  6 f1:D      Denial of service       user → api (login و API calls)     
❌  6 f1:I      Information disclosure  user → api (login و API calls)     
❌  6 f1:T      Tampering               user → api (login و API calls)     
❌  6 f2:D      Denial of service       stripe → api (payment webhooks)    
❌  6 f2:I      Information disclosure  stripe → api (payment webhooks)    
❌  6 f2:T      Tampering               stripe → api (payment webhooks)    
❌  6 f4:D      Denial of service       api → redis (sessions و jobs)      
❌  6 f4:I      Information disclosure  api → redis (sessions و jobs)      
❌  6 f4:T      Tampering               api → redis (sessions و jobs)      
❌  6 f5:D      Denial of service      
…

أربعين تهديد، كلهم مفتوحين، و exit code واحد. دلوقتي السؤال التالت: هنعمل إيه؟ كل حاجة عملناها في القسم اللي فات بقت mitigation: TLS و HSTS على الـ flow من المستخدم، و HMAC على الـ webhooks، و MFA و passkeys للـ spoofing، و policy واحدة للـ elevation. وقبلنا حاجتين بسبب مكتوب: المستخدم ممكن ينكر، والـ audit log بيقلّل ده. و Redis على شبكة داخلية، وهنراجعها بعدين. خد بالك إن accepted لازم يبقى معاه اسم حد وتاريخ مراجعة في الحقيقة. نشغّل تاني.

model.js
// model.js: الـ system بتاعنا كـ Data Flow Diagram: مين بيكلّم مين، وفين حدود الثقة
export const model = {
  name: "Baassma API",
  zones: { internet: "الإنترنت (مش موثوق)", app: "الـ app servers", data: "الـ databases" },
  elements: [
    { id: "user", type: "external", name: "متصفح المستخدم", zone: "internet" },
    { id: "stripe", type: "external", name: "Stripe webhooks", zone: "internet" },
    { id: "api", type: "process", name: "Express API", zone: "app" },
    { id: "worker", type: "process", name: "BullMQ worker", zone: "app" },
    { id: "pg", type: "store", name: "Postgres", zone: "data", data: ["pii", "payments"] },
    { id: "redis", type: "store", name: "Redis (sessions + queue)", zone: "data", data: ["sessions"] },
  ],
  flows: [
    { id: "f1", from: "user", to: "api", what: "login و API calls" },
    { id: "f2", from: "stripe", to: "api", what: "payment webhooks" },
    { id: "f3", from: "api", to: "pg", what: "SQL queries" },
    { id: "f4", from: "api", to: "redis", what: "sessions و jobs" },
    { id: "f5", from: "redis", to: "worker", what: "jobs" },
    { id: "f6", from: "worker", to: "pg", what: "تحديث الـ payments" },
  ],
  // key = "<id>:<حرف STRIDE>"
  mitigations: {
    "f1:T": "TLS 1.3 + HSTS (درس الـ headers)",
    "f1:I": "TLS + cookies Secure/HttpOnly",
    "f1:D": "rate limit + body size limit + timeouts",
    "f2:T": "HMAC signature على الـ body (درس الـ webhooks)",
    "f2:I": "TLS",
    "f2:D": "rate limit + queue بدل الشغل جُوّه الـ request",
    "api:S": "sessions + MFA + passkeys",
    "api:T": "zod validation + parameterized SQL",
    "api:R": "audit log لكل عملية حساسة",
    "api:I": "errors عامة + ما نرجّعش stack traces",
    "api:D": "event loop monitoring + bulkheads",
    "api:E": "ownership checks + policy واحدة (RBAC/ABAC)",
    "stripe:S": "التوقيع + timestamp ضد الـ replay",
    "user:S": "MFA + lockout",
    "pg:T": "least privilege role + backups",
    "pg:I": "encryption at rest + RLS + الـ PII في columns متشفّرة",
    "pg:D": "connection pool limits + statement_timeout",
    "f3:T": "TLS للـ database + parameterized queries",
    "f3:I": "TLS للـ database",
    "f6:T": "TLS للـ database",
    "f6:I": "TLS للـ database",
  },
  accepted: {
    "user:R": "المستخدم ممكن ينكر، والـ audit log بيقلّل ده. مقبول.",
    "redis:I": "شبكة داخلية + AUTH. هنراجعها Q3.",
  },
};

المخرجات

$ node main.js; echo "exit code: $?"
❌  9 f3:D      Denial of service       api → pg (SQL queries)             
✅  9 f3:I      Information disclosure  api → pg (SQL queries)             TLS للـ database
✅  9 f3:T      Tampering               api → pg (SQL queries)             TLS للـ database + parameterized queries
❌  9 f6:D      Denial of service       worker → pg (تحديث الـ payments)   
✅  9 f6:I      Information disclosure  worker → pg (تحديث الـ payments)   TLS للـ database
✅  9 f6:T      Tampering               worker → pg (تحديث الـ payments)   TLS للـ database
✅  6 f1:D      Denial of service       user → api (login و API calls)     rate limit + body size limit + timeouts
✅  6 f1:I      Information disclosure  user → api (login و API calls)     TLS + cookies Secure/HttpOnly
✅  6 f1:T      Tampering               user → api (login و API calls)     TLS 1.3 + HSTS (درس الـ headers)
✅  6 f2:D      Denial of service       stripe → api (payment webhooks)    rate limit + queue بدل الشغل جُوّه الـ r
✅  6 f2:I      Information disclosure  stripe → api (payment webhooks)    TLS
✅  6 f2:T      Tampering               stripe → api (payment webhooks)    HMAC signature على الـ body (درس 
…

وهنا الفايدة الحقيقية. لسه فيه تسعة blockers، وكلهم حاجات نسيناها فعلًا: الـ flows لـ Redis كلها مفتوحة: الـ sessions والـ jobs رايحين من غير TLS ولا ACL. مفيش DoS protection على الـ connections لـ Postgres. و stripe R: لو Stripe قال إنه بعت webhook واحنا قلنا ما وصلش، مش هنعرف نأكّد حاجة، لأننا مش بنخزّن الـ webhooks. نضيف التسعة. ونشغّل.

model.js
// model.js: الـ system بتاعنا كـ Data Flow Diagram: مين بيكلّم مين، وفين حدود الثقة
export const model = {
  name: "Baassma API",
  zones: { internet: "الإنترنت (مش موثوق)", app: "الـ app servers", data: "الـ databases" },
  elements: [
    { id: "user", type: "external", name: "متصفح المستخدم", zone: "internet" },
    { id: "stripe", type: "external", name: "Stripe webhooks", zone: "internet" },
    { id: "api", type: "process", name: "Express API", zone: "app" },
    { id: "worker", type: "process", name: "BullMQ worker", zone: "app" },
    { id: "pg", type: "store", name: "Postgres", zone: "data", data: ["pii", "payments"] },
    { id: "redis", type: "store", name: "Redis (sessions + queue)", zone: "data", data: ["sessions"] },
  ],
  flows: [
    { id: "f1", from: "user", to: "api", what: "login و API calls" },
    { id: "f2", from: "stripe", to: "api", what: "payment webhooks" },
    { id: "f3", from: "api", to: "pg", what: "SQL queries" },
    { id: "f4", from: "api", to: "redis", what: "sessions و jobs" },
    { id: "f5", from: "redis", to: "worker", what: "jobs" },
    { id: "f6", from: "worker", to: "pg", what: "تحديث الـ payments" },
  ],
  // key = "<id>:<حرف STRIDE>"
  mitigations: {
    "f1:T": "TLS 1.3 + HSTS (درس الـ headers)",
    "f1:I": "TLS + cookies Secure/HttpOnly",
    "f1:D": "rate limit + body size limit + timeouts",
    "f2:T": "HMAC signature على الـ body (درس الـ webhooks)",
    "f2:I": "TLS",
    "f2:D": "rate limit + queue بدل الشغل جُوّه الـ request",
    "api:S": "sessions + MFA + passkeys",
    "api:T": "zod validation + parameterized SQL",
    "api:R": "audit log لكل عملية حساسة",
    "api:I": "errors عامة + ما نرجّعش stack traces",
    "api:D": "event loop monitoring + bulkheads",
    "api:E": "ownership checks + policy واحدة (RBAC/ABAC)",
    "stripe:S": "التوقيع + timestamp ضد الـ replay",
    "user:S": "MFA + lockout",
    "pg:T": "least privilege role + backups",
    "pg:I": "encryption at rest + RLS + الـ PII في columns متشفّرة",
    "pg:D": "connection pool limits + statement_timeout",
    "f3:T": "TLS للـ database + parameterized queries",
    "f3:I": "TLS للـ database",
    "f6:T": "TLS للـ database",
    "f6:I": "TLS للـ database",
    "f3:D": "pool max + statement_timeout",
    "f6:D": "pool منفصل للـ worker (bulkhead)",
    "f4:T": "TLS لـ Redis + ACL",
    "f4:I": "TLS لـ Redis + ACL",
    "f4:D": "maxmemory + noeviction للـ queue",
    "f5:T": "TLS لـ Redis + ACL للـ worker",
    "f5:I": "TLS لـ Redis + ACL للـ worker",
    "f5:D": "concurrency limit + dead letter queue",
    "stripe:R": "كل webhook بيتخزن بالـ event id (inbox)",
  },
  accepted: {
    "user:R": "المستخدم ممكن ينكر، والـ audit log بيقلّل ده. مقبول.",
    "redis:I": "شبكة داخلية + AUTH. هنراجعها Q3.",
  },
};

المخرجات

$ node main.js; echo "exit code: $?"
✅  9 f3:D      Denial of service       api → pg (SQL queries)             pool max + statement_timeout
✅  9 f3:I      Information disclosure  api → pg (SQL queries)             TLS للـ database
✅  9 f3:T      Tampering               api → pg (SQL queries)             TLS للـ database + parameterized queries
✅  9 f6:D      Denial of service       worker → pg (تحديث الـ payments)   pool منفصل للـ worker (bulkhead)
✅  9 f6:I      Information disclosure  worker → pg (تحديث الـ payments)   TLS للـ database
✅  9 f6:T      Tampering               worker → pg (تحديث الـ payments)   TLS للـ database
✅  6 f1:D      Denial of service       user → api (login و API calls)     rate limit + body size limit + timeouts
✅  6 f1:I      Information disclosure  user → api (login و API calls)     TLS + cookies Secure/HttpOnly
✅  6 f1:T      Tampering               user → api (login و API calls)     TLS 1.3 + HSTS (درس الـ headers)
✅  6 f2:D      Denial of service       stripe → api (payment webhooks)    rate limit + queue بدل الشغل جُوّه الـ r
✅  6 f2:I      Information disclosure  stripe → api (payment webhooks)    TLS
✅  6 f2:T      Tampering               stripe →
…

الـ gate عدّى. لسه فيه تهديدات مفتوحة بـ risk صغير، زي الـ worker من جُوّه، ودي تبقى backlog. السؤال الرابع: عملنا مهمتنا كويس؟ كل mitigation لازم يبقى ليها test. لو قلنا parameterized SQL، يبقى فيه test بيحاول SQL injection. الـ model يتراجع في كل PR بيغيّر الـ architecture، وده دور الـ gate. والدرس الجاي أول mitigation فيهم: SQL injection، وإزاي الـ parameterization بتقفله من أساسه.

main.js
// main.js: التقرير اللي بيتعمل في كل PR بيغيّر الـ model
import { model } from "./model.js";
import { analyze, gate } from "./stride.js";

const threats = analyze(model);
const icon = { mitigated: "✅", accepted: "🟡", open: "❌" };
for (const t of threats)
  console.log(icon[t.status], String(t.risk).padStart(2), t.key.padEnd(9), t.category.padEnd(23), t.element.slice(0, 34).padEnd(34), t.note.slice(0, 40));

const count = (s) => threats.filter((t) => t.status === s).length;
console.log(`\n${threats.length} تهديد: ${count("mitigated")} متغطي، ${count("accepted")} مقبول، ${count("open")} مفتوح`);
const blockers = gate(threats);
if (blockers.length) {
  console.log(`🚫 ${blockers.length} تهديد عالي مفتوح:`, blockers.map((t) => t.key).join(" "));
  process.exit(1);
}
console.log("الـ gate عدّى");
03 / دروس المسار (122)
  1. 01أهلًا بيك: يعني إيه backend، والكورس ده ماشي إزاي
  2. 02الملفات والفولدرات والـ terminal: تتحرك على جهازك زي المبرمجين
  3. 03Node وأول برنامج: تشغّل وتقرا رسالة الخطأ
  4. 04القيم والمتغيرات والأنواع: const و let و typeof
  5. 05القرارات والتكرار: if و === والـ truthy والـ loops
  6. 06الـ functions: parameters و return والـ arrow functions والـ scope
  7. 07الـ objects والـ arrays: destructuring و spread و map و filter و reduce
  8. 08JSON والنصوص والتواريخ: اللغة اللي الـ backend بيتكلم بيها
  9. 09الـ callbacks والـ closures وأول لمسة async: setTimeout
  10. 10الـ classes والـ errors: throw و try/catch و stack trace
  11. 11git: تحفَظ كل خطوة وترجعلها، وما تسرّبش أسرارك
  12. 12ESM و CommonJS و package exports: Node بيلاقي الـ modules إزاي
  13. 13الـ Promises و async/await: sequential و parallel والأخطاء والإلغاء
  14. 14الـ event loop والـ microtasks: Node بيعمل كل حاجة بـ thread واحد إزاي
  15. 15الـ Streams والـ Backpressure: ملفات أكبر من الـ memory
  16. 16الـ File System والـ paths: قراية وكتابة صح، ومن غير path traversal
  17. 17الـ Buffers والبيانات الـ binary: الـ bytes من جُوّه
  18. 18Crypto APIs والأسرار: random و hash و HMAC و AES-GCM
  19. 19الـ Worker Threads: شغل CPU تقيل من غير ما توقف الـ server
  20. 20الـ Errors على مستوى الـ process: operational و programmer و crash-only
  21. 21الـ Node test runner والـ debugging: tests من غير مكتبات
  22. 22HTTP من جُوّه: الـ methods والـ status codes والـ headers
  23. 23Express والـ Routing: الـ params والـ query والترتيب والـ Router
  24. 24Express 5: إيه اللي اتغيّر، وإزاي تنقل مشروع قديم
  25. 25الـ Middleware ودورة حياة الـ request جُوّه Express
  26. 26Validation للمدخلات بـ Zod: ما تصدّقش أي حاجة جاية من برة
  27. 27تصنيف الأخطاء و Problem Details: شكل واحد لكل الـ errors
  28. 28الـ CORS والـ Cookies: المتصفح بيحمي المستخدم إزاي
  29. 29رفع الملفات وحدود الحجم: multer من غير ثغرات
  30. 30الـ Realtime: Server-Sent Events و WebSockets
  31. 31OpenAPI والـ API Versioning: عقد مكتوب، وتغيير من غير ما تكسر حد
  32. 32PostgreSQL: الـ DDL وأنواع البيانات الصح لكل عمود
  33. 33الـ Constraints: PK و FK و UNIQUE و CHECK — الـ database بتحمي نفسها
  34. 34الـ Normalization والـ ERD: تقسّم البيانات صح من أول يوم
  35. 35الـ JOINs والتجميع: INNER و LEFT و GROUP BY و HAVING و window functions
  36. 36JSONB في PostgreSQL: إمتى تستخدمه، وإزاي تسأله وتعمله index
  37. 37الـ Indexes من جُوّه: B-tree و GIN و BRIN
  38. 38Partial و Covering indexes: indexes أصغر وأسرع
  39. 39الـ Pagination بالـ Keyset: ليه OFFSET بيبطّأ وبيكرر
  40. 40Full Text Search في Postgres: بحث بالكلمات، بالعربي والإنجليزي
  41. 41EXPLAIN ANALYZE والـ Planner: اقرا الـ plan وصلّح الـ query
  42. 42الـ Transactions بـ node-postgres: كله أو ولا حاجة
  43. 43الـ MVCC ومستويات الـ Isolation: transactions كتير في نفس الوقت
  44. 44الـ Locks والـ Deadlocks: مين مستني مين
  45. 45SKIP LOCKED و Job Leasing: Postgres كـ job queue
  46. 46Row Level Security والـ Multi-tenancy: كل عميل يشوف بياناته بس
  47. 47Migrations من غير downtime: expand و backfill و contract
  48. 48الـ Replication والـ Read Replicas: نسخ حية من الـ database
  49. 49الـ Connection Pooling و PgBouncer: connections أقل، requests أكتر
  50. 50الـ Partitioning والـ VACUUM والمراقبة: Postgres على المدى الطويل
  51. 51Redis وأنواع البيانات: strings و hashes و lists و sets و sorted sets
  52. 52Cache-aside والـ TTL: Redis قدام الـ database
  53. 53الـ Cache invalidation والـ Stampede: لما الـ key الشهير يموت
  54. 54Lua والـ Atomicity في Redis: كام أمر كأنهم أمر واحد
  55. 55الـ Rate Limiting في Redis: fixed window و sliding window و token bucket
  56. 56الـ Sessions في Redis: تسجيل دخول تقدر تلغيه في أي وقت
  57. 57Redis Streams والـ Consumer Groups: log بيتوزع على workers
  58. 58Pub/Sub و BullMQ: إشارات بين الـ instances، وطوابير شغل محترمة
  59. 59Redis لما يقع: الـ persistence (RDB و AOF) والـ replication
  60. 60Redis في الإنتاج: الـ ACLs والـ Cluster والمراقبة
  61. 61تخزين الـ Passwords بـ Argon2id: صح من أول مرة
  62. 62Session Fixation والـ Rotation: id جديد مع كل صلاحية جديدة
  63. 63الـ Cookie Flags والـ CSRF: المتصفح بيبعت الـ cookie، فلازم تتأكد مين اللي طلب
  64. 64الـ XSS والـ Content Security Policy: ما تخليش النص يتحوّل لـ code
  65. 65الـ OAuth و OpenID Connect و PKCE: login بـ Google من غير ما تشوف الـ password
  66. 66التأكد من الـ JWT صح: التوقيع والـ claims والـ scopes
  67. 67الـ BOLA و BFLA: الـ token السليم مش معناه إن الطلب مسموح
  68. 68الـ RBAC و ABAC والملكية: policy واحدة بدل ifs متفرقة
  69. 69الـ MFA والـ recovery: التاني factor اللي بجد
  70. 70الـ Passkeys و WebAuthn: login من غير password وضد الـ phishing
  71. 71الـ Threat Modeling بـ STRIDE: فكّر زي المهاجم قبل ما تكتب codeانت هنا
  72. 72الـ SQL Injection والـ Parameterization: الـ data ما تبقاش code
  73. 73الـ SSRF والـ Egress: ما تخليش الـ server بتاعك يزور الشبكة الداخلية
  74. 74الـ Security Headers والـ TLS: كل response يقول للـ browser يحمي المستخدم إزاي
  75. 75توقيع الـ Webhooks والـ Replay: الـ webhook ده جاي فعلًا من Stripe؟
  76. 76تغيير الأسرار والـ HMAC: إزاي تغيّر مفتاح من غير ما كل حاجة تقع
  77. 77سلسلة التوريد والـ SBOM: إنت واثق في ألف package ما تعرفهمش؟
  78. 78الـ Audit والـ Privacy Logs: سجّل مين عمل إيه، من غير ما تسجّل الأسرار
  79. 79اختبار الأمان و OWASP ASVS: الأمن جُوّه الـ CI، مش audit آخر السنة
  80. 80الـ Prototype Pollution والـ Resource DoS: request واحد يخلّي الكل admin أو يوقّع الـ server
  81. 81الـ SLI والـ SLO والـ Error Budget: إمتى تصحّي الـ on-call وإمتى تسيبه نايم
  82. 82الـ Event Loop Delay والـ ELU: لما Node نفسه يتخنق
  83. 83الـ Worker Threads والـ CPU Profiling: الشغل التقيل بره الـ event loop، والوقت راح فين
  84. 84الـ Memory والـ GC والـ Leaks: الـ process اللي بيكبر لحد ما يقع
  85. 85الـ N+1 Queries والـ DataLoader: صفحة واحدة بمِيّتين query
  86. 86الـ HTTP Caching والـ Compression: أسرع request هو اللي ما بيوصلش
  87. 87الـ Load Testing والـ Soak Testing: الـ server بيستحمل قد إيه بجد
  88. 88الـ Concurrency Limits والـ Bulkheads: dependency بطيئة ما توقعش الـ app كله
  89. 89الـ Timeouts والـ Retries والـ Circuit Breakers: إزاي تتعامل مع dependency بطيئة أو واقعة
  90. 90OpenTelemetry والـ Distributed Tracing: الـ request راح فين وضاع وقته فين
  91. 91Docker Layers والـ Build Context: ليه الـ build بياخد دقيقة وفيه الـ .env بتاعك
  92. 92Multi-stage Builds و Non-root: image صغيرة ومن غير root
  93. 93Docker Compose والـ Networks: الـ services بتلاقي بعض إزاي
  94. 94Docker Volumes: الـ data بتتحفَظ فين
  95. 95Healthcheck و Restart و Resource Limits: running مش معناها شغّال
  96. 96BuildKit والـ Build Secrets: الـ token ما يدخلش الـ image
  97. 97Reverse Proxy و TLS: اللي واقف قدام الـ app
  98. 98Multi-arch Images والـ Native Modules: اشتغلت عندي
  99. 99CI/CD و Rollback و Canary: الـ deploy يبقى ممل
  100. 100Kubernetes من الأول: Pods و Deployments و Services و Probes
  101. 101Modular Monolith و DDD: حدود واضحة من غير network
  102. 102Transactional Outbox و Inbox: الـ event ما يضيعش وما يتنفذش مرتين
  103. 103Sagas: عملية واحدة على تلات services من غير transaction واحدة
  104. 104CQRS و Event Sourcing: الـ events هي الحقيقة
  105. 105الـ Queues والـ Brokers: BullMQ و RabbitMQ و Kafka و SQS
  106. 106Realtime على أكتر من instance: Redis pub/sub و presence و resume
  107. 107الـ Object Storage والـ Media: presigned URLs و uploads مباشرة
  108. 108التكامل مع الـ Email والـ Search: retries و webhooks و indexes
  109. 109GraphQL و gRPC في الإنتاج: contracts و DataLoader و limits و deadlines
  110. 110Kafka على أكتر من zone و region: الـ replication والـ ISR والـ acks والـ MirrorMaker والـ failover
  111. 111TypeScript و runtime boundaries: الـ types بتختفي، والـ schemas لأ
  112. 112ORM ولا SQL: query builders و repositories و migrations و transactions
  113. 113الـ Serverless من جُوّه: cold starts و freeze و timeouts و connections
  114. 114الـ Testing Pyramid: unit و integration و e2e على Postgres حقيقية
  115. 115Contract Testing و Property-Based Testing بـ fast-check
  116. 116الـ Payments: idempotency و webhooks و refunds و reconciliation
  117. 117الـ Timezones والـ Internationalization: UTC و DST والـ locales والـ plurals والفلوس
  118. 118الـ Privacy والـ Data Retention: consent و export و erasure و crypto shredding
  119. 119الـ ADRs والـ Feature Flags: القرارات المكتوبة والـ rollout من غير deploy
  120. 120Multi-region active-active: حل الـ conflicts بـ HLC و CRDTs
  121. 121Readiness و Liveness و Startup Probes: الـ pod جاهز ولا عايش؟
  122. 122Incident Runbooks: من الـ alert للـ postmortem