GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Document what permissions are required · Issue #464 · github/codeql-action

Document what permissions are required #464

New issue
Copy link
New issue
Copy link
Closed
#689
Closed
Document what permissions are required#464
#689
Copy link
Assignees
aeisenberg

Description

@brettcannon
brettcannon
opened on Apr 28, 2021
Issue body actions

We switched our repo to the default read-only permissions for GitHub Actions and our CodeQL workflow started to fail. Based on the failure message it seems the statuses: write permission is required.

P.S. Sorry to file an issue when the issue template selector only says to open an issue with GitHub Support, but none of the options really made sense since there's not "issues with a GitHub project" option.

Reacted by Evan Lowry, Jarek Potiuk and Jamie Wilkinson

Activity

Next
  1. aeisenberg commented on Apr 28, 2021

    @aeisenberg
    aeisenberg
    on Apr 28, 2021
    Contributor
    More actions

    Thanks, @brettcannon! Let me look at that.

    We should also revisit our issue templates.

  2. aeisenberg
    self-assigned this
    on Apr 28, 2021
  3. aeisenberg commented on Apr 28, 2021

    @aeisenberg
    aeisenberg
    on Apr 28, 2021
    Contributor
    More actions

    As far as I can tell, if you are using the default workflow, you should only need the following permissions:

        permissions:
          contents: read
          security-events: write
          pull-requests: read
    

    Is your workflow doing anything special?

  4. The-Compiler commented on Apr 28, 2021

    @The-Compiler
    The-Compiler
    on Apr 28, 2021
    Contributor
    More actions

    @aeisenberg I'm not entirely sure if you're aware (apologies if you are!), but there was a recent change which allows restricting the default GitHub secret to read-only access.

    This seems like an excellent best practice to follow (principle of least privilege), but indeed the CodeQL action fails with a non-obvious error message:

    [...]
      request: {
        method: 'PUT',
        url: 'https://api.github.com/repos/qutebrowser/qutebrowser/code-scanning/analysis/status',
        headers: {
          accept: 'application/vnd.github.v3+json',
          'user-agent': 'CodeQL Action octokit-core.js/3.1.2 Node.js/12.13.1 (linux; x64)',
          authorization: 'token [REDACTED]',
          'content-type': 'application/json; charset=utf-8'
        },
        body: [...]
        request: { agent: [Agent], hook: [Function: bound bound register] }
      },
      documentation_url: 'https://docs.github.com/rest'
    }
    Error: Resource not accessible by integration
    

    like @brettcannon I initially suspected it'd need statuses: write (based on the API URL used), but that didn't help.

    Indeed just setting:

    permissions:
      security-events: write

    seemed to fix this for me, but I probably wouldn't have found if it wasn't for this issue.

    Reacted by Max Milton, Jamie Wilkinson and RoseSecurity
  5. brettcannon
    added a commit that references this issue on Apr 28, 2021

    Use security-events as the permission for CodeQL

    72ae545
  6. brettcannon commented on Apr 28, 2021

    @brettcannon
    brettcannon
    on Apr 28, 2021
    Author
    More actions

    @aeisenberg It's the vanilla workflow with just the languages we don't use left out: https://github.com/microsoft/vscode-python/blob/main/.github/workflows/codeql-analysis.yml.

    But you and the @The-Compiler have the solution I was after and couldn't find in the docs! We have flipped all of our repos to the read-only access on workflows, hence the sudden failure (thanks for the forcing function, codecov 😉 ).

    Reacted by Freya Bruhin
  7. aeisenberg commented on Apr 28, 2021

    @aeisenberg
    aeisenberg
    on Apr 28, 2021
    Contributor
    More actions

    Glad this worked out for you. We've recently (ie- yesterday) moved over to using permissions on our own repositories and workflows, so we are still figuring this out ourselves.

    It sounds like the best solution here is to update the documentation.

    Reacted by Max Milton
  8. aeisenberg commented on Apr 28, 2021

    @aeisenberg
    aeisenberg
    on Apr 28, 2021
    Contributor
    More actions

    It's possible that you will also need the: actions: read permission. Some code flows will make requests to introspect the current workflow and this permission is needed. So, if you get any more failures, try adding that permission as well.

  9. charleskorn
    added a commit that references this issue on May 11, 2021

    Allow CodeQL job to write security events.

    3906a27
  10. samth
    added a commit that references this issue on May 12, 2021

    Fix permissions.

    223b964
  11. maueroats
    added 2 commits that reference this issue on Jun 17, 2021

    Fix permissions.

    4f4a2c2

    Fix permissions.

    2581985
  12. NicolasT
    added 2 commits that reference this issue on Jun 23, 2021

    ci: set explicit permissions on `code-analysis` workflow

    7d21015

    ci: set explicit permissions on `code-analysis` workflow

    2e85467
  13. potiuk
    added a commit that references this issue on Jun 25, 2021

    Fix permissions for CodeQL workflows

    f467ffd
  14. 20 remaining items

  15. chensation
    added a commit that references this issue on Apr 2, 2024

    added security-events write permission to codeql (#893)

    61fe5c7
  16. kosteev
    added 3 commits that reference this issue on Sep 12, 2024

    Fix permissions for CodeQL workflows (#16660)

    2ffe829

    Fix permissions for CodeQL workflows (#16660)

    9b46cb9

    Fix permissions for CodeQL workflows (#16660)

    fa03963
  17. kosteev
    added a commit that references this issue on Nov 7, 2024

    Fix permissions for CodeQL workflows (#16660)

    1718903
  18. jas88
    added a commit that references this issue on Nov 24, 2024

    Adjust permissions for CodeQL per github/codeql-action#464

    8967803
  19. kosteev
    added a commit that references this issue on May 1, 2025

    Fix permissions for CodeQL workflows (#16660)

    f2e749d
  20. kosteev
    added a commit that references this issue on May 22, 2025

    Fix permissions for CodeQL workflows (#16660)

    8c3b264
  21. kosteev
    added a commit that references this issue on Sep 17, 2025

    Fix permissions for CodeQL workflows (#16660)

    a76494d
  22. kosteev
    added a commit that references this issue on Oct 16, 2025

    Fix permissions for CodeQL workflows (#16660)

    64a14d3
  23. kosteev
    added a commit that references this issue on Feb 20, 2026

    Fix permissions for CodeQL workflows (#16660)

    f948741
  24. kosteev
    added a commit that references this issue on Apr 27, 2026

    Fix permissions for CodeQL workflows (#16660)

    e79124e
  25. kosteev
    added 2 commits that reference this issue on Jul 22, 2026

    Fix permissions for CodeQL workflows (#16660)

    f7a6ac3

    Fix permissions for CodeQL workflows (#16660)

    a571ddc
  26. kosteev
    added a commit that references this issue on Aug 29, 2026

    Fix permissions for CodeQL workflows (#16660)

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

Metadata

Metadata

Assignees

  • @aeisenberg
    aeisenberg

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.