kasunkv / owasp-zap-vsts-task

Visual Studio Team Services build/release task for running OWASP ZAP automated security tests
MIT License
30 stars 11 forks source link

Unhandled: Unexpected token = #11

Open spvrk opened 6 years ago

spvrk commented 6 years ago

Hi, I’m running the build agent task in vsts

I’ve got everything configured to scan my microservice at a specific target url, method is POST via an active scan with a sample payload.

In the build process I get the error mentioned above in the title right after the task description block (where it says the task name, description, version, etc etc..) no additional information or any leads are given... any idea on what’s going on here?

Thanks

nuphoff commented 6 years ago

I have the same issue but i'm running the task on a on-premise installation of tfs

kasunkv commented 6 years ago

Hi, a new version of the task (v2.0.5) is released now, Please check to see if this issue still exists. If so let me know here. Sorry for the delayed response.

t3hcr commented 6 years ago

Thanks for the recent updates @kasunkv . Receiving the same issue/error here as well and will chime in with details we captured below...

With v2.0.6 we are still seeing the "Unhandled: Unexpected token =" issue which results in failed tasks running. We're using a private agent running Windows Server 2016. We can see the code/task related to the scan being delivered to the private build agent, but fail immediately after the task description block as @spvrk mentioned.

kasunkv commented 6 years ago

@t3hcr Thanks for the feedback. I'll look in to this and keep you guys updated here..

t3hcr commented 6 years ago

@kasunkv is there anything we can help or additional information we can provide to help debug the issue? We appreciate your time as you look at this!

kasunkv commented 6 years ago

@t3hcr If you can send me the console logs for the task it would help a lot to troubleshoot this issue. To get the full task logs, in your variables section define the system.debug variable (if its not already there) and set the value to true(it will already be falseif its set). Then you will see additional debug information including the inputs you provide. Send these debug lines and it would be helpful.

Please note that, the inputs will include the ZAP API key and the TargetUrl. Hide these when you post them here.

@spvrk If you can send these debug information too, it will help out a lot :)

t3hcr commented 6 years ago

@kasunkv thanks for your continued work here. I captured some details for you based on your request.

Please see: https://gist.github.com/t3hcr/e77e613b8658796abdb4b5c918ddab17

t3hcr commented 6 years ago

@kasunkv Were you able to access the logs I placed in the gist at: https://gist.github.com/t3hcr/e77e613b8658796abdb4b5c918ddab17 ??

Is there any additional information or anything else I can help you with to help debug this issue?

Thank you very much for your time and work on this!

kasunkv commented 6 years ago

@t3hcr Thanks for sending the logs. I'll look in to this ASAP. Was busy for the last few days.

cil818317 commented 6 years ago

I've done a bit of investigation and it looks like the issue is in the reports.js; const Report_1 = require("./classes/Report"); const report = new Report_1.Report(helper, requestService, taskInputs); If you comment out the 2 lines that generate the base report file;


Starting task: OWASP ZAP Scan


Set workingFolder to default: E:\agent\tasks\OwaspZapScan\2.0.6 OWASP ZAP Spider Scan Initiated. ID: 0 Spider Scan In Progress: 100% Spider Scan Complete.

OWASP ZAP Active Scan Initiated. ID: 0 Active Scan In Progress: 100% Active Scan Complete.

Generating the report... Task Failed. Error: "report is not defined"

akratzert commented 6 years ago

I'm using 2.0.7 and getting the same error. I don't see where that Report_1 = require("./classes/Report"); line is

iaunzu commented 4 years ago

Seems like a js bug related with ECMAScript version supported in TFS.

I solved this problem changing line 279 in ./classes/Report.js to:

createAlertRow(header, value, rowType) {
  rowType = typeof rowType !== 'undefined' ? rowType : Enums_1.AlertRowType.AlertRow;
  let cssClass = 'attribute';

I am using v2.0.7 with TFS 15.112.26307.0.