security-code-scan / security-code-scan-results-action

GitHub Action to integrate https://github.com/security-code-scan/security-code-scan into CI/CD process.
8 stars 11 forks source link

TypeError: Cannot read property 'filter' of undefined #2

Closed paulomorgado closed 2 years ago

paulomorgado commented 3 years ago

I'm getting this error:

2021-07-08T07:40:28.5323142Z ##[group]Run security-code-scan/security-code-scan-results-action@main
2021-07-08T07:40:28.5323987Z with:
2021-07-08T07:40:28.5324433Z   sarif_directory: ../results
2021-07-08T07:40:28.5324804Z env:
2021-07-08T07:40:28.5325356Z   NUGET: C:\hostedtoolcache\windows\nuget.exe\5.10.0\x64/nuget.exe
2021-07-08T07:40:28.5326087Z ##[endgroup]
2021-07-08T07:40:33.7776972Z You can invoke the tool using the following command: sarif
2021-07-08T07:40:33.7778165Z Tool 'sarif.multitool' (version '2.3.10') was successfully installed.
2021-07-08T07:40:43.2192577Z D:\a\Microsoft.Extensions.AspNet\Microsoft.Extensions.AspNet\convert.js:12
2021-07-08T07:40:43.2194554Z     run.tool.driver.rules = run.tool.driver.rules.filter((e => e.id.startsWith("SCS")));
2021-07-08T07:40:43.2195578Z                                                   ^
2021-07-08T07:40:43.2195957Z 
2021-07-08T07:40:43.2196729Z TypeError: Cannot read property 'filter' of undefined
2021-07-08T07:40:43.2199700Z     at Object.<anonymous> (D:\a\Microsoft.Extensions.AspNet\Microsoft.Extensions.AspNet\convert.js:12:51)
2021-07-08T07:40:43.2201166Z     at Module._compile (internal/modules/cjs/loader.js:1085:14)
2021-07-08T07:40:43.2202090Z     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
2021-07-08T07:40:43.2202947Z     at Module.load (internal/modules/cjs/loader.js:950:32)
2021-07-08T07:40:43.2203976Z     at Function.Module._load (internal/modules/cjs/loader.js:790:14)
2021-07-08T07:40:43.2205158Z     at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
2021-07-08T07:40:43.2206709Z     at internal/main/run_main_module.js:17:47
2021-07-08T07:40:43.2312568Z ##[error]Process completed with exit code 1.
paulomorgado commented 3 years ago

Solved with https://github.com/paulomorgado/Microsoft.Extensions.AspNet/blob/b759ef0dc402fff2ead50f082f7fecb66c619f86/.github/workflows/securitycodescan-analysis.yml#L150-L249

I can submit a PR.

JarLob commented 3 years ago

Hi, sorry didn't see all the issues. GitHub didn't add me to the watch list automatically. PR would be awesome. What was the cause?

paulomorgado commented 3 years ago

I'm not sure why this task was a bash script creating a js script and using node to run it.

I just converted to pwsh and have no errors now.

But I don't know if it does everything it was supposed to do.

JarLob commented 2 years ago

Fixed in https://github.com/security-code-scan/security-code-scan-add-action/releases/tag/v1.2

Subtixx commented 2 years ago

Got the same error now using the latest:

D:\a\xarf-report-generator\xarf-report-generator\convert.js:12
    run.tool.driver.rules = run.tool.driver.rules.filter((e => e.id.startsWith("SCS")));
                                                  ^
TypeError: Cannot read properties of undefined (reading 'filter')
    at Object.<anonymous> (D:\a\xarf-report-generator\xarf-report-generator\convert.js:12:51)
    at Module._compile (node:internal/modules/cjs/loader:1103:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
    at node:internal/main/run_main_module:17:47
Error: Process completed with exit code 1.
JarLob commented 2 years ago

Odd, so looks like run.tool.driver.rules is undefined. Do you have a link to the failed workflow run?

Subtixx commented 2 years ago

Sure do: https://github.com/IT-Hock/xarf-report-generator/runs/5993051164?check_suite_focus=true

EDIT: btw I have since tried alot of things and the workflow file has changed multiple times (still didn't go through though. I have disabled the action for now and deleted all failed workflows. If needed I can create one that is up2date)