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

Don't add Website.can_read access to default roles. #13923

Conversation

jhtimmins
Copy link
Contributor

While fixing #13856, I made the mistake of adding Website.can_read to all roles, including default roles. This gives public, and thus anonymous, users access to the homepage, which shows an empty list of DAGs.

This fixes that bug by only adding Website.can_read to custom roles.

related: #13856

@boring-cyborg boring-cyborg bot added the area:webserver Webserver related Issues label Jan 27, 2021
Comment on lines +451 to +452
custom_roles = [role for role in self.get_all_roles() if role.name not in EXISTING_ROLES]
for role in custom_roles:
Copy link
Member

Choose a reason for hiding this comment

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

Can you add a test to prevent regression -- that checks that only custom roles have Website.can_read

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kaxil All roles except for Public will get Website.can_read. This is just only added to custom roles explicitly, since the default ones already have it. So mostly I just wanted to not give Public that access.

Still think it's worth adding a test to make sure that isn't available to Public?

Copy link
Member

Choose a reason for hiding this comment

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

I think we should have a test somewhere that verifies the exact permissions the public role is supposed to have

Copy link
Member

Choose a reason for hiding this comment

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

If we already have it, then not needed

Copy link
Member

Choose a reason for hiding this comment

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

@jhtimmins Can you make sure to add test (if it does not exist) in a follow up PR or the other PR that you have open

@kaxil kaxil added this to the Airflow 2.0.1 milestone Jan 27, 2021
@kaxil kaxil merged commit 70ce0d8 into apache:master Jan 28, 2021
@kaxil kaxil deleted the fix-bug-dont-add-website.can_read-to-public-role branch January 28, 2021 19:16
@Brett37490
Copy link

Brett37490 commented Jan 29, 2021 via email

kaxil pushed a commit that referenced this pull request Jan 29, 2021
In #13923, all permissions were removed from the Public role. This adds a test to ensure that the default public role doesn't have any permissions.

related: #13923
kaxil pushed a commit that referenced this pull request Jan 29, 2021
kaxil pushed a commit that referenced this pull request Jan 29, 2021
In #13923, all permissions were removed from the Public role. This adds a test to ensure that the default public role doesn't have any permissions.

related: #13923
(cherry picked from commit a52e77d)
kaxil pushed a commit that referenced this pull request Feb 4, 2021
kaxil pushed a commit that referenced this pull request Feb 4, 2021
In #13923, all permissions were removed from the Public role. This adds a test to ensure that the default public role doesn't have any permissions.

related: #13923
(cherry picked from commit a52e77d)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:webserver Webserver related Issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants