You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/10/03 18:42:45 UTC

[GitHub] [airflow] rafaelpierre opened a new pull request #11185: Add LegacyUIDeprecated rule and unittests

rafaelpierre opened a new pull request #11185:
URL: https://github.com/apache/airflow/pull/11185


   <!--
   Thank you for contributing! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   In case of existing issue, reference it using one of the following:
   
   closes: #ISSUE
   related: #ISSUE
   
   How to write a good git commit message:
   http://chris.beams.io/posts/git-commit/
   -->
   
   Adds LegacyUIDeprecated rule to ```upgrade/rules``` as per:
   
   https://github.com/apache/airflow/blob/master/UPDATING.md#drop-legacy-ui-in-favor-of-fab-rbac-ui
   
   Closes: [#11019 ](https://github.com/apache/airflow/issues/11050)
   
   ---
   **^ Add meaningful description above**
   
   Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#pull-request-guidelines)** for more information.
   In case of fundamental code change, Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvements+Proposals)) is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
   In case of backwards incompatible changes please leave a note in [UPDATING.md](https://github.com/apache/airflow/blob/master/UPDATING.md).
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] rafaelpierre commented on pull request #11185: Add LegacyUIDeprecated rule and unittests

Posted by GitBox <gi...@apache.org>.
rafaelpierre commented on pull request #11185:
URL: https://github.com/apache/airflow/pull/11185#issuecomment-702619512


   @turbaszek replaced one quote with three quotes in the test msg, should be fine now


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] rafaelpierre closed pull request #11185: Add LegacyUIDeprecated rule and unittests

Posted by GitBox <gi...@apache.org>.
rafaelpierre closed pull request #11185:
URL: https://github.com/apache/airflow/pull/11185


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] rafaelpierre commented on pull request #11185: Add LegacyUIDeprecated rule and unittests

Posted by GitBox <gi...@apache.org>.
rafaelpierre commented on pull request #11185:
URL: https://github.com/apache/airflow/pull/11185#issuecomment-703280189


   rebased PR with changes for fixing CI issues. added test if rbac is None


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] turbaszek commented on pull request #11185: Add LegacyUIDeprecated rule and unittests

Posted by GitBox <gi...@apache.org>.
turbaszek commented on pull request #11185:
URL: https://github.com/apache/airflow/pull/11185#issuecomment-703292539


   @rafaelpierre can you please take a look at the CI problems:
   ```
   tests/upgrade/rules/test_legacy_ui_deprecated.py:37:5: E303 too many blank lines (2)
   airflow/upgrade/rules/legacy_ui_deprecated.py:32:111: E501 line too long (118 > 110 characters)
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] turbaszek commented on pull request #11185: Add LegacyUIDeprecated rule and unittests

Posted by GitBox <gi...@apache.org>.
turbaszek commented on pull request #11185:
URL: https://github.com/apache/airflow/pull/11185#issuecomment-703281097


   @rafaelpierre if you would like I can help you with sorting out the commits πŸ‘ 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] rafaelpierre edited a comment on pull request #11185: Add LegacyUIDeprecated rule and unittests

Posted by GitBox <gi...@apache.org>.
rafaelpierre edited a comment on pull request #11185:
URL: https://github.com/apache/airflow/pull/11185#issuecomment-703284115


   @turbaszek much appreciated, thanks! I'm not that familiar with rebase :) one thing I'm struggling with is that I have already rebased, however it still shows that these files are conflicting:
   
   breeze-complete
   scripts/ci/libraries/_initialization.sh
   scripts/docker/install_mysql.sh
   
   however, if you look into the first file in the [my branch](https://github.com/rafaelpierre/airflow/blob/legacy-ui-deprecated-rule/breeze-complete), it doesn't have any conflict (line 138 looks the same as from v1-10-test)


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] github-actions[bot] commented on pull request #11185: Add LegacyUIDeprecated rule and unittests

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #11185:
URL: https://github.com/apache/airflow/pull/11185#issuecomment-703516054


   [The Build Workflow run](https://github.com/apache/airflow/actions/runs/289113853) is cancelling this PR. It has some failed jobs matching ^Pylint$,^Static checks$,^Build docs$,^Spell check docs$,^Backport packages$,^Checks: Helm tests$,^Test OpenAPI*.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] turbaszek commented on a change in pull request #11185: Add LegacyUIDeprecated rule and unittests

Posted by GitBox <gi...@apache.org>.
turbaszek commented on a change in pull request #11185:
URL: https://github.com/apache/airflow/pull/11185#discussion_r499268433



##########
File path: airflow/upgrade/rules/legacy_ui_deprecated.py
##########
@@ -0,0 +1,39 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from __future__ import absolute_import

Review comment:
       Is there any reason for this import?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] rafaelpierre commented on pull request #11185: Add LegacyUIDeprecated rule and unittests

Posted by GitBox <gi...@apache.org>.
rafaelpierre commented on pull request #11185:
URL: https://github.com/apache/airflow/pull/11185#issuecomment-703284115


   @turbaszek much appreciated, I'm not that familiar with rebase :) one thing I'm struggling with is that I have already rebased, however it still shows that these files are conflicting:
   
   breeze-complete
   scripts/ci/libraries/_initialization.sh
   scripts/docker/install_mysql.sh
   
   however, if you look into the first file in the [branch I created](https://github.com/rafaelpierre/airflow/blob/legacy-ui-deprecated-rule/breeze-complete), it doesn't have any conflict (line 138 looks the same as from v1-10-test)


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] mik-laj commented on a change in pull request #11185: Add LegacyUIDeprecated rule and unittests

Posted by GitBox <gi...@apache.org>.
mik-laj commented on a change in pull request #11185:
URL: https://github.com/apache/airflow/pull/11185#discussion_r496649451



##########
File path: airflow/upgrade/rules/legacy_ui_deprecated.py
##########
@@ -0,0 +1,32 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from __future__ import absolute_import
+
+from airflow.configuration import conf
+from airflow.upgrade.rules.base_rule import BaseRule
+
+
+class LegacyUIDeprecatedRule(BaseRule):
+    title = "RBAC is enabled by default"
+
+    description = "Legacy UI is deprecated. FAB RBAC is enabled by default in order to increase security."
+
+    def check(self):
+        rbac_conf = conf.get(section="webserver", key="rbac")
+        if not rbac_conf:

Review comment:
       Ideally you should use the same code as the actual webserver command.
   https://github.com/apache/airflow/blob/90e984f90b8384cc7a461d8340a48b95af272946/airflow/bin/cli.py#L1124
   https://github.com/apache/airflow/blob/90e984f90b8384cc7a461d8340a48b95af272946/airflow/settings.py#L44




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] turbaszek commented on a change in pull request #11185: Add LegacyUIDeprecated rule and unittests

Posted by GitBox <gi...@apache.org>.
turbaszek commented on a change in pull request #11185:
URL: https://github.com/apache/airflow/pull/11185#discussion_r499268515



##########
File path: airflow/upgrade/rules/legacy_ui_deprecated.py
##########
@@ -0,0 +1,39 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from __future__ import absolute_import
+
+from airflow.configuration import conf
+from airflow.upgrade.rules.base_rule import BaseRule
+
+
+class LegacyUIDeprecatedRule(BaseRule):
+    title = "RBAC is enabled by default"
+
+    description = "Legacy UI is deprecated. FAB RBAC is enabled by default in order to increase security."
+
+    def check(self):
+        rbac_conf = None
+
+        if conf.has_option("webserver", "rbac"):
+            rbac_conf = conf.get("webserver", "rbac")

Review comment:
       ```suggestion
           if conf.has_option("webserver", "rbac"):
               rbac_conf = conf.get("webserver", "rbac", fallback=None)
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] boring-cyborg[bot] commented on pull request #11185: Add LegacyUIDeprecated rule and unittests

Posted by GitBox <gi...@apache.org>.
boring-cyborg[bot] commented on pull request #11185:
URL: https://github.com/apache/airflow/pull/11185#issuecomment-700038266


   Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst)
   Here are some useful points:
   - Pay attention to the quality of your code (flake8, pylint and type annotations). Our [pre-commits]( https://github.com/apache/airflow/blob/master/STATIC_CODE_CHECKS.rst#prerequisites-for-pre-commit-hooks) will help you with that.
   - In case of a new feature add useful documentation (in docstrings or in `docs/` directory). Adding a new operator? Check this short [guide](https://github.com/apache/airflow/blob/master/docs/howto/custom-operator.rst) Consider adding an example DAG that shows how users should use it.
   - Consider using [Breeze environment](https://github.com/apache/airflow/blob/master/BREEZE.rst) for testing locally, it’s a heavy docker but it ships with a working Airflow and a lot of integrations.
   - Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
   - Please follow [ASF Code of Conduct](https://www.apache.org/foundation/policies/conduct) for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
   - Be sure to read the [Airflow Coding style]( https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#coding-style-and-best-practices).
   Apache Airflow is a community-driven project and together we are making it better πŸš€.
   In case of doubts contact the developers at:
   Mailing List: dev@airflow.apache.org
   Slack: https://s.apache.org/airflow-slack
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] turbaszek commented on a change in pull request #11185: Add LegacyUIDeprecated rule and unittests

Posted by GitBox <gi...@apache.org>.
turbaszek commented on a change in pull request #11185:
URL: https://github.com/apache/airflow/pull/11185#discussion_r496063253



##########
File path: airflow/upgrade/rules/legacy_ui_deprecated.py
##########
@@ -0,0 +1,37 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from __future__ import absolute_import
+
+from airflow.configuration import conf
+from airflow.upgrade.rules.base_rule import BaseRule
+
+
+class LegacyUIDeprecatedRule(BaseRule):
+    title = "RBAC is enabled by default"
+
+    description = """
+Legacy UI is deprecated. FAB RBAC is enabled by default in order to increase security.
+    """

Review comment:
       Please use single line string. Otherwise, there will be leading a new line in the message
   ```suggestion
       description = "Legacy UI is deprecated. FAB RBAC is enabled by default in order to increase security."
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] turbaszek commented on pull request #11185: Add LegacyUIDeprecated rule and unittests

Posted by GitBox <gi...@apache.org>.
turbaszek commented on pull request #11185:
URL: https://github.com/apache/airflow/pull/11185#issuecomment-703244497


   Please rebase your PR, we added few changes that should fix the CI issues. Please do rebase and try to avoid merge commits, more information:
   https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#id9


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] turbaszek commented on a change in pull request #11185: Add LegacyUIDeprecated rule and unittests

Posted by GitBox <gi...@apache.org>.
turbaszek commented on a change in pull request #11185:
URL: https://github.com/apache/airflow/pull/11185#discussion_r496064135



##########
File path: airflow/upgrade/rules/legacy_ui_deprecated.py
##########
@@ -0,0 +1,37 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from __future__ import absolute_import
+
+from airflow.configuration import conf
+from airflow.upgrade.rules.base_rule import BaseRule
+
+
+class LegacyUIDeprecatedRule(BaseRule):
+    title = "RBAC is enabled by default"
+
+    description = """
+Legacy UI is deprecated. FAB RBAC is enabled by default in order to increase security.
+    """
+
+    def check(self):
+        rbac_conf = conf.get(section="webserver", key="rbac")
+        if not rbac_conf:
+            msg = """rbac in airflow.cfg must be explicitly set empty as RBAC mechanism is enabled by default. """
+            return msg
+        else:
+            return []

Review comment:
       ```suggestion
           if not rbac_conf:
               msg = """rbac in airflow.cfg must be explicitly set empty as RBAC mechanism is enabled by default. """
   ```
   We can return None now, it was fixed in #11081 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] rafaelpierre commented on a change in pull request #11185: Add LegacyUIDeprecated rule and unittests

Posted by GitBox <gi...@apache.org>.
rafaelpierre commented on a change in pull request #11185:
URL: https://github.com/apache/airflow/pull/11185#discussion_r496470926



##########
File path: airflow/upgrade/rules/legacy_ui_deprecated.py
##########
@@ -0,0 +1,32 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from __future__ import absolute_import
+
+from airflow.configuration import conf
+from airflow.upgrade.rules.base_rule import BaseRule
+
+
+class LegacyUIDeprecatedRule(BaseRule):
+    title = "RBAC is enabled by default"
+
+    description = "Legacy UI is deprecated. FAB RBAC is enabled by default in order to increase security."
+
+    def check(self):
+        rbac_conf = conf.get(section="webserver", key="rbac")
+        if not rbac_conf:

Review comment:
       @mik-laj point taken, thanks. but then shouldn't we be checking if the user has set to **false**, and display the message if it's the case? If the user has rbac = true, we shouldn't display any message, should we?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] rafaelpierre commented on a change in pull request #11185: Add LegacyUIDeprecated rule and unittests

Posted by GitBox <gi...@apache.org>.
rafaelpierre commented on a change in pull request #11185:
URL: https://github.com/apache/airflow/pull/11185#discussion_r499268747



##########
File path: airflow/upgrade/rules/legacy_ui_deprecated.py
##########
@@ -0,0 +1,39 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from __future__ import absolute_import

Review comment:
       No, I will remove it




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] rafaelpierre edited a comment on pull request #11185: Add LegacyUIDeprecated rule and unittests

Posted by GitBox <gi...@apache.org>.
rafaelpierre edited a comment on pull request #11185:
URL: https://github.com/apache/airflow/pull/11185#issuecomment-703284115


   @turbaszek much appreciated, thanks! I'm not that familiar with rebase :) one thing I'm struggling with is that I have already rebased, however it still shows that these files are conflicting:
   
   breeze-complete
   scripts/ci/libraries/_initialization.sh
   scripts/docker/install_mysql.sh
   
   however, if you look into the first file in the [branch I created](https://github.com/rafaelpierre/airflow/blob/legacy-ui-deprecated-rule/breeze-complete), it doesn't have any conflict (line 138 looks the same as from v1-10-test)


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] rafaelpierre closed pull request #11185: Add LegacyUIDeprecated rule and unittests

Posted by GitBox <gi...@apache.org>.
rafaelpierre closed pull request #11185:
URL: https://github.com/apache/airflow/pull/11185


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] turbaszek commented on a change in pull request #11185: Add LegacyUIDeprecated rule and unittests

Posted by GitBox <gi...@apache.org>.
turbaszek commented on a change in pull request #11185:
URL: https://github.com/apache/airflow/pull/11185#discussion_r496063253



##########
File path: airflow/upgrade/rules/legacy_ui_deprecated.py
##########
@@ -0,0 +1,37 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from __future__ import absolute_import
+
+from airflow.configuration import conf
+from airflow.upgrade.rules.base_rule import BaseRule
+
+
+class LegacyUIDeprecatedRule(BaseRule):
+    title = "RBAC is enabled by default"
+
+    description = """
+Legacy UI is deprecated. FAB RBAC is enabled by default in order to increase security.
+    """

Review comment:
       Please use single line string. Otherwise, there will be leading a new line in the message




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] turbaszek commented on a change in pull request #11185: Add LegacyUIDeprecated rule and unittests

Posted by GitBox <gi...@apache.org>.
turbaszek commented on a change in pull request #11185:
URL: https://github.com/apache/airflow/pull/11185#discussion_r498473593



##########
File path: airflow/upgrade/rules/legacy_ui_deprecated.py
##########
@@ -0,0 +1,32 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from __future__ import absolute_import
+
+from airflow.configuration import conf
+from airflow.upgrade.rules.base_rule import BaseRule
+
+
+class LegacyUIDeprecatedRule(BaseRule):
+    title = "RBAC is enabled by default"
+
+    description = "Legacy UI is deprecated. FAB RBAC is enabled by default in order to increase security."
+
+    def check(self):
+        rbac_conf = conf.getboolean("webserver", "rbac")
+        if not rbac_conf:
+            msg = """rbac in airflow.cfg must be explicitly set empty as RBAC mechanism is enabled by default. """

Review comment:
       ```suggestion
               msg = "rbac in airflow.cfg must be explicitly set empty as RBAC mechanism is enabled by default. "
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] rafaelpierre commented on pull request #11185: Add LegacyUIDeprecated rule and unittests

Posted by GitBox <gi...@apache.org>.
rafaelpierre commented on pull request #11185:
URL: https://github.com/apache/airflow/pull/11185#issuecomment-703150795


   @turbaszek thanks for approving! just to check, should I close the PR? I noticed some of the tests are being skipped - from the logs it indicates that perhaps it is failing for Python 2.7
   
   ![image](https://user-images.githubusercontent.com/13171938/94999785-00c78b80-05bc-11eb-89f9-59b5f452038f.png)
   
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] rafaelpierre closed pull request #11185: Add LegacyUIDeprecated rule and unittests

Posted by GitBox <gi...@apache.org>.
rafaelpierre closed pull request #11185:
URL: https://github.com/apache/airflow/pull/11185


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] mik-laj commented on a change in pull request #11185: Add LegacyUIDeprecated rule and unittests

Posted by GitBox <gi...@apache.org>.
mik-laj commented on a change in pull request #11185:
URL: https://github.com/apache/airflow/pull/11185#discussion_r496222799



##########
File path: airflow/upgrade/rules/legacy_ui_deprecated.py
##########
@@ -0,0 +1,32 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from __future__ import absolute_import
+
+from airflow.configuration import conf
+from airflow.upgrade.rules.base_rule import BaseRule
+
+
+class LegacyUIDeprecatedRule(BaseRule):
+    title = "RBAC is enabled by default"
+
+    description = "Legacy UI is deprecated. FAB RBAC is enabled by default in order to increase security."
+
+    def check(self):
+        rbac_conf = conf.get(section="webserver", key="rbac")
+        if not rbac_conf:

Review comment:
       By default in 1.10, we have RBAC disabled. All users must migrate to RBAC prior to migration, so this option must be True (`conf.getboolean(section="webserver", key="rbac") == True`)
   See: https://github.com/apache/airflow/blob/master/UPDATING.md#drop-legacy-ui-in-favor-of-fab-rbac-ui
   
   > Before upgrading to this release, we recommend activating the new FAB RBAC UI. For that, you should set the rbac options in [webserver] in the airflow.cfg file to true




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] rafaelpierre commented on a change in pull request #11185: Add LegacyUIDeprecated rule and unittests

Posted by GitBox <gi...@apache.org>.
rafaelpierre commented on a change in pull request #11185:
URL: https://github.com/apache/airflow/pull/11185#discussion_r496104870



##########
File path: airflow/upgrade/rules/legacy_ui_deprecated.py
##########
@@ -0,0 +1,37 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from __future__ import absolute_import
+
+from airflow.configuration import conf
+from airflow.upgrade.rules.base_rule import BaseRule
+
+
+class LegacyUIDeprecatedRule(BaseRule):
+    title = "RBAC is enabled by default"
+
+    description = """
+Legacy UI is deprecated. FAB RBAC is enabled by default in order to increase security.
+    """

Review comment:
       Nice one, done

##########
File path: airflow/upgrade/rules/legacy_ui_deprecated.py
##########
@@ -0,0 +1,37 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from __future__ import absolute_import
+
+from airflow.configuration import conf
+from airflow.upgrade.rules.base_rule import BaseRule
+
+
+class LegacyUIDeprecatedRule(BaseRule):
+    title = "RBAC is enabled by default"
+
+    description = """
+Legacy UI is deprecated. FAB RBAC is enabled by default in order to increase security.
+    """
+
+    def check(self):
+        rbac_conf = conf.get(section="webserver", key="rbac")
+        if not rbac_conf:
+            msg = """rbac in airflow.cfg must be explicitly set empty as RBAC mechanism is enabled by default. """
+            return msg
+        else:
+            return []

Review comment:
       Done!




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] rafaelpierre commented on a change in pull request #11185: Add LegacyUIDeprecated rule and unittests

Posted by GitBox <gi...@apache.org>.
rafaelpierre commented on a change in pull request #11185:
URL: https://github.com/apache/airflow/pull/11185#discussion_r497300503



##########
File path: airflow/upgrade/rules/legacy_ui_deprecated.py
##########
@@ -0,0 +1,32 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from __future__ import absolute_import
+
+from airflow.configuration import conf
+from airflow.upgrade.rules.base_rule import BaseRule
+
+
+class LegacyUIDeprecatedRule(BaseRule):
+    title = "RBAC is enabled by default"
+
+    description = "Legacy UI is deprecated. FAB RBAC is enabled by default in order to increase security."
+
+    def check(self):
+        rbac_conf = conf.get(section="webserver", key="rbac")
+        if not rbac_conf:

Review comment:
       @mik-laj done. let me know if it is good to go or further adjustments are needed




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] github-actions[bot] commented on pull request #11185: Add LegacyUIDeprecated rule and unittests

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #11185:
URL: https://github.com/apache/airflow/pull/11185#issuecomment-703500878


   The CI and PROD Docker Images for the build are prepared in a separate "Build Image" workflow,
   that you will not see in the list of checks (you will see "Wait for images" jobs instead).
   
   You can checks the status of those images in [The workflow run](https://github.com/apache/airflow/actions/runs/289066117)


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] github-actions[bot] commented on pull request #11185: Add LegacyUIDeprecated rule and unittests

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #11185:
URL: https://github.com/apache/airflow/pull/11185#issuecomment-703504015


   The CI and PROD Docker Images for the build are prepared in a separate "Build Image" workflow,
   that you will not see in the list of checks (you will see "Wait for images" jobs instead).
   
   You can checks the status of those images in [The workflow run](https://github.com/apache/airflow/actions/runs/289075537)


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] turbaszek commented on a change in pull request #11185: Add LegacyUIDeprecated rule and unittests

Posted by GitBox <gi...@apache.org>.
turbaszek commented on a change in pull request #11185:
URL: https://github.com/apache/airflow/pull/11185#discussion_r499268572



##########
File path: airflow/upgrade/rules/legacy_ui_deprecated.py
##########
@@ -0,0 +1,39 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from __future__ import absolute_import
+
+from airflow.configuration import conf
+from airflow.upgrade.rules.base_rule import BaseRule
+
+
+class LegacyUIDeprecatedRule(BaseRule):
+    title = "RBAC is enabled by default"
+
+    description = "Legacy UI is deprecated. FAB RBAC is enabled by default in order to increase security."
+
+    def check(self):
+        rbac_conf = None
+
+        if conf.has_option("webserver", "rbac"):
+            rbac_conf = conf.get("webserver", "rbac")
+
+            if rbac_conf == "false":
+                msg = """rbac in airflow.cfg must be explicitly set empty as RBAC mechanism is enabled by default. """

Review comment:
       Probably we can use single quote string πŸ‘Œ  




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org