{"id":332887,"date":"2023-03-17T09:21:27","date_gmt":"2023-03-17T08:21:27","guid":{"rendered":"https:\/\/blog.jetbrains.com\/?post_type=qodana&#038;p=332887"},"modified":"2023-09-04T16:18:02","modified_gmt":"2023-09-04T15:18:02","slug":"secure-your-php-code-with-taint-analysis-by-qodana","status":"publish","type":"qodana","link":"https:\/\/blog.jetbrains.com\/zh-hans\/qodana\/2023\/03\/secure-your-php-code-with-taint-analysis-by-qodana\/","title":{"rendered":"\u901a\u8fc7 Qodana \u7684\u6c61\u70b9\u5206\u6790\u4fdd\u62a4 PHP \u4ee3\u7801"},"content":{"rendered":"\n<p><em>\u672c\u6587\u7531 JetBrains \u7684\u4ee3\u7801\u8d28\u91cf\u5e73\u53f0 Qodana \u63d0\u4f9b\u3002 \u8be5\u5e73\u53f0\u65e8\u5728\u5c06\u670d\u52a1\u5668\u7aef\u9759\u6001\u5206\u6790\u5f15\u5165\u60a8\u7684\u9996\u9009 CI \u5de5\u5177\u3002 Qodana \u4f7f\u7528\u4e0e PhpStorm \u548c\u5176\u4ed6 JetBrains IDE \u76f8\u540c\u7684\u4ee3\u7801\u68c0\u67e5\u548c\u914d\u7f6e\u6587\u4ef6\uff0c\u6709\u52a9\u4e8e\u786e\u4fdd\u5728 IDE \u548c CI \u73af\u5883\u4e2d\u5b9e\u73b0\u4e00\u81f4\u7684\u4ee3\u7801\u8d28\u91cf\u68c0\u67e5<\/em>\u3002<\/p>\n\n\n\n<p>\u53ea\u8981\u4e00\u4e2a\u7528\u6237\u5c31\u53ef\u4ee5\u5229\u7528\u9879\u76ee\u4e2d\u7684\u6f0f\u6d1e\u7834\u574f\u7cfb\u7edf\u3002 \u4e3a\u4e86\u4fdd\u62a4\u7a0b\u5e8f\u514d\u53d7\u6765\u81ea\u5916\u90e8\u7528\u6237\u7684\u6076\u610f\u8f93\u5165\uff08\u5373\u201c\u6c61\u70b9\u201d\uff09\uff0c\u5f00\u53d1\u56e2\u961f\u53ef\u4ee5\u5c06\u6c61\u70b9\u68c0\u67e5\u6dfb\u52a0\u5230\u9759\u6001\u5206\u6790\u4f8b\u7a0b\u4e2d\u3002<\/p>\n\n\n\n<p>\u5728\u4eca\u5e74\u7684\u7b2c\u4e00\u4e2a\u7248\u672c\u4e2d\uff0cQodana \u56e2\u961f\u5728 EAP \u4e2d\u4e3a PHP \u63d0\u4f9b\u4e86\u6c61\u70b9\u5206\u6790\u3002 \u8be5\u529f\u80fd\u4ec5\u5728 Qodana for PHP 2023.1 (jetbrains\/qodana-php:2023.1-eap) \u4e2d\u53ef\u7528\u3002 Qodana for PHP \u662f\u6211\u4eec\u53d1\u5e03\u7684\u7b2c\u4e00\u4e2a linter\uff0c\u56e0\u6b64\u6211\u4eec\u51b3\u5b9a\u8ba9 PHP \u5f00\u53d1\u8005\u4e5f\u7387\u5148\u6d4b\u8bd5\u6211\u4eec\u7684\u65b0\u5b89\u5168\u529f\u80fd\u3002 \u672a\u6765\uff0c\u6211\u4eec\u8ba1\u5212\u5728\u6536\u96c6\u5230\u8db3\u591f\u7684\u53cd\u9988\u540e\u6dfb\u52a0\u66f4\u591a\u8bed\u8a00\u3002<\/p>\n\n\n\n<p>\u4e0b\u6587\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u6c61\u70b9\u5206\u6790\u53ca\u5176\u5728 Qodana \u4e2d\u7684\u8fd0\u4f5c\u65b9\u5f0f\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"2560\" height=\"1200\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2023\/03\/Blog_Featured_image_1280x600-3.png\" alt=\"\" class=\"wp-image-332977\"\/><\/figure>\n\n\n\n<p class=\"has-text-align-center\"><a class=\"jb-download-button\" href=\"https:\/\/www.jetbrains.com.cn\/qodana\" target=\"_blank\" rel=\"noopener noreferrer\" title=\"\u5f00\u59cb\u4f7f\u7528 QODANA\"><i class=\"download-icon\">\u5f00\u59cb\u4f7f\u7528 QODANA<\/i><\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4ec0\u4e48\u662f\u6c61\u70b9\u5206\u6790\uff1f<\/h2>\n\n\n\n<p>\u6c61\u70b9\u662f\u7531\u5916\u90e8\u7528\u6237\u4fee\u6539\u540e\u53ef\u80fd\u9020\u6210\u5b89\u5168\u98ce\u9669\u7684\u503c\u3002 \u5982\u679c\u4ee3\u7801\u4e2d\u5b58\u5728\u6c61\u70b9\uff0c\u5e76\u4e14\u672a\u7ecf\u9a8c\u8bc1\u7684\u5916\u90e8\u6570\u636e\u53ef\u4ee5\u5206\u5e03\u5728\u7a0b\u5e8f\u4e2d\uff0c\u9ed1\u5ba2\u53ef\u4ee5\u6267\u884c\u8fd9\u4e9b\u4ee3\u7801\u6bb5\uff0c\u5bfc\u81f4 SQL \u6ce8\u5165\u3001\u7b97\u672f\u6ea2\u51fa\u3001\u8de8\u7ad9\u811a\u672c\u653b\u51fb\u3001\u8def\u5f84\u904d\u5386\u7b49\u3002 \u4ed6\u4eec\u901a\u5e38\u5229\u7528\u8fd9\u4e9b\u6f0f\u6d1e\u7834\u574f\u7cfb\u7edf\u3001\u52ab\u6301\u51ed\u636e\u548c\u5176\u4ed6\u6570\u636e\uff0c\u5e76\u6539\u53d8\u7cfb\u7edf\u7684\u884c\u4e3a\u3002<\/p>\n\n\n\n<!--more-->\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"1530\" height=\"590\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2023\/03\/image-34.png\" alt=\"\" class=\"wp-image-330043\"\/><figcaption>\u6c61\u70b9\u7684\u793a\u4f8b\u3002 \u5c4f\u5e55\u4e0a\u663e\u793a\u7684\u662f\u6765\u81ea GET \u5f62\u53c2\u7684\u4efb\u610f\u6570\u636e\u3002 \u4f8b\u5982\uff0c\u6076\u610f\u7528\u6237\u53ef\u4ee5\u5229\u7528\u6b64\u6f0f\u6d1e\u7be1\u6539\u7a0b\u5e8f\u5e03\u5c40\u3002<\/figcaption><\/figure>\n\n\n\n<p>\u4f5c\u4e3a\u9488\u5bf9\u6076\u610f\u8f93\u5165\u7684\u989d\u5916\u4fdd\u62a4\u5c42\uff0c\u5f00\u53d1\u56e2\u961f\u5728\u5bf9\u7a0b\u5e8f\u7684\u653b\u51fb\u9762\u8fdb\u884c\u5b89\u5168\u5ba1\u6838\u65f6\u53ef\u4ee5\u6267\u884c\u6c61\u70b9\u5206\u6790\u3002<\/p>\n\n\n\n<p><strong>\u6c61\u70b9\u5206\u6790\u662f\u8bc4\u4f30\u6574\u4e2a\u51fd\u6570\u6216\u65b9\u6cd5\u4e3b\u4f53\u4e2d\u4e0d\u53ef\u4fe1\u7684\u7528\u6237\u8f93\u5165\u6d41\u7684\u8fc7\u7a0b\u3002 \u5b83\u7684\u6838\u5fc3\u76ee\u6807\u662f\u786e\u5b9a\u610f\u5916\u8f93\u5165\u662f\u5426\u4f1a\u4ee5\u6076\u610f\u65b9\u5f0f\u5f71\u54cd\u7a0b\u5e8f\u6267\u884c\u3002<\/strong><\/p>\n\n\n\n<p><strong>\u6c61\u70b9\u6e90<\/strong>\u662f\u7a0b\u5e8f\u8bbf\u95ee\u6f5c\u5728\u6c61\u67d3\u6570\u636e\u7684\u4f4d\u7f6e\u3002 \u7a0b\u5e8f\u4e2d\u6613\u53d7\u6c61\u67d3\u8f93\u5165\u5f71\u54cd\u7684\u5173\u952e\u70b9\u79f0\u4e3a<strong>\u6c61\u70b9\u6c47\u805a\u70b9<\/strong>\u3002 \u6b64\u6570\u636e\u53ef\u4ee5\u901a\u8fc7\u51fd\u6570\u8c03\u7528\u6216\u8d4b\u503c\u4f20\u64ad\u5230\u6c47\u805a\u70b9\u3002<\/p>\n\n\n\n<p>\u5982\u679c\u624b\u52a8\u8fd0\u884c\u6c61\u70b9\u5206\u6790\uff0c\u60a8\u5e94\u8be5\u627e\u51fa\u6240\u6709\u4ece\u5916\u90e8\u7528\u6237\u63a5\u6536\u6570\u636e\u7684\u4f4d\u7f6e\uff0c\u5e76\u8ddf\u8e2a\u6570\u636e\u5728\u7cfb\u7edf\u4e2d\u7684\u5206\u5e03 \u2013 \u53d7\u6c61\u67d3\u7684\u6570\u636e\u53ef\u80fd\u7528\u4e8e\u6570\u5341\u4e2a\u8282\u70b9\u3002 \u7136\u540e\uff0c\u4e3a\u4e86\u9632\u6b62\u6c61\u70b9\u4f20\u64ad\uff0c\u60a8\u5e94\u8be5\u91c7\u7528\u4ee5\u4e0b\u4e24\u79cd\u65b9\u5f0f\u4e4b\u4e00\uff1a<\/p>\n\n\n\n<ol><li><strong>\u51c0\u5316\u6570\u636e<\/strong>\uff0c\u5c06\u6570\u636e\u8f6c\u6362\u4e3a\u5b89\u5168\u72b6\u6001\u3002 \u5728\u4e0b\u9762\u7684\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u79fb\u9664\u4e86\u6807\u8bb0\u4ee5\u89e3\u6790\u6c61\u70b9\u3002&nbsp;<\/li><\/ol>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"1600\" height=\"249\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2023\/03\/image-24.png\" alt=\"\" class=\"wp-image-329878\"\/><\/figure>\n\n\n\n<ol start=\"2\"><li><strong>\u9a8c\u8bc1\u6570\u636e<\/strong>\uff0c\u68c0\u67e5\u6dfb\u52a0\u7684\u6570\u636e\u662f\u5426\u7b26\u5408\u6240\u9700\u6a21\u5f0f\u3002 \u5728\u4e0b\u9762\u7684\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u542f\u7528\u4e86\u5bf9 <code>$<\/code><code>email<\/code> \u53d8\u91cf\u7684\u9a8c\u8bc1\u3002&nbsp;<\/li><\/ol>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"1600\" height=\"365\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2023\/03\/image-25.png\" alt=\"\" class=\"wp-image-329926\"\/><\/figure>\n\n\n\n<p>\u4e5f\u5c31\u662f\u8bf4\uff0c\u6c61\u70b9\u5206\u6790\u68c0\u67e5\u4f1a\u4ece\u6e90\u5934\u5230\u6c47\u805a\u70b9\u8ddf\u8e2a\u7528\u6237\u6c61\u67d3\u7684\u6570\u636e\uff0c\u5e76\u5728\u60a8\u672a\u51c0\u5316\u6216\u9a8c\u8bc1\u6570\u636e\u7684\u60c5\u51b5\u4e0b\u4f7f\u7528\u6570\u636e\u65f6\u53d1\u51fa\u8b66\u62a5\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u6c61\u70b9\u5206\u6790\u5728 Qodana \u4e2d\u7684\u8fd0\u4f5c\u65b9\u5f0f<\/h2>\n\n\n\n<p>\u4ece 2023.1 EAP \u7248\u672c\u5f00\u59cb\uff0c\u6c61\u70b9\u5206\u6790\u7531 Qodana for PHP \u6267\u884c\u3002 \u6b64\u529f\u80fd\u5305\u62ec\u626b\u63cf\u4ee3\u7801\u5e76\u9ad8\u4eae\u663e\u793a\u6c61\u70b9\u548c\u6f5c\u5728\u6f0f\u6d1e\u7684\u68c0\u67e5\u3001\u5728 PhpStorm \u4e2d\u6253\u5f00\u95ee\u9898\u4ee5\u5f53\u573a\u89e3\u51b3\u7684\u529f\u80fd\uff0c\u4ee5\u53ca\u5448\u73b0\u6c61\u70b9\u6d41\u7684\u6570\u636e\u6d41\u56fe\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u793a\u4f8b 1. SQL \u6ce8\u5165<\/h3>\n\n\n\n<p>\u6211\u4eec\u6765\u770b\u770b SQL \u6ce8\u5165\u7684\u793a\u4f8b\u4ee5\u53ca Qodana \u5982\u4f55\u68c0\u6d4b\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"1600\" height=\"825\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2023\/03\/image-26.png\" alt=\"\" class=\"wp-image-329937\"\/><\/figure>\n\n\n\n<p>\u5728\u8fd9\u91cc\uff0cQodana \u5c55\u793a\u4e86 system_admin() \u51fd\u6570\u4e2d\u7684\u4ee5\u4e0b\u6c61\u70b9\uff1a<\/p>\n\n\n\n<p>\u6807\u8bb0 1-2\uff1a\u7528\u6237\u8868\u5355\u8f93\u5165\u4e2d\u7684\u6570\u636e\u68c0\u7d22\u81ea <code>$<\/code><code>_POST<\/code> \u5168\u5c40\u6570\u7ec4\uff0c\u6ca1\u6709\u51c0\u5316\u6216\u9a8c\u8bc1\uff0c\u5e76\u88ab\u8d4b\u7ed9\u53d8\u91cf <code>$<\/code><code>edit<\/code>\u3002 <strong>\u8fd9\u662f\u4e00\u4e2a\u6c61\u70b9<\/strong>\u3002<\/p>\n\n\n\n<p>\u6807\u8bb0 3\uff1a\u53d7\u6c61\u67d3\u7684\u53d8\u91cf <code>$<\/code><code>edit<\/code> \u4f5c\u4e3a\u5b9e\u53c2\u4f20\u9012\u7ed9 <code>system_save_settings<\/code> \u51fd\u6570\uff0c\u6ca1\u6709\u7ecf\u8fc7\u9002\u5f53\u51c0\u5316\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"1600\" height=\"527\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2023\/03\/image-27.png\" alt=\"\" class=\"wp-image-329949\"\/><\/figure>\n\n\n\n<p>\u6807\u8bb0 4\uff1a\u6765\u81ea <code>$<\/code><code>edit<\/code> \u53d8\u91cf\u7684\u6570\u636e\u73b0\u5728\u4f4d\u4e8e <code>$<\/code><code>edit<\/code> \u5f62\u53c2\u4e2d\u3002<\/p>\n\n\n\n<p>\u6807\u8bb0 5\uff1a<code>$<\/code><code>edit<\/code> \u53d8\u91cf\u4ee5 <code>$<\/code><code>filename<\/code> \u952e\u548c <code>$<\/code><code>status<\/code> \u503c\u4f20\u9012\u7ed9 <code>foreach<\/code>\u3002 \u8fd9\u4e24\u4e2a\u53d8\u91cf\u90fd\u5305\u542b\u6765\u81ea\u4e0e\u5b57\u7b26\u4e32\u4e32\u8054\u7684 <code>$<\/code><code>edit<\/code> \u53d8\u91cf\u7684\u53d7\u6c61\u67d3\u6570\u636e\u3002 <code>$<\/code><code>filename<\/code> \u952e\u4e0e\u53d7\u6c61\u67d3\u7684 SQL \u5b57\u7b26\u4e32\u4e32\u8054\uff0c\u7136\u540e\u5b83\u5c06\u53d7\u6c61\u67d3\u7684\u6570\u636e\u4f20\u64ad\u5230\u4f20\u9012\u7ed9 <code>db_query<\/code> \u7684\u5b9e\u53c2\u3002<\/p>\n\n\n\n<p>\u6807\u8bb0 6\uff1a<code>$<\/code><code>filename<\/code> \u952e\u5305\u542b\u6765\u81ea\u4e0e\u5b57\u7b26\u4e32\u4e32\u8054\u7684 <code>$<\/code><code>edit<\/code> \u53d8\u91cf\u7684\u53d7\u6c61\u67d3\u6570\u636e\u3002<\/p>\n\n\n\n<p>\u6807\u8bb0 7\uff1a<code>$<\/code><code>filename<\/code> \u952e\u4e0e\u53d7\u6c61\u67d3\u7684 SQL \u5b57\u7b26\u4e32\u4e32\u8054\u3002<\/p>\n\n\n\n<p>\u6807\u8bb0 8\uff1a\u53d7\u6c61\u67d3\u7684 SQL \u5b57\u7b26\u4e32\u5c06\u53d7\u6c61\u67d3\u7684\u6570\u636e\u4f20\u64ad\u5230\u4f20\u9012\u7ed9 <code>db_query<\/code> \u7684\u5b9e\u53c2<\/p>\n\n\n\n<p>\u73b0\u5728\uff0c\u6211\u4eec\u6765\u770b\u770b <code>db_query<\/code>\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"1600\" height=\"571\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2023\/03\/image-28.png\" alt=\"\" class=\"wp-image-329960\"\/><\/figure>\n\n\n\n<p>\u6807\u8bb0 9\uff1a\u53d7\u6c61\u67d3\u7684\u5b57\u7b26\u4e32\u5c06\u4f4d\u4e8e <code>$<\/code><code>query<\/code> \u5f62\u53c2\u4e2d\u3002<\/p>\n\n\n\n<p>\u6807\u8bb0 10\uff1a\u6b64\u5f62\u53c2\u5c06\u6210\u4e3a <code>_db_query<\/code> \u51fd\u6570\u7684\u5b9e\u53c2\u3002<\/p>\n\n\n\n<p>\u63a5\u4e0b\u6765\u662f <code>_db_query<\/code> \u51fd\u6570\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"1600\" height=\"680\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2023\/03\/image-33.png\" alt=\"\" class=\"wp-image-330032\"\/><\/figure>\n\n\n\n<p>\u6807\u8bb0 11\uff1a\u4f4d\u4e8e <code>_db_query<\/code> \u51fd\u6570\u7684\u7b2c\u4e00\u4e2a\u5f62\u53c2 <code>$<\/code><code>query<\/code> \u4e2d\u7684\u53d7\u6c61\u67d3\u6570\u636e\u3002<\/p>\n\n\n\n<p>\u6807\u8bb0 12\uff1a\u5f62\u53c2\u7684\u6570\u636e\u88ab\u4f20\u9012\u7ed9 <code>mysql_query<\/code> \u51fd\u6570\uff0c\u5b83\u662f\u4e00\u4e2a\u6c47\u805a\u70b9\u3002<\/p>\n\n\n\n<p>\u4e0a\u9762\u7684\u6574\u4e2a\u6570\u636e\u6d41\u8bf4\u660e\u4e86\u6570\u636e\u5982\u4f55\u5728\u6ca1\u6709\u51c0\u5316\u6216\u9a8c\u8bc1\u7684\u60c5\u51b5\u4e0b\u4ece <code>$<\/code><code>_POST[\u201cedit\u201d]<\/code> \u79fb\u52a8\u5230 <code>mysql_query($query)<\/code>\u3002 \u8fd9\u5c31\u8ba9\u653b\u51fb\u8005\u53ef\u4ee5\u64cd\u7eb5\u4e0e <code>$<\/code><code>_POST[\u201cedit\u201d]<\/code> \u952e\u4e32\u8054\u7684 SQL \u67e5\u8be2\u5e76\u89e6\u53d1 <strong>SQL \u6ce8\u5165<\/strong>\u3002&nbsp;<\/p>\n\n\n\n<p>Qodana \u4f1a\u5728\u4ee3\u7801\u5e93\u4ee5\u53ca\u6240\u6709\u4f7f\u7528\u53d7\u6c61\u67d3\u6570\u636e\u7684\u8282\u70b9\u4e2d\u53d1\u73b0\u8fd9\u4e9b\u98ce\u9669\uff0c\u8ba9\u60a8\u53ef\u4ee5\u53ca\u65f6\u51c0\u5316\u6240\u6709\u53d7\u6c61\u67d3\u6570\u636e\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/resources.jetbrains.com\/storage\/products\/blog\/wp-content\/uploads\/Qodana\/taint-open.gif\" alt=\"\"\/><figcaption>\u5728 PhpStorm \u4e2d\u6253\u5f00\u95ee\u9898\u3002<\/figcaption><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">\u793a\u4f8b 2. XSS \u95ee\u9898<\/h3>\n\n\n\n<p>\u5728 Qodana UI \u4e2d\uff0c\u60a8\u53ef\u4ee5\u770b\u5230\u5448\u73b0\u6574\u4e2a\u6c61\u70b9\u6d41\u7684\u56fe\u8868\u3002 \u4ee5\u4e0b\u8bf4\u660e\u4e86 Qodana \u5c06\u5982\u4f55\u5448\u73b0 XSS \u6f0f\u6d1e\uff0c\u5176\u4e2d\u5305\u542b 2 \u4e2a\u5c06\u5728\u6807\u8bb0 5 \u4e0a\u5408\u5e76\u7684\u6e90\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"1310\" height=\"750\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2023\/03\/image-29.png\" alt=\"\" class=\"wp-image-329971\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"1170\" height=\"714\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2023\/03\/image-30.png\" alt=\"\" class=\"wp-image-329982\"\/><\/figure>\n\n\n\n<p><strong>\u6e90 1<\/strong><\/p>\n\n\n\n<p>\u6807\u8bb0 1-2\uff1asearchUpdate.pos \u6587\u4ef6\u4e2d\u7684\u6570\u636e\u5c06\u88ab\u8bfb\u53d6\uff0c\u53d7\u6c61\u67d3\u7684\u6570\u636e\u5c06\u88ab\u88ab\u8d4b\u7ed9 <code>$<\/code><code>start<\/code> \u53d8\u91cf\u3002<\/p>\n\n\n\n<p><strong>\u6e90 2<\/strong><\/p>\n\n\n\n<p>\u6807\u8bb0 3-4\uff1a\u53d6\u8def\u5f84\u4f4d\u4e8e <code>$<\/code><code>posFile<\/code> \u4e2d\u7684\u6587\u4ef6\u4e2d\u7684\u6570\u636e\u5c06\u88ab\u8bfb\u53d6\uff0c\u53d7\u6c61\u67d3\u7684\u6570\u636e\u5c06\u88ab\u8d4b\u7ed9 <code>$<\/code><code>start<\/code> \u53d8\u91cf\u3002<\/p>\n\n\n\n<p>\u6807\u8bb0 5\uff1a<code>$<\/code><code>start<\/code> \u53d8\u91cf\u4e2d\u6240\u6709\u6761\u4ef6\u5206\u652f\u7684\u5408\u5e76\u6c61\u67d3\u72b6\u6001\u5c06\u4f5c\u4e3a\u5b9e\u53c2\u4f20\u9012\u7ed9 <code>doUpdateSearchIndex<\/code> \u65b9\u6cd5\u3002<\/p>\n\n\n\n<p>\u6765\u770b <code>doUpdateSearchIndex()<\/code> \u65b9\u6cd5\u7684\u5185\u90e8\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"1170\" height=\"522\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2023\/03\/image-31.png\" alt=\"\" class=\"wp-image-329994\"\/><\/figure>\n\n\n\n<p>\u6807\u8bb0 6-8\uff1a<code>$<\/code><code>start<\/code> \u5f62\u53c2\u5c06\u5305\u542b\u8fd9\u4e2a\u6570\u636e\u6d41\u5207\u7247\u4e0a\u7684\u53d7\u6c61\u67d3\u6570\u636e\uff0c\u7136\u540e\u5b83\u5c06\u5728\u4e32\u8054\u7684\u5b57\u7b26\u4e32\u4e2d\u4f5c\u4e3a\u5b9e\u53c2\u4f20\u9012\u7ed9 <code>output<\/code> \u65b9\u6cd5\u3002<\/p>\n\n\n\n<p>\u770b\u4e00\u4e0b <code>output<\/code> \u65b9\u6cd5\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"1170\" height=\"764\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2023\/03\/image-32.png\" alt=\"\" class=\"wp-image-330005\"\/><\/figure>\n\n\n\n<p>\u6807\u8bb0 9\uff1a\u4f20\u8f93\u5b57\u7b26\u4e32\u4e2d\u5305\u542b\u7684\u53d7\u6c61\u67d3\u6570\u636e\u5c06\u4f4d\u4e8e <code>$<\/code><code>out<\/code> \u5f62\u53c2\u4e2d\u3002<\/p>\n\n\n\n<p>\u6807\u8bb0 10\uff1a\u6765\u81ea <code>$<\/code><code>out<\/code> \u5f62\u53c2\u7684\u6570\u636e\u5c06\u88ab\u4f20\u8f93\u5230 <code>print<\/code> \u51fd\u6570\uff0c\u4e0d\u8fdb\u884c\u51c0\u5316\u3002 \u8fd9\u4e2a\u51fd\u6570\u662f\u4e00\u4e2a\u6c47\u805a\u70b9\uff0c\u4f1a\u5bfc\u81f4\u53ef\u88ab\u5229\u7528\u7684 XSS \u6f0f\u6d1e\u3002<\/p>\n\n\n\n<p>\u4f8b\u5982\uff0c\u4e3a\u4e86\u5229\u7528\u6f0f\u6d1e\uff0c\u653b\u51fb\u8005\u53ef\u4ee5\u4e0a\u4f20 shell \u811a\u672c\u800c\u4e0d\u662f\u6807\u8bb0 1 \u548c 2 \u4e2d\u7684\u9884\u671f\u6587\u4ef6\uff0c\u5e76\u4e14\u7531\u4e8e\u672a\u51c0\u5316\u7684 print \u51fd\u6570\uff0c\u653b\u51fb\u8005\u80fd\u591f\u5c06\u4efb\u4f55\u4fe1\u606f\u653e\u5230\u7f51\u9875\u4e0a\u3002<\/p>\n\n\n\n<p>Qodana \u4f1a\u63d0\u9192\u60a8\u6ce8\u610f\u8fd9\u4e2a\u6f0f\u6d1e\uff0c\u5e76\u7ed9\u4e88\u9ad8\u4f18\u5148\u7ea7\uff0c\u8ba9\u60a8\u5c3d\u5feb\u89e3\u51b3\uff0c\u9632\u6b62\u906d\u53d7\u653b\u51fb\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u7ed3\u8bba<\/h2>\n\n\n\n<p>\u6c61\u70b9\u5206\u6790\u6709\u52a9\u4e8e\u6d88\u9664\u53ef\u88ab\u5229\u7528\u7684\u653b\u51fb\u9762\uff0c\u662f\u964d\u4f4e\u8f6f\u4ef6\u98ce\u9669\u7684\u6709\u6548\u65b9\u6cd5\u3002 \u8981\u8be6\u7ec6\u4e86\u89e3\u6c61\u70b9\u5206\u6790\u548c Qodana\uff0c\u8bf7\u6d4f\u89c8 <a href=\"https:\/\/www.jetbrains.com.cn\/help\/qodana\/2023.1\/taint-analysis.html\" target=\"_blank\" rel=\"noreferrer noopener\" title=\"https:\/\/www.jetbrains.com\/help\/qodana\/getting-started.html\">Qodana \u6587\u6863<\/a>\u3002<\/p>\n\n\n\n<p class=\"has-text-align-center\"><a class=\"jb-download-button\" title=\"\u5f00\u59cb\u4f7f\u7528 QODANA\" href=\"https:\/\/www.jetbrains.com.cn\/qodana\" target=\"_blank\" rel=\"noopener noreferrer\"><i class=\"download-icon\"><\/i>\u5f00\u59cb\u4f7f\u7528 QODANA<\/a><\/p>\n\n\n\n<p>\u795d\u60a8\u5f00\u53d1\u6109\u5feb\u5e76\u4fdd\u6301\u4ee3\u7801\u5065\u5eb7\uff01<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>\u672c\u535a\u6587\u82f1\u6587\u539f\u4f5c\u8005\uff1a<\/p>\n\n\n    <div class=\"about-author \">\n        <div class=\"about-author__box\">\n            <div class=\"row\">\n                <div class=\"about-author__box-img\">\n                    <img decoding=\"async\" src=\"https:\/\/secure.gravatar.com\/avatar\/?s=200&#038;r=g\" width=\"200\" height=\"200\" alt=\"\" loading=\"lazy\"  class=\"avatar avatar-200 wp-user-avatar wp-user-avatar-200 photo avatar-default\">\n                <\/div>\n                <div class=\"about-author__box-text\">\n                                                        <\/div>\n            <\/div>\n        <\/div>\n    <\/div>\n","protected":false},"author":1297,"featured_media":332977,"comment_status":"closed","ping_status":"closed","template":"","categories":[89,6366],"tags":[190,45],"cross-post-tag":[6637],"acf":[],"_links":{"self":[{"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/qodana\/332887"}],"collection":[{"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/qodana"}],"about":[{"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/types\/qodana"}],"author":[{"embeddable":true,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/users\/1297"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/comments?post=332887"}],"version-history":[{"count":9,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/qodana\/332887\/revisions"}],"predecessor-version":[{"id":335862,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/qodana\/332887\/revisions\/335862"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/media\/332977"}],"wp:attachment":[{"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/media?parent=332887"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/categories?post=332887"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/tags?post=332887"},{"taxonomy":"cross-post-tag","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/cross-post-tag?post=332887"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}