Skip to content

[github action] Follow the principle of least privileges#7673

Merged
Pierre-Sassoulas merged 1 commit intopylint-dev:mainfrom
Pierre-Sassoulas:set-minimal-right-in-github-action-workflow
Oct 26, 2022
Merged

[github action] Follow the principle of least privileges#7673
Pierre-Sassoulas merged 1 commit intopylint-dev:mainfrom
Pierre-Sassoulas:set-minimal-right-in-github-action-workflow

Conversation

@Pierre-Sassoulas
Copy link
Copy Markdown
Member

Type of Changes

Type
🐛 Bug fix

Description

This set the least amount of privilege for each github actions when it wasn't already set.

Full disclosure, I'm being paid to make pylint more secure by Tidelift and this is part of this effort.

@Pierre-Sassoulas Pierre-Sassoulas added Maintenance Discussion or action around maintaining pylint or the dev workflow Skip news 🔇 This change does not require a changelog entry labels Oct 25, 2022
@coveralls
Copy link
Copy Markdown

coveralls commented Oct 25, 2022

Pull Request Test Coverage Report for Build 3323819181

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 95.359%

Totals Coverage Status
Change from base Build 3323803614: 0.0%
Covered Lines: 17178
Relevant Lines: 18014

💛 - Coveralls

@github-actions

This comment has been minimized.

@Pierre-Sassoulas Pierre-Sassoulas force-pushed the set-minimal-right-in-github-action-workflow branch from ba1cd22 to 6b89f53 Compare October 25, 2022 19:49
@Pierre-Sassoulas
Copy link
Copy Markdown
Member Author

@cdce8p Let's use this MR to check that #7674 #7671 worked correctly.

@github-actions
Copy link
Copy Markdown
Contributor

🤖 Effect of this PR on checked open source code: 🤖

Effect on pytest:
The following messages are now emitted:

Details
  1. inconsistent-return-statements:
    Either all return statements in a function should return an expression, or none of them should.
    https://github.com/pytest-dev/pytest/blob/bbe7cbae4aa24f4cb65230704b870c5dcf40781e/src/_pytest/pytester.py#L301
  2. no-name-in-module:
    No name 'NOSE_SUPPORT_METHOD' in module '_pytest.deprecated'
    https://github.com/pytest-dev/pytest/blob/bbe7cbae4aa24f4cb65230704b870c5dcf40781e/src/_pytest/python.py#L62
  3. no-name-in-module:
    No name 'PytestReturnNotNoneWarning' in module '_pytest.warning_types'
    https://github.com/pytest-dev/pytest/blob/bbe7cbae4aa24f4cb65230704b870c5dcf40781e/src/_pytest/python.py#L81
  4. inconsistent-return-statements:
    Either all return statements in a function should return an expression, or none of them should.
    https://github.com/pytest-dev/pytest/blob/bbe7cbae4aa24f4cb65230704b870c5dcf40781e/src/_pytest/python.py#L1085
  5. inconsistent-return-statements:
    Either all return statements in a function should return an expression, or none of them should.
    https://github.com/pytest-dev/pytest/blob/bbe7cbae4aa24f4cb65230704b870c5dcf40781e/src/_pytest/fixtures.py#L130
  6. inconsistent-return-statements:
    Either all return statements in a function should return an expression, or none of them should.
    https://github.com/pytest-dev/pytest/blob/bbe7cbae4aa24f4cb65230704b870c5dcf40781e/src/_pytest/python_api.py#L798
  7. no-name-in-module:
    No name 'NOSE_SUPPORT' in module '_pytest.deprecated'
    https://github.com/pytest-dev/pytest/blob/bbe7cbae4aa24f4cb65230704b870c5dcf40781e/src/_pytest/nose.py#L5
  8. no-name-in-module:
    No name 'warn_explicit_for' in module '_pytest.warning_types'
    https://github.com/pytest-dev/pytest/blob/bbe7cbae4aa24f4cb65230704b870c5dcf40781e/src/_pytest/config/__init__.py#L62
  9. no-member:
    Module '_pytest.deprecated' has no 'HOOK_LEGACY_MARKING' member
    https://github.com/pytest-dev/pytest/blob/bbe7cbae4aa24f4cb65230704b870c5dcf40781e/src/_pytest/config/__init__.py#L369

This comment was generated for commit 6b89f53

@Pierre-Sassoulas Pierre-Sassoulas enabled auto-merge (squash) October 25, 2022 21:15
@cdce8p cdce8p disabled auto-merge October 26, 2022 08:17
Copy link
Copy Markdown
Member

@cdce8p cdce8p left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but I don't think it's necessary anymore.

The same can be archived by modifying the Action permissions -> Workflow permissions in the repo settings. I just toggled Read repository contents permission, so contents: read is the default for all workflows.

--
FYI I also modified a few other Action permissions settings to increase security.

  • Disabled Allow Github Actions to create and approve pull requests
  • Only allow specific / predefined actions and reusable workflows.

@Pierre-Sassoulas Pierre-Sassoulas merged commit a30236d into pylint-dev:main Oct 26, 2022
@Pierre-Sassoulas Pierre-Sassoulas deleted the set-minimal-right-in-github-action-workflow branch October 26, 2022 09:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Maintenance Discussion or action around maintaining pylint or the dev workflow Skip news 🔇 This change does not require a changelog entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants