tfsec-pr-commenter-action icon indicating copy to clipboard operation
tfsec-pr-commenter-action copied to clipboard

The commenter fails with the error "invalid character '/' looking for beginning of value"

Open suomit-pki opened this issue 3 years ago • 9 comments

Hi,

I'm running the latest @main version of the action. When I run it, it fails and in the logs it says:

Starting the github commenter... The commenter failed with the following error: invalid character '/' looking for beginning of value

Looking at the cmd/commenter/commenter.go code and the error message, it seems to come from the JSON-library, so maybe parsing the event.json file or the results.json file fails?

suomit-pki avatar Aug 25 '21 12:08 suomit-pki

Hey @suomit-pki - sorry for the delay in getting to this. Is it still an issue? I think I've seen this when bad output landsin in the results.json so might be worth running again from @main

again, apologies for the delay

owenrumney avatar Sep 22 '21 15:09 owenrumney

I do get the same error with @main version

jgrumboe avatar Oct 09 '21 21:10 jgrumboe

The same for me, main and previous versions are not working

abagayev avatar Oct 26 '21 15:10 abagayev

I tried 0.1.10 yesterday on a new PR in our private repo and it was working fine again.

jgrumboe avatar Oct 26 '21 16:10 jgrumboe

@jgrumboe can you please share your workflow?

abagayev avatar Nov 04 '21 08:11 abagayev

Sure.

name: tfsec-pr-commenter
on:
  pull_request:
jobs:
  tfsec:
    name: tfsec PR commenter
    runs-on: ubuntu-latest

    steps:
      - name: Clone repo
        uses: actions/checkout@v2

      - name: tfsec
        uses: aquasecurity/[email protected]
        with:
          github_token: ${{ secrets.GITHUB_ACCESS_TOKEN }}

jgrumboe avatar Nov 04 '21 09:11 jgrumboe

Thanks for sharing!

So I've investigated my problem and problem was in tfsec code validating. With invalid code style tfsec breaks:

$ tfsec 
tags.tf:50,31-36: Missing attribute separator; Expected a newline or comma to mark the beginning of the next attribute.

And breaks not on JSON format. That's why commenting isn't working.

abagayev avatar Nov 04 '21 11:11 abagayev

Good point! I had only successful code and not tested a tfsec hit ... need to do that.

jgrumboe avatar Nov 04 '21 14:11 jgrumboe

<deleted>

I am a moron who forgot to add the checkout step first 😂

erzz avatar Jan 16 '22 11:01 erzz