Skip to content

OpenSSF scorecard "Token-permissions" score zero #3012

Closed

Description

@fraxken

Hello there 👋,

Today in the Node.js security meeting we discussed that the undici project score had dropped due to a change in the workflows. This seems to be related to the following commit.

image

Full report here

  1. nightly.yml and test.yml seems to lack global permissions
permissions:
  contents: read
  1. In nodejs.yml we have warnings to reviews the following permission.

permissions:
contents: write
pull-requests: write
actions: write

Github Action Merge Dependabot require pull-requests and contents (not sure if actions is required). These warnings are perhaps to be ignored.

@nodejs/security-wg

Activity

  1. changed the title [-]OpenSSF scorecard permission[/-] [+]OpenSSF scorecard "Token-permissions" score zero[/+] on Mar 28, 2024
  2. metcoder95 commented on Mar 28, 2024

    @metcoder95
    Member

    #3013 closes this issue?

  3. fraxken commented on Mar 28, 2024

    @fraxken
    MemberAuthor

    #3013 closes this issue?

    Not yet. I'm working on nodejs workflow. If everything ok I will close myself (else I will open another PR).

  4. mweberxyz commented on Mar 28, 2024

    @mweberxyz
    Contributor

    My bad on that change. The GHA documentation is a bit bare on permissions, by not setting the global permissions does it essentially issue a full read-write token to the workflow?

    Edit: Nvm found it: https://docs.github.com/en/actions/security-guides/automatic-token-authentication
    These defaults are crazy permissive.

    Also just to confirm: Are job-level permissions additive to workflow-level?

    For example, in nightly at the workflow level we now have:

    permissions:
      contents: read
    

    then the report-failure job within that workflow:

      report-failure:
        permissions:
          issues: write
    

    So there's no need to explicitly set contents: read in the report-failure?

  5. fraxken commented on Mar 29, 2024

    @fraxken
    MemberAuthor

    My bad on that change. The GHA documentation is a bit bare on permissions, by not setting the global permissions does it essentially issue a full read-write token to the workflow?

    I think it depend on the Github permission setting (but by default yes it has read-write almost everywhere).

    Also just to confirm: Are job-level permissions additive to workflow-level?

    Yes. The basic idea is to set read at the root and then assign the right permission by jobs.

    You can read more here about how OpenSSF scorecard build the score (there is also some tips and links).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions