{"id":235,"date":"2026-09-06T00:43:11","date_gmt":"2026-09-05T16:43:11","guid":{"rendered":"https:\/\/www.ziliaochi.cn\/index.php\/2026\/09\/06\/interview-frontend-security-network\/"},"modified":"2026-09-06T00:43:11","modified_gmt":"2026-09-05T16:43:11","slug":"interview-frontend-security-network","status":"publish","type":"post","link":"https:\/\/www.ziliaochi.cn\/index.php\/2026\/09\/06\/interview-frontend-security-network\/","title":{"rendered":"\u524d\u7aef\u5b89\u5168\u4e0e\u7f51\u7edc\u9762\u8bd5 25 \u95ee\uff1aXSS\u3001CSRF\u3001CORS\u3001HTTPS \u4e0e\u9274\u6743"},"content":{"rendered":"<div style=\"font-family:-apple-system,BlinkMacSystemFont,\"Segoe UI\",\"PingFang SC\",\"Hiragino Sans GB\",\"Microsoft YaHei\",sans-serif;font-size:16.5px;line-height:1.9;color:#35435c;letter-spacing:.2px\">\n<div style=\"background:linear-gradient(135deg,#f5f9ff,#eef5ff);border:1px solid #dce8f8;border-left:4px solid #2fb37a;border-radius:12px;padding:16px 20px;margin:0 0 24px;font-size:14.5px;color:#3d5570;line-height:2\"><span style=\"display:inline-block;background:#2fb37a;color:#fff;font-size:12.5px;font-weight:700;padding:3px 10px;border-radius:6px;margin-right:12px;letter-spacing:1px;vertical-align:1px\">\u5173\u952e\u8bcd<\/span>\u524d\u7aef\u9762\u8bd5\u9898\u3001XSS\u3001CSRF\u3001CORS\u3001HTTPS\u3001JWT\u3001\u524d\u7aef\u5b89\u5168<\/div>\n<div style=\"background:#fafbfd;border:1px solid #e8edf5;border-radius:12px;padding:18px 22px;margin:0 0 30px\">\n<div style=\"font-size:13.5px;font-weight:700;color:#8a99ae;letter-spacing:2px;margin-bottom:12px\">\u76ee\u5f55<\/div>\n<ol style=\"margin:0;padding-left:20px\">\n<li style=\"margin:8px 0;font-size:15px;line-height:1.6\"><a href=\"#sec-1\" style=\"color:#42546e;text-decoration:none;border:none\">\u4e00\u3001\u540c\u6e90\u7b56\u7565\uff1a\u6240\u6709\u5b89\u5168\u95ee\u9898\u7684\u8d77\u70b9<\/a><\/li>\n<li style=\"margin:8px 0;font-size:15px;line-height:1.6\"><a href=\"#sec-2\" style=\"color:#42546e;text-decoration:none;border:none\">\u4e8c\u3001XSS\uff1a\u628a\u522b\u4eba\u7684\u811a\u672c\u6267\u884c\u5728\u4f60\u7684\u9875\u9762\u4e0a<\/a><\/li>\n<li style=\"margin:8px 0;font-size:15px;line-height:1.6\"><a href=\"#sec-3\" style=\"color:#42546e;text-decoration:none;border:none\">\u4e09\u3001CSRF\uff1a\u501f\u4f60\u7684\u8eab\u4efd\u53d1\u8bf7\u6c42<\/a><\/li>\n<li style=\"margin:8px 0;font-size:15px;line-height:1.6\"><a href=\"#sec-4\" style=\"color:#42546e;text-decoration:none;border:none\">\u56db\u3001CORS\uff1a\u628a\u8de8\u57df\u8bf4\u6e05\u695a<\/a><\/li>\n<li style=\"margin:8px 0;font-size:15px;line-height:1.6\"><a href=\"#sec-5\" style=\"color:#42546e;text-decoration:none;border:none\">\u4e94\u3001HTTPS \u4e0e\u4f20\u8f93\u5b89\u5168<\/a><\/li>\n<li style=\"margin:8px 0;font-size:15px;line-height:1.6\"><a href=\"#sec-6\" style=\"color:#42546e;text-decoration:none;border:none\">\u516d\u3001\u9274\u6743\u65b9\u6848\u600e\u4e48\u9009<\/a><\/li>\n<li style=\"margin:8px 0;font-size:15px;line-height:1.6\"><a href=\"#sec-7\" style=\"color:#42546e;text-decoration:none;border:none\">\u4e03\u3001HTTP \u7248\u672c\u4e0e\u4f20\u8f93<\/a><\/li>\n<li style=\"margin:8px 0;font-size:15px;line-height:1.6\"><a href=\"#sec-8\" style=\"color:#42546e;text-decoration:none;border:none\">\u516b\u3001\u5c0f\u7ed3<\/a><\/li>\n<\/ol>\n<\/div>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\"><span style=\"font-size:17px;color:#1e2f47\">\u5b89\u5168\u548c\u7f51\u7edc\u662f\u524d\u7aef\u9762\u8bd5\u91cc<strong style=\"color:#0f1c2e;font-weight:600\">\u6700\u5bb9\u6613\u88ab\u4f4e\u4f30\u3001\u4e5f\u6700\u5bb9\u6613\u5931\u5206<\/strong>\u7684\u4e00\u5757\u3002\u539f\u56e0\u662f\u5b83\u6a2a\u8de8\u6d4f\u89c8\u5668\u3001\u534f\u8bae\u3001\u670d\u52a1\u7aef\u4e09\u4e2a\u5c42\u9762\uff0c\u5f88\u591a\u4eba\u53ea\u8bb0\u5f97\u51e0\u4e2a\u540d\u8bcd\u7f29\u5199\uff0c\u4e00\u8ffd\u95ee&#8221;\u90a3\u5177\u4f53\u600e\u4e48\u9632&#8221;\u5c31\u7b54\u4e0d\u4e0a\u6765\u3002<\/p>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">\u672c\u6587\u6309<strong style=\"color:#0f1c2e;font-weight:600\">\u540c\u6e90\u7b56\u7565 \u2192 XSS \u2192 CSRF \u2192 CORS \u2192 HTTPS \u2192 \u9274\u6743 \u2192 \u4f20\u8f93\u534f\u8bae<\/strong>\u4e03\u6bb5\u7ec4\u7ec7\uff0c\u6bcf\u6bb5\u7ed9\u51fa\u53ef\u76f4\u63a5\u53e3\u8ff0\u7684\u7b54\u6848\u6846\u67b6\u3002\u8fd9\u90e8\u5206\u5185\u5bb9\u7a33\u5b9a\uff0c\u4e0d\u968f\u6846\u67b6\u7248\u672c\u53d8\u52a8\uff0c\u6027\u4ef7\u6bd4\u5f88\u9ad8\u3002<\/p>\n<figure style=\"margin:30px 0;text-align:center\"><img loading=\"lazy\" decoding=\"async\" width=\"1200\" height=\"900\" src=\"https:\/\/www.ziliaochi.cn\/wp-content\/uploads\/2026\/09\/interview-frontend-security-network-fig.png\" alt=\"\u5b89\u5168\u4e0e\u7f51\u7edc\u7684\u77e5\u8bc6\u94fe\u6761\" class=\"wp-image-234\" style=\"max-width:100%;height:auto;border-radius:12px;border:1px solid #e6ecf4;box-shadow:0 8px 24px rgba(15,30,60,.07)\" srcset=\"https:\/\/www.ziliaochi.cn\/wp-content\/uploads\/2026\/09\/interview-frontend-security-network-fig.png 1200w, https:\/\/www.ziliaochi.cn\/wp-content\/uploads\/2026\/09\/interview-frontend-security-network-fig-300x225.png 300w, https:\/\/www.ziliaochi.cn\/wp-content\/uploads\/2026\/09\/interview-frontend-security-network-fig-1024x768.png 1024w, https:\/\/www.ziliaochi.cn\/wp-content\/uploads\/2026\/09\/interview-frontend-security-network-fig-768x576.png 768w, https:\/\/www.ziliaochi.cn\/wp-content\/uploads\/2026\/09\/interview-frontend-security-network-fig-800x600.png 800w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/><figcaption style=\"margin-top:12px;font-size:13.5px;color:#7b8aa0;text-align:center;line-height:1.75\">\u524d\u7aef\u5b89\u5168\u77e5\u8bc6\u94fe\uff1a\u540c\u6e90\u7b56\u7565 \u2192 XSS \u2192 CSRF \u2192 CORS \u2192 HTTPS \u2192 \u9274\u6743<\/figcaption><\/figure>\n<h2 style=\"font-size:23px;line-height:1.45;font-weight:700;color:#0f1c2e;margin:46px 0 18px;padding:0 0 12px 14px;border-left:5px solid #2fb37a;border-bottom:1px solid #eef2f7;letter-spacing:.3px\" id=\"sec-1\">\u4e00\u3001\u540c\u6e90\u7b56\u7565\uff1a\u6240\u6709\u5b89\u5168\u95ee\u9898\u7684\u8d77\u70b9<\/h2>\n<h3 style=\"font-size:18.5px;line-height:1.55;font-weight:700;color:#18283e;margin:30px 0 12px;padding-left:12px;border-left:3px solid #2fb37a40\">Q1\uff1a\u4ec0\u4e48\u662f\u540c\u6e90\uff1f\u540c\u6e90\u9650\u5236\u4e86\u4ec0\u4e48\uff1f<\/h3>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\">\u540c\u6e90 = \u534f\u8bae + \u57df\u540d + \u7aef\u53e3 \u4e09\u8005\u5b8c\u5168\u76f8\u540c\u3002<\/strong>\u6ce8\u610f\u7aef\u53e3\u662f\u53c2\u4e0e\u6bd4\u8f83\u7684\uff0c<code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">example.com<\/code> \u548c <code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">example.com:8080<\/code> \u4e0d\u540c\u6e90\u3002<\/p>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">\u540c\u6e90\u7b56\u7565\u9650\u5236\u4e09\u7c7b\u884c\u4e3a\uff1a<\/p>\n<ol style=\"padding-left:26px;margin:16px 0\">\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\">DOM \u8bbf\u95ee<\/strong>\uff1a\u4e0d\u540c\u6e90\u7684 iframe \u4e4b\u95f4\u4e0d\u80fd\u4e92\u76f8\u8bfb DOM\uff08<code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">contentWindow.document<\/code> \u4f1a\u629b\u9519\uff09\u3002<\/li>\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\">\u6570\u636e\u8bfb\u53d6<\/strong>\uff1a\u4e0d\u80fd\u8bfb\u53d6\u4e0d\u540c\u6e90\u4e0b\u7684 Cookie\u3001LocalStorage\u3001IndexedDB\u3002<\/li>\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\">\u7f51\u7edc\u54cd\u5e94<\/strong>\uff1a<code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">XMLHttpRequest<\/code>\/<code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">fetch<\/code> \u53d1\u51fa\u7684\u8de8\u57df\u8bf7\u6c42\uff0c<strong style=\"color:#0f1c2e;font-weight:600\">\u54cd\u5e94\u4f1a\u88ab\u6d4f\u89c8\u5668\u62e6\u622a<\/strong>\uff08\u8bf7\u6c42\u5b9e\u9645\u5df2\u53d1\u51fa\u3001\u670d\u52a1\u7aef\u4e5f\u6536\u5230\u4e86\uff0c\u53ea\u662f\u62ff\u4e0d\u5230\u7ed3\u679c\uff09\u3002<\/li>\n<\/ol>\n<blockquote style=\"margin:24px 0;padding:16px 22px;background:#f7fafd;border-left:4px solid #2fb37a;border-radius:0 10px 10px 0;color:#4a5b73;font-size:15.6px;line-height:1.88\">\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">\u9ad8\u9891\u8ffd\u95ee\uff1a&#8221;\u8de8\u57df\u8bf7\u6c42\u5230\u5e95\u6709\u6ca1\u6709\u53d1\u5230\u670d\u52a1\u5668\uff1f&#8221;\u2014\u2014<strong style=\"color:#0f1c2e;font-weight:600\">\u53d1\u4e86<\/strong>\u3002\u7b80\u5355\u8bf7\u6c42\u4f1a\u5b8c\u6574\u53d1\u51fa\u5e76\u88ab\u670d\u52a1\u7aef\u5904\u7406\uff0c\u53ea\u662f\u54cd\u5e94\u88ab\u6d4f\u89c8\u5668\u6263\u4e0b\uff1b\u975e\u7b80\u5355\u8bf7\u6c42\u4f1a\u5148\u53d1 <code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">OPTIONS<\/code> \u9884\u68c0\uff0c\u9884\u68c0\u4e0d\u901a\u8fc7\u624d\u4e0d\u4f1a\u53d1\u771f\u5b9e\u8bf7\u6c42\u3002\u8fd9\u4e2a\u533a\u522b\u5728\u6392\u67e5&#8221;\u670d\u52a1\u7aef\u65e5\u5fd7\u91cc\u6709\u8bf7\u6c42\u4f46\u524d\u7aef\u62a5\u9519&#8221;\u65f6\u5f88\u5173\u952e\u3002<\/p>\n<\/blockquote>\n<h3 style=\"font-size:18.5px;line-height:1.55;font-weight:700;color:#18283e;margin:30px 0 12px;padding-left:12px;border-left:3px solid #2fb37a40\">Q2\uff1a\u6709\u54ea\u4e9b\u5408\u6cd5\u7684\u8de8\u57df\u65b9\u6848\uff1f<\/h3>\n<ul style=\"padding-left:26px;margin:16px 0\">\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\">CORS<\/strong>\uff1a\u670d\u52a1\u7aef\u5728\u54cd\u5e94\u5934\u91cc\u58f0\u660e\u5141\u8bb8\u7684\u6e90\uff0c\u6807\u51c6\u65b9\u6848\u3002<\/li>\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\">\u53cd\u5411\u4ee3\u7406<\/strong>\uff1a\u5f00\u53d1\u73af\u5883\u7684\u6807\u914d\uff08Vite <code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">server.proxy<\/code>\u3001Nginx\uff09\u3002\u672c\u8d28\u662f\u8ba9\u6d4f\u89c8\u5668\u4ee5\u4e3a\u540c\u6e90\u3002<\/li>\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\">JSONP<\/strong>\uff1a\u5229\u7528 <code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">&lt;script&gt;<\/code> \u4e0d\u53d7\u540c\u6e90\u9650\u5236\uff0c<strong style=\"color:#0f1c2e;font-weight:600\">\u53ea\u652f\u6301 GET\u3001\u5df2\u6dd8\u6c70<\/strong>\uff0c\u77e5\u9053\u539f\u7406\u5373\u53ef\u3002<\/li>\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\">postMessage<\/strong>\uff1aiframe \/ \u5f39\u7a97\u4e4b\u95f4\u8de8\u57df\u901a\u4fe1\u7684\u6807\u51c6 API\u3002<\/li>\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\">WebSocket<\/strong>\uff1a\u672c\u8eab\u4e0d\u53d7\u540c\u6e90\u7b56\u7565\u9650\u5236\uff08\u4f46\u670d\u52a1\u7aef\u5e94\u6821\u9a8c <code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">Origin<\/code>\uff09\u3002<\/li>\n<\/ul>\n<h2 style=\"font-size:23px;line-height:1.45;font-weight:700;color:#0f1c2e;margin:46px 0 18px;padding:0 0 12px 14px;border-left:5px solid #2fb37a;border-bottom:1px solid #eef2f7;letter-spacing:.3px\" id=\"sec-2\">\u4e8c\u3001XSS\uff1a\u628a\u522b\u4eba\u7684\u811a\u672c\u6267\u884c\u5728\u4f60\u7684\u9875\u9762\u4e0a<\/h2>\n<h3 style=\"font-size:18.5px;line-height:1.55;font-weight:700;color:#18283e;margin:30px 0 12px;padding-left:12px;border-left:3px solid #2fb37a40\">Q3\uff1aXSS \u5206\u54ea\u51e0\u7c7b\uff1f<\/h3>\n<table style=\"width:100%;border-collapse:collapse;margin:24px 0;font-size:15px;border:1px solid #e3eaf3;border-radius:10px;overflow:hidden\">\n<thead>\n<tr>\n<th style=\"background:#f2f6fb;color:#12233a;font-weight:700;padding:12px 14px;text-align:left;border-bottom:1px solid #e3eaf3;font-size:15px\">\u7c7b\u578b<\/th>\n<th style=\"background:#f2f6fb;color:#12233a;font-weight:700;padding:12px 14px;text-align:left;border-bottom:1px solid #e3eaf3;font-size:15px\">\u6ce8\u5165\u8def\u5f84<\/th>\n<th style=\"background:#f2f6fb;color:#12233a;font-weight:700;padding:12px 14px;text-align:left;border-bottom:1px solid #e3eaf3;font-size:15px\">\u662f\u5426\u7ecf\u8fc7\u670d\u52a1\u7aef<\/th>\n<th style=\"background:#f2f6fb;color:#12233a;font-weight:700;padding:12px 14px;text-align:left;border-bottom:1px solid #e3eaf3;font-size:15px\">\u5178\u578b\u573a\u666f<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"padding:12px 14px;border-bottom:1px solid #eff4fa;color:#3a4a63;line-height:1.75\">\u5b58\u50a8\u578b<\/td>\n<td style=\"padding:12px 14px;border-bottom:1px solid #eff4fa;color:#3a4a63;line-height:1.75\">\u6076\u610f\u5185\u5bb9\u5b58\u8fdb\u6570\u636e\u5e93<\/td>\n<td style=\"padding:12px 14px;border-bottom:1px solid #eff4fa;color:#3a4a63;line-height:1.75\">\u662f<\/td>\n<td style=\"padding:12px 14px;border-bottom:1px solid #eff4fa;color:#3a4a63;line-height:1.75\">\u8bc4\u8bba\u3001\u6635\u79f0\u3001\u5bcc\u6587\u672c<\/td>\n<\/tr>\n<tr>\n<td style=\"padding:12px 14px;border-bottom:1px solid #eff4fa;color:#3a4a63;line-height:1.75\">\u53cd\u5c04\u578b<\/td>\n<td style=\"padding:12px 14px;border-bottom:1px solid #eff4fa;color:#3a4a63;line-height:1.75\">\u6076\u610f\u5185\u5bb9\u5728 URL \u53c2\u6570\u91cc<\/td>\n<td style=\"padding:12px 14px;border-bottom:1px solid #eff4fa;color:#3a4a63;line-height:1.75\">\u662f\uff08\u539f\u6837\u8fd4\u56de\uff09<\/td>\n<td style=\"padding:12px 14px;border-bottom:1px solid #eff4fa;color:#3a4a63;line-height:1.75\">\u641c\u7d22\u9875\u56de\u663e\u3001\u9519\u8bef\u9875<\/td>\n<\/tr>\n<tr>\n<td style=\"padding:12px 14px;border-bottom:1px solid #eff4fa;color:#3a4a63;line-height:1.75\">DOM \u578b<\/td>\n<td style=\"padding:12px 14px;border-bottom:1px solid #eff4fa;color:#3a4a63;line-height:1.75\">\u524d\u7aef JS \u76f4\u63a5\u628a\u4e0d\u53ef\u4fe1\u6570\u636e\u5199\u8fdb DOM<\/td>\n<td style=\"padding:12px 14px;border-bottom:1px solid #eff4fa;color:#3a4a63;line-height:1.75\">\u5426<\/td>\n<td style=\"padding:12px 14px;border-bottom:1px solid #eff4fa;color:#3a4a63;line-height:1.75\"><code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">innerHTML = location.hash<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3 style=\"font-size:18.5px;line-height:1.55;font-weight:700;color:#18283e;margin:30px 0 12px;padding-left:12px;border-left:3px solid #2fb37a40\">Q4\uff1a\u600e\u4e48\u9632\uff1f\u8bf4\u51fa\u4e09\u5c42\u9632\u7ebf<\/h3>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\">\u7b2c\u4e00\u5c42\uff1a\u8f93\u51fa\u7f16\u7801 \/ \u8f6c\u4e49\u3002<\/strong>\u8fd9\u662f\u6700\u6839\u672c\u7684\u3002\u628a\u7528\u6237\u6570\u636e\u5f53\u6210&#8221;\u6587\u672c&#8221;\u800c\u4e0d\u662f&#8221;HTML&#8221;\u63d2\u5165\uff1a<\/p>\n<pre style=\"background:#0f1a2b;color:#dbe6f5;border-radius:12px;padding:18px 20px;overflow-x:auto;font-size:13.6px;line-height:1.78;margin:22px 0;border:1px solid #1e2c42;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace\"><code style=\"background:none;border:none;color:inherit;padding:0;font-size:inherit;font-family:inherit\">\/\/ \u5371\u9669\uff1a\u628a\u5b57\u7b26\u4e32\u5f53\u4f5c HTML \u89e3\u6790\nel.innerHTML = userInput\ndocument.write(userInput)\n\n\/\/ \u5b89\u5168\uff1a\u4f5c\u4e3a\u7eaf\u6587\u672c\u63d2\u5165\nel.textContent = userInput\n\n\/\/ Vue \/ React \u7684\u63d2\u503c\u9ed8\u8ba4\u5c31\u662f\u5b89\u5168\u7684\n&lt;div&gt;{{ userInput }}&lt;\/div&gt;        \/\/ \u4f1a\u8f6c\u4e49\n&lt;div v-html=\"userInput\"&gt;&lt;\/div&gt;   \/\/ \u5371\u9669\uff0c\u7b49\u540c\u4e8e innerHTML\n&lt;div dangerouslySetInnerHTML={{__html: x}} \/&gt;  \/\/ React \u4e2d\u7684\u5371\u9669\u5199\u6cd5<\/code><\/pre>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\">\u7b2c\u4e8c\u5c42\uff1aCSP\uff08\u5185\u5bb9\u5b89\u5168\u7b56\u7565\uff09\u3002<\/strong>\u901a\u8fc7\u54cd\u5e94\u5934\u9650\u5b9a\u9875\u9762\u80fd\u52a0\u8f7d\u548c\u6267\u884c\u7684\u8d44\u6e90\u6765\u6e90\uff0c\u5373\u4f7f\u53d1\u751f\u4e86\u6ce8\u5165\uff0c\u811a\u672c\u4e5f\u8dd1\u4e0d\u8d77\u6765\uff1a<\/p>\n<pre style=\"background:#0f1a2b;color:#dbe6f5;border-radius:12px;padding:18px 20px;overflow-x:auto;font-size:13.6px;line-height:1.78;margin:22px 0;border:1px solid #1e2c42;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace\"><code style=\"background:none;border:none;color:inherit;padding:0;font-size:inherit;font-family:inherit\">Content-Security-Policy:\n  default-src 'self';\n  script-src 'self' https:\/\/cdn.example.com;\n  object-src 'none';\n  base-uri 'self';\n  frame-ancestors 'none'<\/code><\/pre>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">\u8981\u70b9\uff1a<strong style=\"color:#0f1c2e;font-weight:600\">\u907f\u514d\u7528 <code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">unsafe-inline<\/code> \u548c <code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">unsafe-eval<\/code><\/strong>\uff0c\u5426\u5219 CSP \u5f62\u540c\u865a\u8bbe\u3002\u5b9e\u9645\u843d\u5730\u65f6\u5148\u4e0a <code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">Content-Security-Policy-Report-Only<\/code> \u89c2\u5bdf\u4e00\u6bb5\u65f6\u95f4\u518d\u5207\u6b63\u5f0f\u3002<\/p>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\">\u7b2c\u4e09\u5c42\uff1a\u5bcc\u6587\u672c\u767d\u540d\u5355\u3002<\/strong>\u4e1a\u52a1\u4e0a\u786e\u5b9e\u9700\u8981\u6e32\u67d3 HTML \u65f6\uff08\u6bd4\u5982\u6587\u7ae0\u6b63\u6587\uff09\uff0c\u5fc5\u987b\u7528 DOMPurify \u8fd9\u7c7b\u5e93\u505a\u767d\u540d\u5355\u6e05\u6d17\uff0c<strong style=\"color:#0f1c2e;font-weight:600\">\u4e0d\u8981\u81ea\u5df1\u5199\u6b63\u5219\u8fc7\u6ee4<\/strong>\u2014\u2014\u6b63\u5219\u505a HTML \u8fc7\u6ee4\u51e0\u4e4e\u4e00\u5b9a\u4f1a\u88ab\u7ed5\u8fc7\u3002<\/p>\n<h2 style=\"font-size:23px;line-height:1.45;font-weight:700;color:#0f1c2e;margin:46px 0 18px;padding:0 0 12px 14px;border-left:5px solid #2fb37a;border-bottom:1px solid #eef2f7;letter-spacing:.3px\" id=\"sec-3\">\u4e09\u3001CSRF\uff1a\u501f\u4f60\u7684\u8eab\u4efd\u53d1\u8bf7\u6c42<\/h2>\n<h3 style=\"font-size:18.5px;line-height:1.55;font-weight:700;color:#18283e;margin:30px 0 12px;padding-left:12px;border-left:3px solid #2fb37a40\">Q5\uff1aCSRF \u7684\u539f\u7406\u662f\u4ec0\u4e48\uff1f\u548c XSS \u6709\u4ec0\u4e48\u533a\u522b\uff1f<\/h3>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">\u6838\u5fc3\u533a\u522b\u4e00\u53e5\u8bdd\uff1a<strong style=\"color:#0f1c2e;font-weight:600\">XSS \u662f&#8221;\u5728\u4f60\u7684\u9875\u9762\u91cc\u6267\u884c\u6211\u7684\u811a\u672c&#8221;\uff0cCSRF \u662f&#8221;\u501f\u4f60\u7684 Cookie \u53d1\u6211\u4e0d\u60f3\u53d1\u7684\u8bf7\u6c42&#8221;\u3002<\/strong><\/p>\n<ul style=\"padding-left:26px;margin:16px 0\">\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\">XSS \u5229\u7528\u4e86<strong style=\"color:#0f1c2e;font-weight:600\">\u4f60\u5bf9\u7528\u6237\u7684\u4fe1\u4efb<\/strong>\uff08\u7528\u6237\u4fe1\u4efb\u8fd9\u4e2a\u7f51\u7ad9\uff09\u3002<\/li>\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\">CSRF \u5229\u7528\u4e86<strong style=\"color:#0f1c2e;font-weight:600\">\u7f51\u7ad9\u5bf9\u7528\u6237\u6d4f\u89c8\u5668\u7684\u4fe1\u4efb<\/strong>\uff08\u670d\u52a1\u7aef\u770b\u5230 Cookie \u5c31\u8ba4\u4e3a\u662f\u672c\u4eba\uff09\u3002<\/li>\n<\/ul>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">\u653b\u51fb\u6d41\u7a0b\uff1a\u7528\u6237\u767b\u5f55\u4e86\u94f6\u884c\u7ad9\u70b9 A\uff0cCookie \u8fd8\u5728\uff1b\u7136\u540e\u8bbf\u95ee\u4e86\u6076\u610f\u7ad9\u70b9 B\uff0cB \u7684\u9875\u9762\u91cc\u6709\u4e00\u4e2a\u81ea\u52a8\u63d0\u4ea4\u7684\u8868\u5355\u6216 <code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">&lt;img src=\"https:\/\/a.com\/transfer?to=evil&amp;amount=1000\"&gt;<\/code>\uff1b\u6d4f\u89c8\u5668\u53d1\u8bf7\u6c42\u65f6<strong style=\"color:#0f1c2e;font-weight:600\">\u4f1a\u81ea\u52a8\u5e26\u4e0a A \u7684 Cookie<\/strong>\uff0c\u4e8e\u662f\u8f6c\u8d26\u6210\u529f\u3002<\/p>\n<h3 style=\"font-size:18.5px;line-height:1.55;font-weight:700;color:#18283e;margin:30px 0 12px;padding-left:12px;border-left:3px solid #2fb37a40\">Q6\uff1aCSRF \u600e\u4e48\u9632\uff1f<\/h3>\n<ol style=\"padding-left:26px;margin:16px 0\">\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\">SameSite Cookie\uff08\u9996\u9009\uff0c\u6700\u7701\u4e8b\uff09<\/strong>\uff1a\u7ed9 Cookie \u52a0 <code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">SameSite=Lax<\/code>\uff08\u6216 <code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">Strict<\/code>\uff09\uff0c\u6d4f\u89c8\u5668\u5c31\u4e0d\u4f1a\u5728\u8de8\u7ad9\u8bf7\u6c42\u91cc\u81ea\u52a8\u5e26\u4e0a\u5b83\u3002<\/li>\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\">CSRF Token<\/strong>\uff1a\u670d\u52a1\u7aef\u4e0b\u53d1\u4e00\u4e2a\u968f\u673a token \u57cb\u5728\u9875\u9762\u91cc\uff0c\u8bf7\u6c42\u65f6\u5e26\u4e0a\uff0c\u670d\u52a1\u7aef\u6821\u9a8c\u3002<strong style=\"color:#0f1c2e;font-weight:600\">\u653b\u51fb\u8005\u62ff\u4e0d\u5230\u8fd9\u4e2a token<\/strong>\uff0c\u56e0\u4e3a\u5b83\u5728\u522b\u7684\u57df\u4e0b\u8bfb\u4e0d\u5230\u4f60\u7684\u9875\u9762\u5185\u5bb9\u3002<\/li>\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\">\u6821\u9a8c Origin \/ Referer<\/strong>\uff1a\u670d\u52a1\u7aef\u68c0\u67e5\u8bf7\u6c42\u6765\u6e90\u662f\u5426\u5728\u767d\u540d\u5355\u5185\u3002\u4f5c\u4e3a\u8f85\u52a9\u624b\u6bb5\uff0c\u522b\u5355\u72ec\u4f9d\u8d56\uff08Referer \u53ef\u80fd\u88ab\u9690\u79c1\u7b56\u7565\u5265\u79bb\uff09\u3002<\/li>\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\">\u5173\u952e\u64cd\u4f5c\u4e8c\u6b21\u786e\u8ba4<\/strong>\uff1a\u77ed\u4fe1\u9a8c\u8bc1\u7801\u3001\u5bc6\u7801\u786e\u8ba4\u3001\u4eba\u673a\u9a8c\u8bc1\u3002<\/li>\n<\/ol>\n<pre style=\"background:#0f1a2b;color:#dbe6f5;border-radius:12px;padding:18px 20px;overflow-x:auto;font-size:13.6px;line-height:1.78;margin:22px 0;border:1px solid #1e2c42;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace\"><code style=\"background:none;border:none;color:inherit;padding:0;font-size:inherit;font-family:inherit\">Set-Cookie: session=xxx; HttpOnly; Secure; SameSite=Lax; Path=\/<\/code><\/pre>\n<blockquote style=\"margin:24px 0;padding:16px 22px;background:#f7fafd;border-left:4px solid #2fb37a;border-radius:0 10px 10px 0;color:#4a5b73;font-size:15.6px;line-height:1.88\">\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">\u9762\u8bd5\u9ad8\u9891\u8ffd\u95ee\uff1a&#8221;<strong style=\"color:#0f1c2e;font-weight:600\">\u7528\u4e86 Token \u5b58 LocalStorage \u662f\u4e0d\u662f\u5c31\u6ca1\u6709 CSRF \u95ee\u9898\u4e86\uff1f<\/strong>&#8220;\u2014\u2014\u662f\u7684\uff0cCSRF \u7684\u524d\u63d0\u662f\u6d4f\u89c8\u5668\u81ea\u52a8\u643a\u5e26\u51ed\u8bc1\uff0c\u624b\u52a8\u5728 <code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">Authorization<\/code> \u5934\u91cc\u585e token \u4e0d\u4f1a\u81ea\u52a8\u5e26\u4e0a\uff0c\u56e0\u6b64\u5929\u7136\u514d\u75ab CSRF\u3002<strong style=\"color:#0f1c2e;font-weight:600\">\u4f46\u4ee3\u4ef7\u662f\u5b83\u66b4\u9732\u7ed9\u4e86 JS\uff0cXSS \u4e00\u6253\u5c31\u5168\u6ca1\u4e86\u3002<\/strong>\u8fd9\u662f\u4e24\u4e2a\u98ce\u9669\u4e4b\u95f4\u7684\u53d6\u820d\uff0c\u4e0d\u662f\u767d\u62ff\u3002<\/p>\n<\/blockquote>\n<h2 style=\"font-size:23px;line-height:1.45;font-weight:700;color:#0f1c2e;margin:46px 0 18px;padding:0 0 12px 14px;border-left:5px solid #2fb37a;border-bottom:1px solid #eef2f7;letter-spacing:.3px\" id=\"sec-4\">\u56db\u3001CORS\uff1a\u628a\u8de8\u57df\u8bf4\u6e05\u695a<\/h2>\n<h3 style=\"font-size:18.5px;line-height:1.55;font-weight:700;color:#18283e;margin:30px 0 12px;padding-left:12px;border-left:3px solid #2fb37a40\">Q7\uff1a\u7b80\u5355\u8bf7\u6c42\u548c\u9884\u68c0\u8bf7\u6c42\u7684\u533a\u522b\uff1f<\/h3>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">\u540c\u65f6\u6ee1\u8db3\u4ee5\u4e0b\u6761\u4ef6\u7684\u624d\u662f<strong style=\"color:#0f1c2e;font-weight:600\">\u7b80\u5355\u8bf7\u6c42<\/strong>\uff08\u4e0d\u89e6\u53d1\u9884\u68c0\uff09\uff1a<\/p>\n<ul style=\"padding-left:26px;margin:16px 0\">\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\">\u65b9\u6cd5\u662f <code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">GET<\/code>\u3001<code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">HEAD<\/code>\u3001<code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">POST<\/code> \u4e4b\u4e00<\/li>\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\">\u8bf7\u6c42\u5934\u53ea\u5305\u542b <code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">Accept<\/code>\u3001<code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">Accept-Language<\/code>\u3001<code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">Content-Language<\/code>\u3001<code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">Content-Type<\/code>\uff08\u4e14\u503c\u4ec5\u4e3a <code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">application\/x-www-form-urlencoded<\/code>\u3001<code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">multipart\/form-data<\/code>\u3001<code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">text\/plain<\/code>\uff09\u3001<code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">Range<\/code><\/li>\n<\/ul>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\">\u6240\u4ee5 <code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">Content-Type: application\/json<\/code> \u4f1a\u89e6\u53d1\u9884\u68c0<\/strong>\u2014\u2014\u8fd9\u662f\u5b9e\u9645\u5f00\u53d1\u4e2d\u6700\u5e38\u89c1\u7684&#8221;\u4e3a\u4ec0\u4e48\u591a\u4e86\u4e2a OPTIONS \u8bf7\u6c42&#8221;\u7684\u539f\u56e0\u3002<\/p>\n<h3 style=\"font-size:18.5px;line-height:1.55;font-weight:700;color:#18283e;margin:30px 0 12px;padding-left:12px;border-left:3px solid #2fb37a40\">Q8\uff1a\u5e26 Cookie \u7684\u8de8\u57df\u8bf7\u6c42\u8981\u6ce8\u610f\u4ec0\u4e48\uff1f<\/h3>\n<pre style=\"background:#0f1a2b;color:#dbe6f5;border-radius:12px;padding:18px 20px;overflow-x:auto;font-size:13.6px;line-height:1.78;margin:22px 0;border:1px solid #1e2c42;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace\"><code style=\"background:none;border:none;color:inherit;padding:0;font-size:inherit;font-family:inherit\">\/\/ \u524d\u7aef\nfetch('https:\/\/api.example.com\/data', {\n  credentials: 'include'    \/\/ axios \u5bf9\u5e94 withCredentials: true\n})\n\n\/\/ \u670d\u52a1\u7aef\u54cd\u5e94\u5934\nAccess-Control-Allow-Origin: https:\/\/app.example.com   \/\/ \u4e0d\u80fd\u662f *\nAccess-Control-Allow-Credentials: true\nAccess-Control-Allow-Headers: Content-Type, Authorization\nAccess-Control-Allow-Methods: GET, POST, PUT, DELETE\nAccess-Control-Max-Age: 86400        \/\/ \u9884\u68c0\u7ed3\u679c\u7f13\u5b58 24h\uff0c\u51cf\u5c11 OPTIONS<\/code><\/pre>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">\u4e09\u4e2a\u5fc5\u8003\u70b9\uff1a\u2460 <code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">Allow-Origin<\/code> \u4e0d\u80fd\u662f\u901a\u914d\u7b26 <code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">*<\/code>\uff1b\u2461 \u5fc5\u987b\u5e26 <code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">Allow-Credentials: true<\/code>\uff1b\u2462 \u914d\u5408 <code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">SameSite=None<\/code> \u65f6\uff0cCookie \u5fc5\u987b\u540c\u65f6\u5e26 <code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">Secure<\/code>\uff0c\u4e5f\u5c31\u662f<strong style=\"color:#0f1c2e;font-weight:600\">\u5fc5\u987b\u8d70 HTTPS<\/strong>\u3002<\/p>\n<h2 style=\"font-size:23px;line-height:1.45;font-weight:700;color:#0f1c2e;margin:46px 0 18px;padding:0 0 12px 14px;border-left:5px solid #2fb37a;border-bottom:1px solid #eef2f7;letter-spacing:.3px\" id=\"sec-5\">\u4e94\u3001HTTPS \u4e0e\u4f20\u8f93\u5b89\u5168<\/h2>\n<h3 style=\"font-size:18.5px;line-height:1.55;font-weight:700;color:#18283e;margin:30px 0 12px;padding-left:12px;border-left:3px solid #2fb37a40\">Q9\uff1aHTTPS \u63e1\u624b\u8fc7\u7a0b\u80fd\u8bb2\u4e00\u904d\u5417\uff1f<\/h3>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">\u6293\u4f4f\u4e3b\u7ebf\uff0c\u4e0d\u7528\u80cc\u5230\u6bcf\u4e2a\u5b57\u8282\uff1a<\/p>\n<ol style=\"padding-left:26px;margin:16px 0\">\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\">\u5ba2\u6237\u7aef\u53d1 <code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">ClientHello<\/code>\uff1a\u652f\u6301\u7684 TLS \u7248\u672c\u3001\u5bc6\u7801\u5957\u4ef6\u5217\u8868\u3001\u968f\u673a\u6570\u3002<\/li>\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\">\u670d\u52a1\u7aef\u56de <code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">ServerHello<\/code>\uff1a\u9009\u5b9a\u7684\u5957\u4ef6\u3001\u968f\u673a\u6570\u3001<strong style=\"color:#0f1c2e;font-weight:600\">\u6570\u5b57\u8bc1\u4e66<\/strong>\u3002<\/li>\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\">\u5ba2\u6237\u7aef<strong style=\"color:#0f1c2e;font-weight:600\">\u6821\u9a8c\u8bc1\u4e66<\/strong>\uff1a\u662f\u5426\u7531\u53ef\u4fe1 CA \u7b7e\u53d1\u3001\u57df\u540d\u662f\u5426\u5339\u914d\u3001\u662f\u5426\u5728\u6709\u6548\u671f\u5185\u3001\u662f\u5426\u88ab\u540a\u9500\uff08OCSP \/ CRL\uff09\u3002<\/li>\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\">\u5bc6\u94a5\u4ea4\u6362\uff1aTLS 1.3 \u4e0b\u7528 <strong style=\"color:#0f1c2e;font-weight:600\">ECDHE<\/strong> \u4ea4\u6362\u4e34\u65f6\u5bc6\u94a5\uff0c\u53cc\u65b9\u7b97\u51fa\u76f8\u540c\u7684\u4f1a\u8bdd\u5bc6\u94a5\u3002\u56e0\u4e3a\u4e34\u65f6\u5bc6\u94a5\u4e0d\u53c2\u4e0e\u957f\u671f\u5b58\u50a8\uff0c\u6240\u4ee5\u5177\u5907<strong style=\"color:#0f1c2e;font-weight:600\">\u524d\u5411\u5b89\u5168\u6027<\/strong>\u3002<\/li>\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\">\u5207\u6362\u5230\u5bf9\u79f0\u52a0\u5bc6\uff08\u5982 AES-GCM\uff09\u4f20\u8f93\u5e94\u7528\u6570\u636e\u3002<\/li>\n<\/ol>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">\u52a0\u5206\u70b9\uff1a<strong style=\"color:#0f1c2e;font-weight:600\">TLS 1.3 \u628a\u63e1\u624b\u4ece 2-RTT \u538b\u7f29\u5230 1-RTT\uff0c\u4f1a\u8bdd\u590d\u7528\u65f6\u662f 0-RTT<\/strong>\uff0c\u5e76\u4e14\u780d\u6389\u4e86\u4e00\u6279\u4e0d\u5b89\u5168\u7684\u5957\u4ef6\uff08\u9759\u6001 RSA \u5bc6\u94a5\u4ea4\u6362\u3001RC4\u3001SHA-1 \u7b49\uff09\u3002<\/p>\n<h3 style=\"font-size:18.5px;line-height:1.55;font-weight:700;color:#18283e;margin:30px 0 12px;padding-left:12px;border-left:3px solid #2fb37a40\">Q10\uff1a\u4e2d\u95f4\u4eba\u653b\u51fb\u662f\u600e\u4e48\u9632\u4f4f\u7684\uff1f<\/h3>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">\u9760<strong style=\"color:#0f1c2e;font-weight:600\">\u8bc1\u4e66\u94fe + \u7b7e\u540d\u9a8c\u8bc1<\/strong>\u800c\u4e0d\u662f\u52a0\u5bc6\u672c\u8eab\u3002\u4e2d\u95f4\u4eba\u786e\u5b9e\u53ef\u4ee5\u62e6\u4e0b\u6d41\u91cf\u3001\u4f2a\u9020\u4e00\u4e2a\u8bc1\u4e66\uff0c\u4f46<strong style=\"color:#0f1c2e;font-weight:600\">\u4ed6\u62ff\u4e0d\u5230\u53d7\u4fe1\u4efb CA \u7684\u79c1\u94a5\uff0c\u7b7e\u4e0d\u51fa\u80fd\u901a\u8fc7\u6d4f\u89c8\u5668\u6821\u9a8c\u7684\u8bc1\u4e66<\/strong>\u3002\u6d4f\u89c8\u5668\u5185\u7f6e\u4e86\u6839 CA \u5217\u8868\uff0c\u9010\u7ea7\u9a8c\u8bc1\u7b7e\u540d\uff0c\u4efb\u4f55\u4e00\u7ea7\u5bf9\u4e0d\u4e0a\u5c31\u62e6\u4e0b\u6765\u3002<\/p>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">\u8fd9\u4e5f\u662f\u4e3a\u4ec0\u4e48<strong style=\"color:#0f1c2e;font-weight:600\">\u516c\u53f8\u6293\u5305\u5de5\u5177\u9700\u8981\u4f60\u624b\u52a8\u5b89\u88c5\u5e76\u4fe1\u4efb\u5b83\u7684\u6839\u8bc1\u4e66<\/strong>\u2014\u2014\u4e00\u65e6\u4f60\u4fe1\u4efb\u4e86\uff0c\u5b83\u5c31\u80fd\u7b7e\u51fa\u5408\u6cd5\u8bc1\u4e66\uff0cHTTPS \u7684\u9632\u62a4\u5c31\u88ab\u4f60\u4e3b\u52a8\u7ed5\u8fc7\u4e86\u3002<\/p>\n<h3 style=\"font-size:18.5px;line-height:1.55;font-weight:700;color:#18283e;margin:30px 0 12px;padding-left:12px;border-left:3px solid #2fb37a40\">Q11\uff1aCookie \u7684\u56db\u4e2a\u5b89\u5168\u5c5e\u6027\u5206\u522b\u7ba1\u4ec0\u4e48\uff1f<\/h3>\n<ul style=\"padding-left:26px;margin:16px 0\">\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\"><code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">Secure<\/code><\/strong>\uff1a\u53ea\u5728 HTTPS \u4e0b\u53d1\u9001\u3002<\/li>\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\"><code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">HttpOnly<\/code><\/strong>\uff1a<strong style=\"color:#0f1c2e;font-weight:600\">\u7981\u6b62 JS \u8bfb\u53d6<\/strong>\uff08<code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">document.cookie<\/code> \u62ff\u4e0d\u5230\uff09\uff0c\u662f\u9632 XSS \u7a83\u53d6\u4f1a\u8bdd\u7684\u5173\u952e\u3002<\/li>\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\"><code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">SameSite<\/code><\/strong>\uff1a<code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">Strict<\/code> \u5b8c\u5168\u7981\u6b62\u8de8\u7ad9\u643a\u5e26\uff1b<code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">Lax<\/code> \u5141\u8bb8\u5bfc\u822a\u7c7b GET \u8bf7\u6c42\u643a\u5e26\uff08\u5f53\u524d\u4e3b\u6d41\u9ed8\u8ba4\u503c\uff09\uff1b<code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">None<\/code> \u5141\u8bb8\u8de8\u7ad9\u643a\u5e26\uff08\u9700\u914d\u5408 <code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">Secure<\/code>\uff09\u3002<\/li>\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\"><code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">__Host-<\/code> \u524d\u7f00<\/strong>\uff1a\u5f3a\u5236\u8be5 Cookie \u5fc5\u987b <code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">Secure<\/code>\u3001<code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">Path=\/<\/code>\u3001\u4e0d\u5e26 Domain\uff0c\u9632\u6b62\u5b50\u57df\u8986\u76d6\u3002<\/li>\n<\/ul>\n<h2 style=\"font-size:23px;line-height:1.45;font-weight:700;color:#0f1c2e;margin:46px 0 18px;padding:0 0 12px 14px;border-left:5px solid #2fb37a;border-bottom:1px solid #eef2f7;letter-spacing:.3px\" id=\"sec-6\">\u516d\u3001\u9274\u6743\u65b9\u6848\u600e\u4e48\u9009<\/h2>\n<h3 style=\"font-size:18.5px;line-height:1.55;font-weight:700;color:#18283e;margin:30px 0 12px;padding-left:12px;border-left:3px solid #2fb37a40\">Q12\uff1aSession-Cookie \u548c JWT \u5404\u81ea\u7684\u53d6\u820d\uff1f<\/h3>\n<table style=\"width:100%;border-collapse:collapse;margin:24px 0;font-size:15px;border:1px solid #e3eaf3;border-radius:10px;overflow:hidden\">\n<thead>\n<tr>\n<th style=\"background:#f2f6fb;color:#12233a;font-weight:700;padding:12px 14px;text-align:left;border-bottom:1px solid #e3eaf3;font-size:15px\">\u7ef4\u5ea6<\/th>\n<th style=\"background:#f2f6fb;color:#12233a;font-weight:700;padding:12px 14px;text-align:left;border-bottom:1px solid #e3eaf3;font-size:15px\">Session + Cookie<\/th>\n<th style=\"background:#f2f6fb;color:#12233a;font-weight:700;padding:12px 14px;text-align:left;border-bottom:1px solid #e3eaf3;font-size:15px\">JWT<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"padding:12px 14px;border-bottom:1px solid #eff4fa;color:#3a4a63;line-height:1.75\">\u72b6\u6001\u5b58\u50a8<\/td>\n<td style=\"padding:12px 14px;border-bottom:1px solid #eff4fa;color:#3a4a63;line-height:1.75\">\u670d\u52a1\u7aef\u5b58\uff08Redis \u7b49\uff09<\/td>\n<td style=\"padding:12px 14px;border-bottom:1px solid #eff4fa;color:#3a4a63;line-height:1.75\">\u65e0\u72b6\u6001\uff0c\u670d\u52a1\u7aef\u4e0d\u5b58<\/td>\n<\/tr>\n<tr>\n<td style=\"padding:12px 14px;border-bottom:1px solid #eff4fa;color:#3a4a63;line-height:1.75\">\u6269\u5c55\u6027<\/td>\n<td style=\"padding:12px 14px;border-bottom:1px solid #eff4fa;color:#3a4a63;line-height:1.75\">\u9700\u8981\u5171\u4eab\u5b58\u50a8 \/ \u7c98\u6027\u4f1a\u8bdd<\/td>\n<td style=\"padding:12px 14px;border-bottom:1px solid #eff4fa;color:#3a4a63;line-height:1.75\">\u5929\u7136\u9002\u5408\u591a\u8282\u70b9<\/td>\n<\/tr>\n<tr>\n<td style=\"padding:12px 14px;border-bottom:1px solid #eff4fa;color:#3a4a63;line-height:1.75\">\u4e3b\u52a8\u5931\u6548<\/td>\n<td style=\"padding:12px 14px;border-bottom:1px solid #eff4fa;color:#3a4a63;line-height:1.75\">\u5bb9\u6613\uff0c\u5220\u6389 session \u5373\u53ef<\/td>\n<td style=\"padding:12px 14px;border-bottom:1px solid #eff4fa;color:#3a4a63;line-height:1.75\"><strong style=\"color:#0f1c2e;font-weight:600\">\u96be<\/strong>\uff0c\u7b7e\u53d1\u540e\u65e0\u6cd5\u5355\u65b9\u9762\u6536\u56de<\/td>\n<\/tr>\n<tr>\n<td style=\"padding:12px 14px;border-bottom:1px solid #eff4fa;color:#3a4a63;line-height:1.75\">\u8f7d\u8377\u5927\u5c0f<\/td>\n<td style=\"padding:12px 14px;border-bottom:1px solid #eff4fa;color:#3a4a63;line-height:1.75\">\u53ea\u6709\u4e00\u4e2a sessionId<\/td>\n<td style=\"padding:12px 14px;border-bottom:1px solid #eff4fa;color:#3a4a63;line-height:1.75\">\u6bcf\u6b21\u8bf7\u6c42\u90fd\u5e26\u4e0a\u5b8c\u6574\u8f7d\u8377<\/td>\n<\/tr>\n<tr>\n<td style=\"padding:12px 14px;border-bottom:1px solid #eff4fa;color:#3a4a63;line-height:1.75\">\u9002\u5408\u7684\u573a\u666f<\/td>\n<td style=\"padding:12px 14px;border-bottom:1px solid #eff4fa;color:#3a4a63;line-height:1.75\">\u9700\u8981\u5373\u65f6\u8e22\u4eba\u3001\u6743\u9650\u53d8\u66f4\u9891\u7e41<\/td>\n<td style=\"padding:12px 14px;border-bottom:1px solid #eff4fa;color:#3a4a63;line-height:1.75\">\u77ed\u65f6\u6548\u3001\u8de8\u57df\u8c03\u7528\u3001\u4e00\u6b21\u6027\u4ee4\u724c<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">\u5173\u952e\u5224\u65ad\u53e5\uff1a<strong style=\"color:#0f1c2e;font-weight:600\">JWT \u7684&#8221;\u65e0\u72b6\u6001&#8221;\u65e2\u662f\u4f18\u70b9\u4e5f\u662f\u4ee3\u4ef7<\/strong>\u2014\u2014\u5b83\u6362\u6765\u7684\u6269\u5c55\u6027\uff0c\u662f\u4ee5&#8221;\u65e0\u6cd5\u4e3b\u52a8\u5931\u6548&#8221;\u4e3a\u4ee3\u4ef7\u7684\u3002\u5b9e\u8df5\u4e2d\u5e38\u7528\u7684\u6298\u4e2d\u662f<strong style=\"color:#0f1c2e;font-weight:600\">\u77ed\u65f6\u6548 Access Token + \u53ef\u5237\u65b0\u7684 Refresh Token<\/strong>\uff0c\u5e76\u5728\u670d\u52a1\u7aef\u7ef4\u62a4\u4e00\u4efd\u8f7b\u91cf\u7684\u9ed1\u540d\u5355\u6765\u515c\u5e95\u3002<\/p>\n<h3 style=\"font-size:18.5px;line-height:1.55;font-weight:700;color:#18283e;margin:30px 0 12px;padding-left:12px;border-left:3px solid #2fb37a40\">Q13\uff1aJWT \u5b58\u5728\u54ea\u91cc\uff1f<\/h3>\n<ul style=\"padding-left:26px;margin:16px 0\">\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\">localStorage<\/strong>\uff1a\u65b9\u4fbf\uff0c\u4f46 XSS \u53ef\u76f4\u63a5\u8bfb\u53d6\u3002<strong style=\"color:#0f1c2e;font-weight:600\">\u4e0d\u63a8\u8350\u653e\u957f\u671f\u51ed\u8bc1\u3002<\/strong><\/li>\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\">Cookie\uff08HttpOnly + Secure + SameSite\uff09<\/strong>\uff1aJS \u8bfb\u4e0d\u5230\uff0cXSS \u62ff\u4e0d\u8d70\uff0c\u4f46\u9700\u8981\u9632 CSRF\u3002<strong style=\"color:#0f1c2e;font-weight:600\">\u751f\u4ea7\u73af\u5883\u66f4\u7a33\u7684\u9009\u62e9\u3002<\/strong><\/li>\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\">\u5185\u5b58\uff08\u53d8\u91cf \/ \u72b6\u6001\u7ba1\u7406\uff09<\/strong>\uff1a\u6700\u5b89\u5168\uff0c\u5237\u65b0\u5373\u5931\u6548\uff0c\u914d\u5408 Refresh Token \u4f7f\u7528\u3002<\/li>\n<\/ul>\n<blockquote style=\"margin:24px 0;padding:16px 22px;background:#f7fafd;border-left:4px solid #2fb37a;border-radius:0 10px 10px 0;color:#4a5b73;font-size:15.6px;line-height:1.88\">\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">\u9ad8\u5206\u7b54\u6cd5\uff1a<strong style=\"color:#0f1c2e;font-weight:600\">\u6ca1\u6709\u94f6\u5f39\uff0c\u53ea\u6709\u53d6\u820d\u3002<\/strong>Cookie \u65b9\u6848\u6015 CSRF\uff08\u53ef\u7528 SameSite \u7f13\u89e3\uff09\uff0clocalStorage \u65b9\u6848\u6015 XSS\uff08\u65e0\u89e3\uff0c\u53ea\u80fd\u9760 CSP \u548c\u8f93\u51fa\u7f16\u7801\u53bb\u964d\u4f4e XSS \u53d1\u751f\u7684\u6982\u7387\uff09\u3002\u6240\u4ee5\u95ee\u9898\u7684\u843d\u70b9\u662f&#8221;<strong style=\"color:#0f1c2e;font-weight:600\">\u4f60\u66f4\u6015\u54ea\u4e00\u4e2a\uff0c\u4ee5\u53ca\u4f60\u7684 XSS \u9632\u7ebf\u6709\u591a\u539a<\/strong>&#8220;\u3002<\/p>\n<\/blockquote>\n<h2 style=\"font-size:23px;line-height:1.45;font-weight:700;color:#0f1c2e;margin:46px 0 18px;padding:0 0 12px 14px;border-left:5px solid #2fb37a;border-bottom:1px solid #eef2f7;letter-spacing:.3px\" id=\"sec-7\">\u4e03\u3001HTTP \u7248\u672c\u4e0e\u4f20\u8f93<\/h2>\n<h3 style=\"font-size:18.5px;line-height:1.55;font-weight:700;color:#18283e;margin:30px 0 12px;padding-left:12px;border-left:3px solid #2fb37a40\">Q14\uff1aHTTP\/1.1\u30012\u30013 \u7684\u6838\u5fc3\u5dee\u5f02\uff1f<\/h3>\n<ul style=\"padding-left:26px;margin:16px 0\">\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\">HTTP\/1.1<\/strong>\uff1a\u6587\u672c\u534f\u8bae\uff0c\u957f\u8fde\u63a5\uff0c\u4f46\u5b58\u5728<strong style=\"color:#0f1c2e;font-weight:600\">\u961f\u5934\u963b\u585e<\/strong>\uff08\u540c\u4e00\u8fde\u63a5\u4e0a\u8bf7\u6c42\u5fc5\u987b\u6392\u961f\uff09\u3002\u6d4f\u89c8\u5668\u9760\u5f00 6 \u4e2a\u8fde\u63a5\u7f13\u89e3\u3002<\/li>\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\">HTTP\/2<\/strong>\uff1a\u4e8c\u8fdb\u5236\u5206\u5e27 + <strong style=\"color:#0f1c2e;font-weight:600\">\u591a\u8def\u590d\u7528<\/strong>\uff0c\u4e00\u4e2a\u8fde\u63a5\u4e0a\u5e76\u53d1\u591a\u4e2a\u6d41\uff0c\u89e3\u51b3\u4e86\u5e94\u7528\u5c42\u7684\u961f\u5934\u963b\u585e\uff1b\u9644\u5e26 HPACK \u5934\u90e8\u538b\u7f29\u3001\u670d\u52a1\u7aef\u63a8\u9001\uff08\u5b9e\u8df5\u4e2d\u6548\u679c\u4e0d\u4f73\uff0c\u5df2\u57fa\u672c\u5f03\u7528\uff09\u3002<\/li>\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\">HTTP\/3<\/strong>\uff1a\u4f20\u8f93\u5c42\u4ece TCP \u6362\u6210 <strong style=\"color:#0f1c2e;font-weight:600\">QUIC\uff08\u57fa\u4e8e UDP\uff09<\/strong>\uff0c\u89e3\u51b3\u4e86 TCP \u5c42\u7684\u961f\u5934\u963b\u585e\u2014\u2014\u4e22\u5305\u65f6\u4e0d\u518d\u963b\u585e\u6240\u6709\u6d41\uff1b\u63e1\u624b\u5408\u5e76\u8fdb TLS\uff0c\u8fde\u63a5\u5efa\u7acb\u66f4\u5feb\uff1b\u652f\u6301\u8fde\u63a5\u8fc1\u79fb\uff08\u5207\u6362\u7f51\u7edc\u4e0d\u65ad\u7ebf\uff09\u3002<\/li>\n<\/ul>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">\u8ffd\u95ee&#8221;\u90a3 HTTP\/2 \u8fd8\u6709\u961f\u5934\u963b\u585e\u5417&#8221;\u2014\u2014<strong style=\"color:#0f1c2e;font-weight:600\">\u6709<\/strong>\u3002\u5b83\u53ea\u5728\u5e94\u7528\u5c42\u89e3\u51b3\u4e86\uff0cTCP \u5c42\u4e22\u5305\u65f6\uff0c\u6240\u6709\u6d41\u4ecd\u7136\u8981\u7b49\u91cd\u4f20\u3002\u8fd9\u5c31\u662f\u4e3a\u4ec0\u4e48\u9700\u8981 HTTP\/3\u3002<\/p>\n<h3 style=\"font-size:18.5px;line-height:1.55;font-weight:700;color:#18283e;margin:30px 0 12px;padding-left:12px;border-left:3px solid #2fb37a40\">Q15\uff1a\u5f3a\u7f13\u5b58\u548c\u534f\u5546\u7f13\u5b58\u600e\u4e48\u914d\u5408\uff1f<\/h3>\n<pre style=\"background:#0f1a2b;color:#dbe6f5;border-radius:12px;padding:18px 20px;overflow-x:auto;font-size:13.6px;line-height:1.78;margin:22px 0;border:1px solid #1e2c42;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace\"><code style=\"background:none;border:none;color:inherit;padding:0;font-size:inherit;font-family:inherit\">\/\/ \u5f3a\u7f13\u5b58\uff1a\u547d\u4e2d\u5219\u5b8c\u5168\u4e0d\u53d1\u8bf7\u6c42\nCache-Control: max-age=31536000, immutable    \/\/ \u5e26 hash \u7684\u9759\u6001\u8d44\u6e90\nCache-Control: no-cache                        \/\/ \u5141\u8bb8\u7f13\u5b58\u4f46\u6bcf\u6b21\u5fc5\u987b\u6821\u9a8c\n\n\/\/ \u534f\u5546\u7f13\u5b58\uff1a\u53d1\u8bf7\u6c42\u95ee\u670d\u52a1\u7aef\uff0c\u6ca1\u53d8\u5219\u8fd4\u56de 304\nEtag: \"abc123\"           \/\/ \u8bf7\u6c42\u65f6\u5e26 If-None-Match\nLast-Modified: <date>    \/\/ \u8bf7\u6c42\u65f6\u5e26 If-Modified-Since<\/code><\/pre>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">\u6807\u51c6\u7b56\u7565\uff1a<strong style=\"color:#0f1c2e;font-weight:600\">\u5e26\u5185\u5bb9 hash \u7684\u9759\u6001\u8d44\u6e90\u7528 <code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">max-age=1\u5e74, immutable<\/code>\uff1bHTML \u5165\u53e3\u7528 <code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">no-cache<\/code><\/strong>\u3002\u8fd9\u6837\u53d1\u7248\u65f6 HTML \u4f1a\u91cd\u65b0\u6821\u9a8c\uff0c\u4e00\u65e6\u5185\u5bb9\u53d8\u4e86\u5c31\u5f15\u7528\u65b0\u7684 hash \u6587\u4ef6\u540d\uff0c\u65e7\u8d44\u6e90\u81ea\u7136\u5931\u6548\u3002<\/p>\n<h2 style=\"font-size:23px;line-height:1.45;font-weight:700;color:#0f1c2e;margin:46px 0 18px;padding:0 0 12px 14px;border-left:5px solid #2fb37a;border-bottom:1px solid #eef2f7;letter-spacing:.3px\" id=\"sec-8\">\u516b\u3001\u5c0f\u7ed3<\/h2>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">\u8fd9\u4e00\u5757\u7684\u7b54\u9898\u65b9\u6cd5\u8bba\u662f<strong style=\"color:#0f1c2e;font-weight:600\">\u5148\u5206\u5c42\u3001\u518d\u8bb2\u6743\u8861<\/strong>\uff1a\u540c\u6e90\u7b56\u7565\u662f\u5730\u57fa\uff0cXSS \u662f&#8221;\u811a\u672c\u6ce8\u5165&#8221;\u3001CSRF \u662f&#8221;\u51ed\u8bc1\u76d7\u7528&#8221;\uff0c\u4e24\u8005\u9776\u5b50\u4e0d\u540c\uff1bCORS \u662f\u540c\u6e90\u7b56\u7565\u7684<strong style=\"color:#0f1c2e;font-weight:600\">\u6388\u6743\u51fa\u53e3<\/strong>\u800c\u4e0d\u662f\u5b89\u5168\u8fb9\u754c\uff1bHTTPS \u9760\u7684\u662f\u8bc1\u4e66\u4fe1\u4efb\u94fe\uff1b\u9274\u6743\u65b9\u6848\u7684\u6838\u5fc3\u6743\u8861\u5728&#8221;\u72b6\u6001\u653e\u54ea&#8221;\u548c&#8221;\u80fd\u5426\u4e3b\u52a8\u5931\u6548&#8221;\u3002<\/p>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">\u80fd\u628a\u8fd9\u4e94\u53e5\u8bb2\u6e05\u695a\uff0c\u5e76\u4e14\u6bcf\u4e2a\u9632\u62a4\u624b\u6bb5\u90fd\u8bf4\u5f97\u51fa&#8221;\u5b83\u9632\u7684\u662f\u4ec0\u4e48\u3001\u4ee3\u4ef7\u662f\u4ec0\u4e48&#8221;\uff0c\u8fd9\u4e00\u5757\u57fa\u672c\u7a33\u4e86\u3002<\/p>\n<hr style=\"border:none;border-top:1px solid #eaeef4;margin:34px 0\">\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\"><em style=\"color:#5a6b85;font-style:normal;background:#2fb37a1f;padding:1px 4px;border-radius:4px\">\u53c2\u8003\uff1a<a href=\"https:\/\/developer.mozilla.org\/zh-CN\/docs\/Web\/HTTP\/CSP\" target=\"_blank\" rel=\"noopener\" style=\"color:#2fb37a;text-decoration:none;border-bottom:1px solid #2fb37a66;transition:opacity .15s\">MDN \u00b7 CSP<\/a>\u3001<a href=\"https:\/\/developer.mozilla.org\/zh-CN\/docs\/Web\/HTTP\/CORS\" target=\"_blank\" rel=\"noopener\" style=\"color:#2fb37a;text-decoration:none;border-bottom:1px solid #2fb37a66;transition:opacity .15s\">MDN \u00b7 CORS<\/a>\u3001<a href=\"https:\/\/owasp.org\/www-project-top-ten\/\" target=\"_blank\" rel=\"noopener\" style=\"color:#2fb37a;text-decoration:none;border-bottom:1px solid #2fb37a66;transition:opacity .15s\">OWASP Top 10<\/a>\u3002\u5b89\u5168\u5efa\u8bae\u968f\u6807\u51c6\u6f14\u8fdb\uff0c\u843d\u5730\u524d\u8bf7\u4ee5\u5b98\u65b9\u6700\u65b0\u6587\u6863\u4e3a\u51c6\u3002<\/em><\/p>\n<div style=\"margin:42px 0 0;padding:22px 0 0;border-top:1px solid #eaeef4\">\n<div style=\"font-size:13px;color:#93a1b5;letter-spacing:1px;margin-bottom:12px\">\u6807\u7b7e<\/div>\n<p><span style=\"display:inline-block;background:#f3f6fa;border:1px solid #e4eaf2;color:#5b6c85;font-size:13px;padding:5px 12px;border-radius:999px;margin:0 8px 8px 0\">#\u524d\u7aef\u9762\u8bd5\u9898<\/span><span style=\"display:inline-block;background:#f3f6fa;border:1px solid #e4eaf2;color:#5b6c85;font-size:13px;padding:5px 12px;border-radius:999px;margin:0 8px 8px 0\">#\u7f51\u7edc\u5b89\u5168<\/span><span style=\"display:inline-block;background:#f3f6fa;border:1px solid #e4eaf2;color:#5b6c85;font-size:13px;padding:5px 12px;border-radius:999px;margin:0 8px 8px 0\">#HTTPS<\/span><span style=\"display:inline-block;background:#f3f6fa;border:1px solid #e4eaf2;color:#5b6c85;font-size:13px;padding:5px 12px;border-radius:999px;margin:0 8px 8px 0\">#\u9762\u8bd5<\/span><\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u5b89\u5168\u548c\u7f51\u7edc\u662f\u524d\u7aef\u9762\u8bd5\u91cc\u6700\u5bb9\u6613\u88ab\u4f4e\u4f30\u4e5f\u6700\u5bb9\u6613\u5931\u5206\u7684\u4e00\u5757\u3002\u672c\u6587\u6309\u540c\u6e90\u7b56\u7565\u3001XSS\u3001CSRF\u3001CORS\u3001HTTPS\u3001\u9274\u6743\u3001HTTP \u6f14\u8fdb\u4e03\u6bb5\u7ec4\u7ec7\uff0c\u6bcf\u6bb5\u7ed9\u51fa\u53ef\u76f4\u63a5\u53e3\u8ff0\u7684\u7b54\u6848\u6846\u67b6\uff0c\u5e76\u6807\u51fa\u9762\u8bd5\u5b98\u5e38\u6316\u7684\u8ffd\u95ee\u9677\u9631\u3002<\/p>\n","protected":false},"author":1,"featured_media":233,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,11],"tags":[114,64,113,66],"class_list":["post-235","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-frontend-question-bank","category-question-bank","tag-https","tag-64","tag-113","tag-66"],"_links":{"self":[{"href":"https:\/\/www.ziliaochi.cn\/index.php\/wp-json\/wp\/v2\/posts\/235","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ziliaochi.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ziliaochi.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ziliaochi.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ziliaochi.cn\/index.php\/wp-json\/wp\/v2\/comments?post=235"}],"version-history":[{"count":0,"href":"https:\/\/www.ziliaochi.cn\/index.php\/wp-json\/wp\/v2\/posts\/235\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ziliaochi.cn\/index.php\/wp-json\/wp\/v2\/media\/233"}],"wp:attachment":[{"href":"https:\/\/www.ziliaochi.cn\/index.php\/wp-json\/wp\/v2\/media?parent=235"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ziliaochi.cn\/index.php\/wp-json\/wp\/v2\/categories?post=235"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ziliaochi.cn\/index.php\/wp-json\/wp\/v2\/tags?post=235"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}