Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

E208: Added MissingFilePermissionsRule #943

Merged
merged 1 commit into from
Aug 12, 2020

Conversation

ssbarnea
Copy link
Member

@ssbarnea ssbarnea commented Aug 11, 2020

Makes missing file permissions a linting error in order to proactively detect security issues that were fixed via ansible/ansible#67794

While that was fixed in last Ansible hotfix, it changed default value and thus it has a high risk
of breaking any usage without mode.

Related: ansible/ansible#71200

@ssbarnea ssbarnea requested a review from webknjaz August 11, 2020 13:48
@ssbarnea ssbarnea force-pushed the feature/MissingFilePermissions branch 2 times, most recently from 25b987d to cb3a07d Compare August 11, 2020 14:31
@ssbarnea ssbarnea marked this pull request as ready for review August 11, 2020 14:31
@ssbarnea ssbarnea added this to the 4.3.0 milestone Aug 11, 2020
@ssbarnea ssbarnea force-pushed the feature/MissingFilePermissions branch from cb3a07d to 2d51ec6 Compare August 11, 2020 14:54
@ssbarnea ssbarnea self-assigned this Aug 11, 2020
@ssbarnea
Copy link
Member Author

recheck

@ssbarnea ssbarnea requested a review from awcrosby August 11, 2020 16:48
Copy link
Member

@webknjaz webknjaz left a comment

Choose a reason for hiding this comment

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

New tests mustn't use unittest.

test/TestMissingFilePermissionsRule.py Outdated Show resolved Hide resolved
test/conftest.py Outdated
def rule_runner(request):
"""Return runner for a specific rule class."""
rule_name = request.param
module = import_module(f"ansiblelint.rules.{rule_name}")
Copy link
Member

Choose a reason for hiding this comment

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

I don't think that imports should be delegated to the fixture.

Copy link
Member Author

Choose a reason for hiding this comment

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

That is only for internal use and not doing that would make its use much more complex, especially if we start to migrate tests to reuse the runner. The hole point of this fixture was to avoid the old repeating setUp code.

Copy link
Member

Choose a reason for hiding this comment

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

Import errors should be happening in the test modules, not in the middle of the machinery.

test/conftest.py Outdated Show resolved Hide resolved
Makes missing file permissions a linting error in order to proactively
detect security issues that were fixed via
ansible/ansible#67794 at the expense of
breaking usage that relied on default settings.
@ssbarnea ssbarnea force-pushed the feature/MissingFilePermissions branch from 941ac95 to 8a580e1 Compare August 12, 2020 12:07
@ssbarnea ssbarnea merged commit c2cb0a3 into master Aug 12, 2020
@ssbarnea ssbarnea changed the title Added MissingFilePermissionsRule E208: Added MissingFilePermissionsRule Aug 19, 2020
ssato added a commit to ssato/ansible-role-simple-httpd-example that referenced this pull request Aug 26, 2020
… by ansible

Unfortunatelly, catastrophic and (IMHO) completely wrong changes which
normal users don't expect, without enough discussions and notice to
users using security as an excuse, looks merged into ansible upstream.
To avoid accidents, we need to instruct ansible not change the file
permission mode *explicitly* as of now. See also the followings:

- ansible/ansible#71200
- ansible/ansible-lint#943
@ssbarnea ssbarnea deleted the feature/MissingFilePermissions branch January 1, 2021 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants