Coder Social home page Coder Social logo

Comments (5)

navpreet-securitas avatar navpreet-securitas commented on June 12, 2024 3

Hi
We are facing same issue , where GH issue is getting created again even though GH issue is present.
It works well when using default GITHUB_TOKEN , but if we use PAT token(with required permissions on repo) as below:

        id: baseline
        uses: zaproxy/[email protected]
        with:
          token: ${{ secrets.ZAP_TOKEN }}
          target: 'https://www.example.com'
          rules_file_name: 'rules.tsv' 

it is not able to find existing open issue. Probably because of :
if ( issue["state"] === "open" && issue["user"]!["login"] === "github-actions[bot]" )
https://github.com/zaproxy/actions-common/blob/master/src/index.ts#LL73C1-L74C1

Since we are using PAT token it creates issue with another username in previous runs and username is verified as above it fails to get issue.
Why we are using PAT token instead of default GITHUB_TOKEN because we want to trigger another workflow which create jira ticket , whenever a GH issue is created by base zap scan workflow.
https://docs.github.com/en/actions/using-workflows/triggering-a-workflow#triggering-a-workflow-from-a-workflow

@sshniro any suggestions how to workaround this or fixes coming for this. maybe token can be used to identify user used for zap scan / issue creation and then verify that user in actions-common.

from action-baseline.

sshniro avatar sshniro commented on June 12, 2024

I assume this is due to the fact that the runner could not read the previous report and executing the create new issue workflow. I'll check and update you on this.

previousReport = await actionHelper.readPreviousReport(octokit, owner, repo, workSpace, previousRunnerID);

from action-baseline.

sshniro avatar sshniro commented on June 12, 2024

Hi @hazcod, I assume this is an isolated event, as the new scans (for 2 days) did not create a new issue: ironpeakservices/ironpeak.be#42

I will add more logs to figure out what went wrong.

from action-baseline.

navpreet-securitas avatar navpreet-securitas commented on June 12, 2024
Quoted message

Hi We are facing same issue , where GH issue is getting created again even though GH issue is present. It works well when using default GITHUB_TOKEN , but if we use PAT token(with required permissions on repo) as below:

        id: baseline
        uses: zaproxy/[email protected]
        with:
          token: ${{ secrets.ZAP_TOKEN }}
          target: 'https://www.example.com'
          rules_file_name: 'rules.tsv' 

it is not able to find existing open issue. Probably because of : if ( issue["state"] === "open" && issue["user"]!["login"] === "github-actions[bot]" ) https://github.com/zaproxy/actions-common/blob/master/src/index.ts#LL73C1-L74C1

Since we are using PAT token it creates issue with another username in previous runs and username is verified as above it fails to get issue. Why we are using PAT token instead of default GITHUB_TOKEN because we want to trigger another workflow which create jira ticket , whenever a GH issue is created by base zap scan workflow. https://docs.github.com/en/actions/using-workflows/triggering-a-workflow#triggering-a-workflow-from-a-workflow

@sshniro any suggestions how to workaround this or fixes coming for this. maybe token can be used to identify user used for zap scan / issue creation and then verify that user in actions-common.

probably this can be used:
getting user by using token passed and then comparing with OR condition ( along with github-actions[bot])

// Octokit.js
// https://github.com/octokit/core.js#readme
const octokit = new Octokit({
  auth: 'YOUR-TOKEN'
})

await octokit.request('GET /user', {
  headers: {
    'X-GitHub-Api-Version': '2022-11-28'
  }
})

https://docs.github.com/en/rest/users/users?apiVersion=2022-11-28#get-the-authenticated-user

from action-baseline.

Den4200 avatar Den4200 commented on June 12, 2024

Thanks so much!

from action-baseline.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.