Skip to content

Commit

Permalink
Bugfix: Plugins endpoint was unauthenticated (#14570)
Browse files Browse the repository at this point in the history
The plugins endpoint missed auth check

(cherry picked from commit 0a969db)
  • Loading branch information
kaxil authored and ashb committed Apr 15, 2021
1 parent a156053 commit d6aa666
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions airflow/www/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2969,6 +2969,11 @@ class PluginView(AirflowBaseView):
]

@expose('/plugin')
@auth.has_access(
[
(permissions.ACTION_CAN_READ, permissions.RESOURCE_PLUGIN),
]
)
def list(self):
"""List loaded plugins."""
plugins_manager.ensure_plugins_loaded()
Expand Down
6 changes: 6 additions & 0 deletions tests/www/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,12 @@ def test_should_list_entrypoint_plugins_on_page_with_details(self):
self.check_content_in_response("source", resp)
self.check_content_in_response("<em>test-entrypoint-testpluginview==1.0.0:</em> <Mock id=", resp)

def test_endpoint_should_not_be_unauthenticated(self):
self.logout()
resp = self.client.get('/plugin', follow_redirects=True)
self.check_content_not_in_response("test_plugin", resp)
self.check_content_in_response("Sign In", resp)


class TestPoolModelView(TestBase):
def setUp(self):
Expand Down

0 comments on commit d6aa666

Please sign in to comment.