{"id":9889,"date":"2019-02-11T18:27:41","date_gmt":"2019-02-11T09:27:41","guid":{"rendered":"https:\/\/www.itblog.jp\/?p=9889"},"modified":"2019-02-11T18:27:41","modified_gmt":"2019-02-11T09:27:41","slug":"composer%e3%82%92root%e3%83%a6%e3%83%bc%e3%82%b6%e3%81%a7%e5%ae%9f%e8%a1%8c%e3%81%97%e3%81%a6%e3%81%af%e3%81%84%e3%81%91%e3%81%aa%e3%81%84%e7%90%86%e7%94%b1","status":"publish","type":"post","link":"https:\/\/www.itblog.jp\/?p=9889","title":{"rendered":"Composer\u3092root\u30e6\u30fc\u30b6\u3067\u5b9f\u884c\u3057\u3066\u306f\u3044\u3051\u306a\u3044\u7406\u7531"},"content":{"rendered":"<p>Linux\u7cfb\u306e\u30b5\u30fc\u30d0\u306broot\u30e6\u30fc\u30b6\u3067\u30ed\u30b0\u30a4\u30f3\u3057\u3066\u3001Composer\u3092\u5b9f\u884c\u3057\u3088\u3046\u3068\u3059\u308b\u3068\u3001\u4ee5\u4e0b\u306e\u8b66\u544a\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u8868\u793a\u3055\u308c\u307e\u3059<\/p>\n<p>Do not run Composer as root\/super user! See https:\/\/getcomposer.org\/root for details<\/p>\n<p>https:\/\/getcomposer.org\/root\u3000\u3092\u898b\u308d\u3068\u3044\u3046\u3053\u3068\u306a\u306e\u3067\u30a2\u30af\u30bb\u30b9\u3057\u3066\u307f\u308b\u3068\u3001\u8aac\u660e\u304c\u3042\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>How do I install untrusted packages safely? Is it safe to run Composer as superuser or root?<\/p>\n<p>\u3069\u3046\u3084\u3063\u3066\u4fe1\u983c\u3055\u308c\u3066\u306a\u3044\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u5b89\u5168\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3067\u304d\u307e\u3059\u304b\uff1f<br \/>\nComposer\u3092\u30b9\u30fc\u30d1\u30fc\u30e6\u30fc\u30b6\u3084\u30eb\u30fc\u30c8\u30e6\u30fc\u30b6\u3067\u5b89\u5168\u306b\u5b9f\u884c\u3067\u304d\u307e\u3059\u304b\uff1f<\/p>\n<p>Certain Composer commands, including exec, install, and update allow third party code to execute on your system. This is from its &#8220;plugins&#8221; and &#8220;scripts&#8221; features. Plugins and scripts have full access to the user account which runs Composer. For this reason, it is strongly advised to avoid running Composer as super-user\/root.<\/p>\n<p>Composer\u306e\u30b3\u30de\u30f3\u30c9\u306b\u306f\u3001\u5b9f\u884c\u3001\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3001\u30a2\u30c3\u30d7\u30c7\u30fc\u30c8\u304c\u542b\u307e\u308c\u3066\u3044\u3066\u3001\u30b7\u30b9\u30c6\u30e0\u306b\u5f71\u97ff\u3059\u308b\u30b3\u30fc\u30c9\u3092\u5b9f\u884c\u3059\u308b\u3053\u3068\u3092\u30b5\u30fc\u30c9\u30d1\u30fc\u30c6\u30a3\u306b\u8a31\u53ef\u3057\u307e\u3059\u3002<br \/>\n\u3053\u308c\u306f\u3001\u30d7\u30e9\u30b0\u30a4\u30f3\u3068\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u7279\u5fb4\u306b\u7531\u6765\u3057\u3066\u3044\u307e\u3059\u3002\u30d7\u30e9\u30b0\u30a4\u30f3\u3068\u30b9\u30af\u30ea\u30d7\u30c8\u306fComposer\u3092\u5b9f\u884c\u3059\u308b\u30e6\u30fc\u30b6\u30a2\u30ab\u30a6\u30f3\u30c8\u306b\u5b8c\u5168\u306b\u30a2\u30af\u30bb\u30b9\u3057\u307e\u3059\u3002<br \/>\n\u3053\u306e\u7406\u7531\u306b\u3088\u308a\u3001Composer\u3092root\u30e6\u30fc\u30b6\u3067\u5b9f\u884c\u3057\u306a\u3044\u3053\u3068\u3092\u5f37\u304f\u63a8\u5968\u3057\u307e\u3059\u3002<\/p>\n<p>You can disable plugins and scripts during package installation or updates with the following syntax so only Composer&#8217;s code, and no third party code, will execute:<\/p>\n<p>\u3042\u306a\u305f\u306f\u30d7\u30e9\u30b0\u30a4\u30f3\u3068\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u3001\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u304b\u30a2\u30c3\u30d7\u30c7\u30fc\u30c8\u6642\u306b\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3092\u8ffd\u52a0\u3059\u308b\u3053\u3068\u3067\u7121\u52b9\u306b\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<br \/>\n\u30b5\u30fc\u30c9\u30d1\u30fc\u30c6\u30a3\u306e\u30b3\u30fc\u30c9\u306f\u5b9f\u884c\u3067\u304d\u306a\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>composer install &#8211;no-plugins &#8211;no-scripts &#8230;<br \/>\ncomposer update &#8211;no-plugins &#8211;no-scripts &#8230;<\/p>\n<p>The exec command will always run third party code as the user which runs composer.<\/p>\n<p>In some cases, like in CI systems or such where you want to install untrusted dependencies, the safest way to do it is to run the above command.<\/p>\n<p>exec\u30b3\u30de\u30f3\u30c9\u306f\u30b5\u30fc\u30c9\u30d1\u30fc\u30c6\u30a3\u306e\u30b3\u30fc\u30c9\u3092composer\u3092\u5b9f\u884c\u3059\u308b\u30e6\u30fc\u30b6\u3068\u540c\u3058\u3088\u3046\u306b\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n<p>\u3044\u304f\u3064\u304b\u306e\u30b1\u30fc\u30b9\u3067\u3001CI\u30b7\u30b9\u30c6\u30e0\u307e\u305f\u306f\u4fe1\u983c\u3055\u308c\u3066\u3044\u306a\u3044\u4f9d\u5b58\u95a2\u4fc2\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3068\u304d\u306b\u3001\u6700\u3082\u5b89\u5168\u306a\u306e\u306f\u4e0a\u8a18\u306e\u3088\u3046\u306a\u30b3\u30de\u30f3\u30c9\u3067\u5b9f\u884c\u3059\u308b\u3053\u3068\u3067\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Linux\u7cfb\u306e\u30b5\u30fc\u30d0\u306broot\u30e6\u30fc\u30b6\u3067\u30ed\u30b0\u30a4\u30f3\u3057\u3066\u3001Composer\u3092\u5b9f\u884c\u3057\u3088\u3046\u3068\u3059\u308b\u3068\u3001\u4ee5\u4e0b\u306e\u8b66\u544a\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u8868\u793a\u3055\u308c\u307e\u3059 Do not run Composer as root\/super user! See htt [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[144,131],"tags":[],"class_list":["post-9889","post","type-post","status-publish","format-standard","hentry","category-php-","category-131"],"_links":{"self":[{"href":"https:\/\/www.itblog.jp\/index.php?rest_route=\/wp\/v2\/posts\/9889","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.itblog.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.itblog.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.itblog.jp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.itblog.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=9889"}],"version-history":[{"count":0,"href":"https:\/\/www.itblog.jp\/index.php?rest_route=\/wp\/v2\/posts\/9889\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.itblog.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=9889"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.itblog.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=9889"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.itblog.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=9889"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}