Does Virus affected Node Modules transfer in Contents of SPFx deployment package












4















When we scaffold an SPFx webpart/Extension we get many Node Modules as part of dependencies. These can be seen in node_modules folder and there are also entries in package-lock.json file.



I know these are dependencies for development.



Now assume a case where one of the Node Modules contains Virus (like in flatmap-stream and event-stream). Does the package files generated from commands gulp bundle --ship and gulp package-solution --ship will contain any of the code from all or effected Node Modules?










share|improve this question





























    4















    When we scaffold an SPFx webpart/Extension we get many Node Modules as part of dependencies. These can be seen in node_modules folder and there are also entries in package-lock.json file.



    I know these are dependencies for development.



    Now assume a case where one of the Node Modules contains Virus (like in flatmap-stream and event-stream). Does the package files generated from commands gulp bundle --ship and gulp package-solution --ship will contain any of the code from all or effected Node Modules?










    share|improve this question



























      4












      4








      4


      2






      When we scaffold an SPFx webpart/Extension we get many Node Modules as part of dependencies. These can be seen in node_modules folder and there are also entries in package-lock.json file.



      I know these are dependencies for development.



      Now assume a case where one of the Node Modules contains Virus (like in flatmap-stream and event-stream). Does the package files generated from commands gulp bundle --ship and gulp package-solution --ship will contain any of the code from all or effected Node Modules?










      share|improve this question
















      When we scaffold an SPFx webpart/Extension we get many Node Modules as part of dependencies. These can be seen in node_modules folder and there are also entries in package-lock.json file.



      I know these are dependencies for development.



      Now assume a case where one of the Node Modules contains Virus (like in flatmap-stream and event-stream). Does the package files generated from commands gulp bundle --ship and gulp package-solution --ship will contain any of the code from all or effected Node Modules?







      sharepoint-online spfx spfx-webparts spfx-extensions anti-virus






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 3 at 10:58









      Vardhaman Deshpande

      9,89811950




      9,89811950










      asked Jan 2 at 12:09









      Asad RefaiAsad Refai

      5,24282350




      5,24282350






















          1 Answer
          1






          active

          oldest

          votes


















          8














          TLDR;



          The short answer is no, the package doesn't contain all of the code from node_modules, yet it contains some very small amount of proven code (mostly css-loader code from corresponding webpack loader).



          Long answer



          SharePoint Framework uses webpack to bundle your code into a single file (aka package). Apart your code SharePoint Framework contains a lot of components which you reference in your code via imports (import smth from '@microsoft/sp-webpart-base' etc.), however, those components are not included in your code. They serve as "externals" and are loaded by SharePoint Framework at runtime.

          If you take a look at webpack configuration, you will see below picture:



             ....
          devtool: 'source-map',
          entry:
          { 'hello-world-web-part':
          'C:\temp\spfx-test\lib\webparts\helloWorld\HelloWorldWebPart.js',
          'my-new-wp-web-part':
          'C:\temp\spfx-test\lib\webparts\myNewWp\MyNewWpWebPart.js' },
          externals:
          [ '@microsoft/sp-lodash-subset',
          '@microsoft/sp-core-library',
          '@microsoft/decorators',
          '@microsoft/office-ui-fabric-react-bundle',
          '@microsoft/sp-diagnostics',
          '@microsoft/sp-dynamic-data',
          '@microsoft/sp-polyfills',
          '@microsoft/sp-http',
          '@microsoft/sp-page-context',
          '@microsoft/sp-loader',
          '@microsoft/sp-component-base',
          '@microsoft/sp-webpart-base',
          '@microsoft/sp-office-ui-fabric-core',
          '@microsoft/sp-extension-base',
          '@microsoft/sp-application-base',
          '@microsoft/sp-client-preview',
          '@microsoft/sp-webpart-workbench',
          'react',
          'react-dom',
          'HelloWorldWebPartStrings',
          'MyNewWpWebPartStrings' ],
          output:
          ....


          Everything which is in the external section won't be included into the resulting bundle, yet it will be served at runtime by Microsoft. Your package contains only your code (plus a bit of code from webpack's css-loader like mentioned earlier). You can run gulp clean then gulp bundle and open ./dist folder to review the generated bundle. Only your code will be included.

          Which basically means that you shouldn't care about such things like viruses, etc. However, Microsoft should care that all externals modules they use (aka @microsoft/* and react*) are virus-free and safe.

          From your side, you should only care about any external modules you install after scaffolding your project. For example react modules, or helpers, or whatever else.



          Additional reading:



          250+ vulnerabilities in a new SharePoint Framework project
          Don't be alarmed by vulnerabilities after running NPM Install
          Code Security Audit using “npm audit”






          share|improve this answer
























          • There is the possibility that the webpack or one of it plugins has "evil" code in and injects this into your build result (like in XcodeGhost). But the size and importance makes likely that such an attack would be detect fast

            – sschoof
            Jan 4 at 8:18











          • That's true, but this is the task for Microsoft, because like mentioned all webpack modules as well as node modules with dependencies are externals and controlled by Microsoft. So technically "evil" code won't be in your bundle unless you add it explicitly.

            – Sergei Sergeev
            Jan 4 at 8:32












          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "232"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsharepoint.stackexchange.com%2fquestions%2f255059%2fdoes-virus-affected-node-modules-transfer-in-contents-of-spfx-deployment-package%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          8














          TLDR;



          The short answer is no, the package doesn't contain all of the code from node_modules, yet it contains some very small amount of proven code (mostly css-loader code from corresponding webpack loader).



          Long answer



          SharePoint Framework uses webpack to bundle your code into a single file (aka package). Apart your code SharePoint Framework contains a lot of components which you reference in your code via imports (import smth from '@microsoft/sp-webpart-base' etc.), however, those components are not included in your code. They serve as "externals" and are loaded by SharePoint Framework at runtime.

          If you take a look at webpack configuration, you will see below picture:



             ....
          devtool: 'source-map',
          entry:
          { 'hello-world-web-part':
          'C:\temp\spfx-test\lib\webparts\helloWorld\HelloWorldWebPart.js',
          'my-new-wp-web-part':
          'C:\temp\spfx-test\lib\webparts\myNewWp\MyNewWpWebPart.js' },
          externals:
          [ '@microsoft/sp-lodash-subset',
          '@microsoft/sp-core-library',
          '@microsoft/decorators',
          '@microsoft/office-ui-fabric-react-bundle',
          '@microsoft/sp-diagnostics',
          '@microsoft/sp-dynamic-data',
          '@microsoft/sp-polyfills',
          '@microsoft/sp-http',
          '@microsoft/sp-page-context',
          '@microsoft/sp-loader',
          '@microsoft/sp-component-base',
          '@microsoft/sp-webpart-base',
          '@microsoft/sp-office-ui-fabric-core',
          '@microsoft/sp-extension-base',
          '@microsoft/sp-application-base',
          '@microsoft/sp-client-preview',
          '@microsoft/sp-webpart-workbench',
          'react',
          'react-dom',
          'HelloWorldWebPartStrings',
          'MyNewWpWebPartStrings' ],
          output:
          ....


          Everything which is in the external section won't be included into the resulting bundle, yet it will be served at runtime by Microsoft. Your package contains only your code (plus a bit of code from webpack's css-loader like mentioned earlier). You can run gulp clean then gulp bundle and open ./dist folder to review the generated bundle. Only your code will be included.

          Which basically means that you shouldn't care about such things like viruses, etc. However, Microsoft should care that all externals modules they use (aka @microsoft/* and react*) are virus-free and safe.

          From your side, you should only care about any external modules you install after scaffolding your project. For example react modules, or helpers, or whatever else.



          Additional reading:



          250+ vulnerabilities in a new SharePoint Framework project
          Don't be alarmed by vulnerabilities after running NPM Install
          Code Security Audit using “npm audit”






          share|improve this answer
























          • There is the possibility that the webpack or one of it plugins has "evil" code in and injects this into your build result (like in XcodeGhost). But the size and importance makes likely that such an attack would be detect fast

            – sschoof
            Jan 4 at 8:18











          • That's true, but this is the task for Microsoft, because like mentioned all webpack modules as well as node modules with dependencies are externals and controlled by Microsoft. So technically "evil" code won't be in your bundle unless you add it explicitly.

            – Sergei Sergeev
            Jan 4 at 8:32
















          8














          TLDR;



          The short answer is no, the package doesn't contain all of the code from node_modules, yet it contains some very small amount of proven code (mostly css-loader code from corresponding webpack loader).



          Long answer



          SharePoint Framework uses webpack to bundle your code into a single file (aka package). Apart your code SharePoint Framework contains a lot of components which you reference in your code via imports (import smth from '@microsoft/sp-webpart-base' etc.), however, those components are not included in your code. They serve as "externals" and are loaded by SharePoint Framework at runtime.

          If you take a look at webpack configuration, you will see below picture:



             ....
          devtool: 'source-map',
          entry:
          { 'hello-world-web-part':
          'C:\temp\spfx-test\lib\webparts\helloWorld\HelloWorldWebPart.js',
          'my-new-wp-web-part':
          'C:\temp\spfx-test\lib\webparts\myNewWp\MyNewWpWebPart.js' },
          externals:
          [ '@microsoft/sp-lodash-subset',
          '@microsoft/sp-core-library',
          '@microsoft/decorators',
          '@microsoft/office-ui-fabric-react-bundle',
          '@microsoft/sp-diagnostics',
          '@microsoft/sp-dynamic-data',
          '@microsoft/sp-polyfills',
          '@microsoft/sp-http',
          '@microsoft/sp-page-context',
          '@microsoft/sp-loader',
          '@microsoft/sp-component-base',
          '@microsoft/sp-webpart-base',
          '@microsoft/sp-office-ui-fabric-core',
          '@microsoft/sp-extension-base',
          '@microsoft/sp-application-base',
          '@microsoft/sp-client-preview',
          '@microsoft/sp-webpart-workbench',
          'react',
          'react-dom',
          'HelloWorldWebPartStrings',
          'MyNewWpWebPartStrings' ],
          output:
          ....


          Everything which is in the external section won't be included into the resulting bundle, yet it will be served at runtime by Microsoft. Your package contains only your code (plus a bit of code from webpack's css-loader like mentioned earlier). You can run gulp clean then gulp bundle and open ./dist folder to review the generated bundle. Only your code will be included.

          Which basically means that you shouldn't care about such things like viruses, etc. However, Microsoft should care that all externals modules they use (aka @microsoft/* and react*) are virus-free and safe.

          From your side, you should only care about any external modules you install after scaffolding your project. For example react modules, or helpers, or whatever else.



          Additional reading:



          250+ vulnerabilities in a new SharePoint Framework project
          Don't be alarmed by vulnerabilities after running NPM Install
          Code Security Audit using “npm audit”






          share|improve this answer
























          • There is the possibility that the webpack or one of it plugins has "evil" code in and injects this into your build result (like in XcodeGhost). But the size and importance makes likely that such an attack would be detect fast

            – sschoof
            Jan 4 at 8:18











          • That's true, but this is the task for Microsoft, because like mentioned all webpack modules as well as node modules with dependencies are externals and controlled by Microsoft. So technically "evil" code won't be in your bundle unless you add it explicitly.

            – Sergei Sergeev
            Jan 4 at 8:32














          8












          8








          8







          TLDR;



          The short answer is no, the package doesn't contain all of the code from node_modules, yet it contains some very small amount of proven code (mostly css-loader code from corresponding webpack loader).



          Long answer



          SharePoint Framework uses webpack to bundle your code into a single file (aka package). Apart your code SharePoint Framework contains a lot of components which you reference in your code via imports (import smth from '@microsoft/sp-webpart-base' etc.), however, those components are not included in your code. They serve as "externals" and are loaded by SharePoint Framework at runtime.

          If you take a look at webpack configuration, you will see below picture:



             ....
          devtool: 'source-map',
          entry:
          { 'hello-world-web-part':
          'C:\temp\spfx-test\lib\webparts\helloWorld\HelloWorldWebPart.js',
          'my-new-wp-web-part':
          'C:\temp\spfx-test\lib\webparts\myNewWp\MyNewWpWebPart.js' },
          externals:
          [ '@microsoft/sp-lodash-subset',
          '@microsoft/sp-core-library',
          '@microsoft/decorators',
          '@microsoft/office-ui-fabric-react-bundle',
          '@microsoft/sp-diagnostics',
          '@microsoft/sp-dynamic-data',
          '@microsoft/sp-polyfills',
          '@microsoft/sp-http',
          '@microsoft/sp-page-context',
          '@microsoft/sp-loader',
          '@microsoft/sp-component-base',
          '@microsoft/sp-webpart-base',
          '@microsoft/sp-office-ui-fabric-core',
          '@microsoft/sp-extension-base',
          '@microsoft/sp-application-base',
          '@microsoft/sp-client-preview',
          '@microsoft/sp-webpart-workbench',
          'react',
          'react-dom',
          'HelloWorldWebPartStrings',
          'MyNewWpWebPartStrings' ],
          output:
          ....


          Everything which is in the external section won't be included into the resulting bundle, yet it will be served at runtime by Microsoft. Your package contains only your code (plus a bit of code from webpack's css-loader like mentioned earlier). You can run gulp clean then gulp bundle and open ./dist folder to review the generated bundle. Only your code will be included.

          Which basically means that you shouldn't care about such things like viruses, etc. However, Microsoft should care that all externals modules they use (aka @microsoft/* and react*) are virus-free and safe.

          From your side, you should only care about any external modules you install after scaffolding your project. For example react modules, or helpers, or whatever else.



          Additional reading:



          250+ vulnerabilities in a new SharePoint Framework project
          Don't be alarmed by vulnerabilities after running NPM Install
          Code Security Audit using “npm audit”






          share|improve this answer













          TLDR;



          The short answer is no, the package doesn't contain all of the code from node_modules, yet it contains some very small amount of proven code (mostly css-loader code from corresponding webpack loader).



          Long answer



          SharePoint Framework uses webpack to bundle your code into a single file (aka package). Apart your code SharePoint Framework contains a lot of components which you reference in your code via imports (import smth from '@microsoft/sp-webpart-base' etc.), however, those components are not included in your code. They serve as "externals" and are loaded by SharePoint Framework at runtime.

          If you take a look at webpack configuration, you will see below picture:



             ....
          devtool: 'source-map',
          entry:
          { 'hello-world-web-part':
          'C:\temp\spfx-test\lib\webparts\helloWorld\HelloWorldWebPart.js',
          'my-new-wp-web-part':
          'C:\temp\spfx-test\lib\webparts\myNewWp\MyNewWpWebPart.js' },
          externals:
          [ '@microsoft/sp-lodash-subset',
          '@microsoft/sp-core-library',
          '@microsoft/decorators',
          '@microsoft/office-ui-fabric-react-bundle',
          '@microsoft/sp-diagnostics',
          '@microsoft/sp-dynamic-data',
          '@microsoft/sp-polyfills',
          '@microsoft/sp-http',
          '@microsoft/sp-page-context',
          '@microsoft/sp-loader',
          '@microsoft/sp-component-base',
          '@microsoft/sp-webpart-base',
          '@microsoft/sp-office-ui-fabric-core',
          '@microsoft/sp-extension-base',
          '@microsoft/sp-application-base',
          '@microsoft/sp-client-preview',
          '@microsoft/sp-webpart-workbench',
          'react',
          'react-dom',
          'HelloWorldWebPartStrings',
          'MyNewWpWebPartStrings' ],
          output:
          ....


          Everything which is in the external section won't be included into the resulting bundle, yet it will be served at runtime by Microsoft. Your package contains only your code (plus a bit of code from webpack's css-loader like mentioned earlier). You can run gulp clean then gulp bundle and open ./dist folder to review the generated bundle. Only your code will be included.

          Which basically means that you shouldn't care about such things like viruses, etc. However, Microsoft should care that all externals modules they use (aka @microsoft/* and react*) are virus-free and safe.

          From your side, you should only care about any external modules you install after scaffolding your project. For example react modules, or helpers, or whatever else.



          Additional reading:



          250+ vulnerabilities in a new SharePoint Framework project
          Don't be alarmed by vulnerabilities after running NPM Install
          Code Security Audit using “npm audit”







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jan 2 at 13:00









          Sergei SergeevSergei Sergeev

          10.4k52542




          10.4k52542













          • There is the possibility that the webpack or one of it plugins has "evil" code in and injects this into your build result (like in XcodeGhost). But the size and importance makes likely that such an attack would be detect fast

            – sschoof
            Jan 4 at 8:18











          • That's true, but this is the task for Microsoft, because like mentioned all webpack modules as well as node modules with dependencies are externals and controlled by Microsoft. So technically "evil" code won't be in your bundle unless you add it explicitly.

            – Sergei Sergeev
            Jan 4 at 8:32



















          • There is the possibility that the webpack or one of it plugins has "evil" code in and injects this into your build result (like in XcodeGhost). But the size and importance makes likely that such an attack would be detect fast

            – sschoof
            Jan 4 at 8:18











          • That's true, but this is the task for Microsoft, because like mentioned all webpack modules as well as node modules with dependencies are externals and controlled by Microsoft. So technically "evil" code won't be in your bundle unless you add it explicitly.

            – Sergei Sergeev
            Jan 4 at 8:32

















          There is the possibility that the webpack or one of it plugins has "evil" code in and injects this into your build result (like in XcodeGhost). But the size and importance makes likely that such an attack would be detect fast

          – sschoof
          Jan 4 at 8:18





          There is the possibility that the webpack or one of it plugins has "evil" code in and injects this into your build result (like in XcodeGhost). But the size and importance makes likely that such an attack would be detect fast

          – sschoof
          Jan 4 at 8:18













          That's true, but this is the task for Microsoft, because like mentioned all webpack modules as well as node modules with dependencies are externals and controlled by Microsoft. So technically "evil" code won't be in your bundle unless you add it explicitly.

          – Sergei Sergeev
          Jan 4 at 8:32





          That's true, but this is the task for Microsoft, because like mentioned all webpack modules as well as node modules with dependencies are externals and controlled by Microsoft. So technically "evil" code won't be in your bundle unless you add it explicitly.

          – Sergei Sergeev
          Jan 4 at 8:32


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to SharePoint Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsharepoint.stackexchange.com%2fquestions%2f255059%2fdoes-virus-affected-node-modules-transfer-in-contents-of-spfx-deployment-package%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Tonle Sap (See)

          I get strange results when I access the Sqlitedatabase with Unity C# via XAMPP

          Guatemaltekische Davis-Cup-Mannschaft