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/02/20 09:44:00 UTC
[GitHub] [airflow] anitakar opened a new pull request #7472: [AIRFLOW-6850]
Handle no access to code in UI
anitakar opened a new pull request #7472: [AIRFLOW-6850] Handle no access to code in UI
URL: https://github.com/apache/airflow/pull/7472
---
Issue link: WILL BE INSERTED BY [boring-cyborg](https://github.com/kaxil/boring-cyborg)
Make sure to mark the boxes below before creating PR: [x]
- [ ] Description above provides context of the change
- [ ] Commit message/PR title starts with `[AIRFLOW-NNNN]`. AIRFLOW-NNNN = JIRA ID<sup>*</sup>
- [ ] Unit tests coverage for changes (not needed for documentation changes)
- [ ] Commits follow "[How to write a good git commit message](http://chris.beams.io/posts/git-commit/)"
- [ ] Relevant documentation is updated including usage instructions.
- [ ] I will engage committers as explained in [Contribution Workflow Example](https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#contribution-workflow-example).
<sup>*</sup> For document-only changes commit message can start with `[AIRFLOW-XXXX]`.
---
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).
Read the [Pull Request Guidelines](https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#pull-request-guidelines) for more information.
----------------------------------------------------------------
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
With regards,
Apache Git Services
[GitHub] [airflow] anitakar commented on a change in pull request #7472:
[AIRFLOW-6850] Handle no access to code in UI
Posted by GitBox <gi...@apache.org>.
anitakar commented on a change in pull request #7472: [AIRFLOW-6850] Handle no access to code in UI
URL: https://github.com/apache/airflow/pull/7472#discussion_r381951456
##########
File path: airflow/www/templates/airflow/dag_code.html
##########
@@ -31,7 +31,7 @@ <h4>{{ title }}</h4>
{% endblock %}
{% block tail %}
- {{ super() }}
+ {{ super() if dag else '' }}
Review comment:
Otherwise dag page rendering fails on accessing dag attributes when dag 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
With regards,
Apache Git Services
[GitHub] [airflow] ashb commented on a change in pull request #7472:
[AIRFLOW-6850] Handle no access to code in UI
Posted by GitBox <gi...@apache.org>.
ashb commented on a change in pull request #7472: [AIRFLOW-6850] Handle no access to code in UI
URL: https://github.com/apache/airflow/pull/7472#discussion_r382568842
##########
File path: airflow/www/views.py
##########
@@ -529,7 +529,7 @@ def code(self, session=None):
html_code = highlight(
code, lexers.PythonLexer(), HtmlFormatter(linenos=True))
except OSError as e:
- html_code = str(e)
+ html_code = 'Failed to load file.<br/> Details: ' + str(e)
Review comment:
```suggestion
html_code = 'Failed to load file.<br/> Details: ' + escape(str(e))
```
Should use https://flask.palletsprojects.com/en/1.1.x/api/?highlight=safe#flask.escape
----------------------------------------------------------------
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
With regards,
Apache Git Services
[GitHub] [airflow] anitakar commented on a change in pull request #7472:
[AIRFLOW-6850] Handle no access to code in UI
Posted by GitBox <gi...@apache.org>.
anitakar commented on a change in pull request #7472: [AIRFLOW-6850] Handle no access to code in UI
URL: https://github.com/apache/airflow/pull/7472#discussion_r381951179
##########
File path: airflow/www/views.py
##########
@@ -528,8 +528,9 @@ def code(self, session=None):
code = f.read()
html_code = highlight(
code, lexers.PythonLexer(), HtmlFormatter(linenos=True))
- except OSError as e:
- html_code = str(e)
+ except Exception as e:
Review comment:
Because with the test I got AttributeError None object doe not have dag_id.
This was me trying to patch it up.
----------------------------------------------------------------
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
With regards,
Apache Git Services
[GitHub] [airflow] codecov-io commented on issue #7472: [AIRFLOW-6850]
Handle no access to code in UI
Posted by GitBox <gi...@apache.org>.
codecov-io commented on issue #7472: [AIRFLOW-6850] Handle no access to code in UI
URL: https://github.com/apache/airflow/pull/7472#issuecomment-588964651
# [Codecov](https://codecov.io/gh/apache/airflow/pull/7472?src=pr&el=h1) Report
> Merging [#7472](https://codecov.io/gh/apache/airflow/pull/7472?src=pr&el=desc) into [master](https://codecov.io/gh/apache/airflow/commit/d1ab3705d3d03f68abc2b900ebb35e8497dee2e7?src=pr&el=desc) will **increase** coverage by `0.04%`.
> The diff coverage is `100%`.
[![Impacted file tree graph](https://codecov.io/gh/apache/airflow/pull/7472/graphs/tree.svg?width=650&token=WdLKlKHOAU&height=150&src=pr)](https://codecov.io/gh/apache/airflow/pull/7472?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #7472 +/- ##
==========================================
+ Coverage 86.64% 86.68% +0.04%
==========================================
Files 878 882 +4
Lines 41219 41526 +307
==========================================
+ Hits 35715 35998 +283
- Misses 5504 5528 +24
```
| [Impacted Files](https://codecov.io/gh/apache/airflow/pull/7472?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [airflow/www/views.py](https://codecov.io/gh/apache/airflow/pull/7472/diff?src=pr&el=tree#diff-YWlyZmxvdy93d3cvdmlld3MucHk=) | `76.35% <100%> (+0.13%)` | :arrow_up: |
| [.../microsoft/azure/hooks/azure\_container\_instance.py](https://codecov.io/gh/apache/airflow/pull/7472/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvbWljcm9zb2Z0L2F6dXJlL2hvb2tzL2F6dXJlX2NvbnRhaW5lcl9pbnN0YW5jZS5weQ==) | `65.38% <0%> (-2.62%)` | :arrow_down: |
| [airflow/configuration.py](https://codecov.io/gh/apache/airflow/pull/7472/diff?src=pr&el=tree#diff-YWlyZmxvdy9jb25maWd1cmF0aW9uLnB5) | `87.81% <0%> (-0.21%)` | :arrow_down: |
| [airflow/utils/dag\_processing.py](https://codecov.io/gh/apache/airflow/pull/7472/diff?src=pr&el=tree#diff-YWlyZmxvdy91dGlscy9kYWdfcHJvY2Vzc2luZy5weQ==) | `87.93% <0%> (-0.2%)` | :arrow_down: |
| [airflow/config\_templates/default\_celery.py](https://codecov.io/gh/apache/airflow/pull/7472/diff?src=pr&el=tree#diff-YWlyZmxvdy9jb25maWdfdGVtcGxhdGVzL2RlZmF1bHRfY2VsZXJ5LnB5) | `52.94% <0%> (ø)` | :arrow_up: |
| [airflow/contrib/hooks/aws\_hook.py](https://codecov.io/gh/apache/airflow/pull/7472/diff?src=pr&el=tree#diff-YWlyZmxvdy9jb250cmliL2hvb2tzL2F3c19ob29rLnB5) | `100% <0%> (ø)` | :arrow_up: |
| [airflow/models/connection.py](https://codecov.io/gh/apache/airflow/pull/7472/diff?src=pr&el=tree#diff-YWlyZmxvdy9tb2RlbHMvY29ubmVjdGlvbi5weQ==) | `95.07% <0%> (ø)` | :arrow_up: |
| [airflow/providers/amazon/aws/hooks/aws\_hook.py](https://codecov.io/gh/apache/airflow/pull/7472/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvYW1hem9uL2F3cy9ob29rcy9hd3NfaG9vay5weQ==) | | |
| [...iders/qubole/example\_dags/example\_qubole\_sensor.py](https://codecov.io/gh/apache/airflow/pull/7472/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvcXVib2xlL2V4YW1wbGVfZGFncy9leGFtcGxlX3F1Ym9sZV9zZW5zb3IucHk=) | | |
| [...s/google/suite/operators/gcs\_to\_gdrive\_operator.py](https://codecov.io/gh/apache/airflow/pull/7472/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvZ29vZ2xlL3N1aXRlL29wZXJhdG9ycy9nY3NfdG9fZ2RyaXZlX29wZXJhdG9yLnB5) | | |
| ... and [29 more](https://codecov.io/gh/apache/airflow/pull/7472/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/airflow/pull/7472?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/airflow/pull/7472?src=pr&el=footer). Last update [d1ab370...3d240e3](https://codecov.io/gh/apache/airflow/pull/7472?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
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
With regards,
Apache Git Services
[GitHub] [airflow] codecov-io edited a comment on issue #7472:
[AIRFLOW-6850] Handle no access to code in UI
Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on issue #7472: [AIRFLOW-6850] Handle no access to code in UI
URL: https://github.com/apache/airflow/pull/7472#issuecomment-588964651
# [Codecov](https://codecov.io/gh/apache/airflow/pull/7472?src=pr&el=h1) Report
> Merging [#7472](https://codecov.io/gh/apache/airflow/pull/7472?src=pr&el=desc) into [master](https://codecov.io/gh/apache/airflow/commit/d1ab3705d3d03f68abc2b900ebb35e8497dee2e7?src=pr&el=desc) will **increase** coverage by `0.14%`.
> The diff coverage is `100%`.
[![Impacted file tree graph](https://codecov.io/gh/apache/airflow/pull/7472/graphs/tree.svg?width=650&token=WdLKlKHOAU&height=150&src=pr)](https://codecov.io/gh/apache/airflow/pull/7472?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #7472 +/- ##
==========================================
+ Coverage 86.64% 86.79% +0.14%
==========================================
Files 878 887 +9
Lines 41219 41977 +758
==========================================
+ Hits 35715 36432 +717
- Misses 5504 5545 +41
```
| [Impacted Files](https://codecov.io/gh/apache/airflow/pull/7472?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [airflow/www/views.py](https://codecov.io/gh/apache/airflow/pull/7472/diff?src=pr&el=tree#diff-YWlyZmxvdy93d3cvdmlld3MucHk=) | `76.37% <100%> (+0.14%)` | :arrow_up: |
| [...w/providers/apache/hive/operators/mysql\_to\_hive.py](https://codecov.io/gh/apache/airflow/pull/7472/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvYXBhY2hlL2hpdmUvb3BlcmF0b3JzL215c3FsX3RvX2hpdmUucHk=) | `100% <0%> (ø)` | :arrow_up: |
| [airflow/security/kerberos.py](https://codecov.io/gh/apache/airflow/pull/7472/diff?src=pr&el=tree#diff-YWlyZmxvdy9zZWN1cml0eS9rZXJiZXJvcy5weQ==) | `76.08% <0%> (ø)` | :arrow_up: |
| [airflow/providers/mysql/operators/mysql.py](https://codecov.io/gh/apache/airflow/pull/7472/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvbXlzcWwvb3BlcmF0b3JzL215c3FsLnB5) | `100% <0%> (ø)` | :arrow_up: |
| [...oogle/marketing\_platform/hooks/campaign\_manager.py](https://codecov.io/gh/apache/airflow/pull/7472/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvZ29vZ2xlL21hcmtldGluZ19wbGF0Zm9ybS9ob29rcy9jYW1wYWlnbl9tYW5hZ2VyLnB5) | `89.23% <0%> (-10.77%)` | :arrow_down: |
| [...\_platform/example\_dags/example\_campaign\_manager.py](https://codecov.io/gh/apache/airflow/pull/7472/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvZ29vZ2xlL21hcmtldGluZ19wbGF0Zm9ybS9leGFtcGxlX2RhZ3MvZXhhbXBsZV9jYW1wYWlnbl9tYW5hZ2VyLnB5) | `93.93% <0%> (-6.07%)` | :arrow_down: |
| [.../microsoft/azure/hooks/azure\_container\_instance.py](https://codecov.io/gh/apache/airflow/pull/7472/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvbWljcm9zb2Z0L2F6dXJlL2hvb2tzL2F6dXJlX2NvbnRhaW5lcl9pbnN0YW5jZS5weQ==) | `65.38% <0%> (-2.62%)` | :arrow_down: |
| [airflow/providers/apache/hive/hooks/hive.py](https://codecov.io/gh/apache/airflow/pull/7472/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvYXBhY2hlL2hpdmUvaG9va3MvaGl2ZS5weQ==) | `77.55% <0%> (ø)` | :arrow_up: |
| [airflow/hooks/dbapi\_hook.py](https://codecov.io/gh/apache/airflow/pull/7472/diff?src=pr&el=tree#diff-YWlyZmxvdy9ob29rcy9kYmFwaV9ob29rLnB5) | `91.73% <0%> (ø)` | :arrow_up: |
| [airflow/providers/google/cloud/hooks/base.py](https://codecov.io/gh/apache/airflow/pull/7472/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvZ29vZ2xlL2Nsb3VkL2hvb2tzL2Jhc2UucHk=) | `95.9% <0%> (-0.55%)` | :arrow_down: |
| ... and [69 more](https://codecov.io/gh/apache/airflow/pull/7472/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/airflow/pull/7472?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/airflow/pull/7472?src=pr&el=footer). Last update [d1ab370...3ec0a0c](https://codecov.io/gh/apache/airflow/pull/7472?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
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
With regards,
Apache Git Services
[GitHub] [airflow] codecov-io edited a comment on issue #7472:
[AIRFLOW-6850] Handle no access to code in UI
Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on issue #7472: [AIRFLOW-6850] Handle no access to code in UI
URL: https://github.com/apache/airflow/pull/7472#issuecomment-588964651
# [Codecov](https://codecov.io/gh/apache/airflow/pull/7472?src=pr&el=h1) Report
> Merging [#7472](https://codecov.io/gh/apache/airflow/pull/7472?src=pr&el=desc) into [master](https://codecov.io/gh/apache/airflow/commit/d1ab3705d3d03f68abc2b900ebb35e8497dee2e7?src=pr&el=desc) will **decrease** coverage by `0.39%`.
> The diff coverage is `100%`.
[![Impacted file tree graph](https://codecov.io/gh/apache/airflow/pull/7472/graphs/tree.svg?width=650&token=WdLKlKHOAU&height=150&src=pr)](https://codecov.io/gh/apache/airflow/pull/7472?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #7472 +/- ##
=========================================
- Coverage 86.64% 86.25% -0.4%
=========================================
Files 878 883 +5
Lines 41219 41635 +416
=========================================
+ Hits 35715 35911 +196
- Misses 5504 5724 +220
```
| [Impacted Files](https://codecov.io/gh/apache/airflow/pull/7472?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [airflow/www/views.py](https://codecov.io/gh/apache/airflow/pull/7472/diff?src=pr&el=tree#diff-YWlyZmxvdy93d3cvdmlld3MucHk=) | `76.35% <100%> (+0.13%)` | :arrow_up: |
| [...w/providers/apache/hive/operators/mysql\_to\_hive.py](https://codecov.io/gh/apache/airflow/pull/7472/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvYXBhY2hlL2hpdmUvb3BlcmF0b3JzL215c3FsX3RvX2hpdmUucHk=) | `35.84% <0%> (-64.16%)` | :arrow_down: |
| [airflow/kubernetes/volume\_mount.py](https://codecov.io/gh/apache/airflow/pull/7472/diff?src=pr&el=tree#diff-YWlyZmxvdy9rdWJlcm5ldGVzL3ZvbHVtZV9tb3VudC5weQ==) | `44.44% <0%> (-55.56%)` | :arrow_down: |
| [airflow/kubernetes/volume.py](https://codecov.io/gh/apache/airflow/pull/7472/diff?src=pr&el=tree#diff-YWlyZmxvdy9rdWJlcm5ldGVzL3ZvbHVtZS5weQ==) | `52.94% <0%> (-47.06%)` | :arrow_down: |
| [airflow/security/kerberos.py](https://codecov.io/gh/apache/airflow/pull/7472/diff?src=pr&el=tree#diff-YWlyZmxvdy9zZWN1cml0eS9rZXJiZXJvcy5weQ==) | `30.43% <0%> (-45.66%)` | :arrow_down: |
| [airflow/kubernetes/pod\_launcher.py](https://codecov.io/gh/apache/airflow/pull/7472/diff?src=pr&el=tree#diff-YWlyZmxvdy9rdWJlcm5ldGVzL3BvZF9sYXVuY2hlci5weQ==) | `47.18% <0%> (-45.08%)` | :arrow_down: |
| [airflow/providers/mysql/operators/mysql.py](https://codecov.io/gh/apache/airflow/pull/7472/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvbXlzcWwvb3BlcmF0b3JzL215c3FsLnB5) | `55% <0%> (-45%)` | :arrow_down: |
| [...viders/cncf/kubernetes/operators/kubernetes\_pod.py](https://codecov.io/gh/apache/airflow/pull/7472/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvY25jZi9rdWJlcm5ldGVzL29wZXJhdG9ycy9rdWJlcm5ldGVzX3BvZC5weQ==) | `69.38% <0%> (-25.52%)` | :arrow_down: |
| [airflow/kubernetes/refresh\_config.py](https://codecov.io/gh/apache/airflow/pull/7472/diff?src=pr&el=tree#diff-YWlyZmxvdy9rdWJlcm5ldGVzL3JlZnJlc2hfY29uZmlnLnB5) | `50.98% <0%> (-23.53%)` | :arrow_down: |
| [...oogle/marketing\_platform/hooks/campaign\_manager.py](https://codecov.io/gh/apache/airflow/pull/7472/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvZ29vZ2xlL21hcmtldGluZ19wbGF0Zm9ybS9ob29rcy9jYW1wYWlnbl9tYW5hZ2VyLnB5) | `89.23% <0%> (-10.77%)` | :arrow_down: |
| ... and [57 more](https://codecov.io/gh/apache/airflow/pull/7472/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/airflow/pull/7472?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/airflow/pull/7472?src=pr&el=footer). Last update [d1ab370...0ac31f4](https://codecov.io/gh/apache/airflow/pull/7472?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
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
With regards,
Apache Git Services
[GitHub] [airflow] ashb commented on a change in pull request #7472:
[AIRFLOW-6850] Handle no access to code in UI
Posted by GitBox <gi...@apache.org>.
ashb commented on a change in pull request #7472: [AIRFLOW-6850] Handle no access to code in UI
URL: https://github.com/apache/airflow/pull/7472#discussion_r381931660
##########
File path: airflow/www/views.py
##########
@@ -528,8 +528,9 @@ def code(self, session=None):
code = f.read()
html_code = highlight(
code, lexers.PythonLexer(), HtmlFormatter(linenos=True))
- except OSError as e:
- html_code = str(e)
+ except Exception as e:
Review comment:
This is a very broad exception. Why the change?
----------------------------------------------------------------
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
With regards,
Apache Git Services
[GitHub] [airflow] codecov-io edited a comment on issue #7472:
[AIRFLOW-6850] Handle no access to code in UI
Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on issue #7472: [AIRFLOW-6850] Handle no access to code in UI
URL: https://github.com/apache/airflow/pull/7472#issuecomment-588964651
# [Codecov](https://codecov.io/gh/apache/airflow/pull/7472?src=pr&el=h1) Report
> Merging [#7472](https://codecov.io/gh/apache/airflow/pull/7472?src=pr&el=desc) into [master](https://codecov.io/gh/apache/airflow/commit/d1ab3705d3d03f68abc2b900ebb35e8497dee2e7?src=pr&el=desc) will **decrease** coverage by `0.21%`.
> The diff coverage is `100%`.
[![Impacted file tree graph](https://codecov.io/gh/apache/airflow/pull/7472/graphs/tree.svg?width=650&token=WdLKlKHOAU&height=150&src=pr)](https://codecov.io/gh/apache/airflow/pull/7472?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #7472 +/- ##
==========================================
- Coverage 86.64% 86.43% -0.22%
==========================================
Files 878 883 +5
Lines 41219 41635 +416
==========================================
+ Hits 35715 35987 +272
- Misses 5504 5648 +144
```
| [Impacted Files](https://codecov.io/gh/apache/airflow/pull/7472?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [airflow/www/views.py](https://codecov.io/gh/apache/airflow/pull/7472/diff?src=pr&el=tree#diff-YWlyZmxvdy93d3cvdmlld3MucHk=) | `76.35% <100%> (+0.13%)` | :arrow_up: |
| [airflow/kubernetes/volume\_mount.py](https://codecov.io/gh/apache/airflow/pull/7472/diff?src=pr&el=tree#diff-YWlyZmxvdy9rdWJlcm5ldGVzL3ZvbHVtZV9tb3VudC5weQ==) | `44.44% <0%> (-55.56%)` | :arrow_down: |
| [airflow/kubernetes/volume.py](https://codecov.io/gh/apache/airflow/pull/7472/diff?src=pr&el=tree#diff-YWlyZmxvdy9rdWJlcm5ldGVzL3ZvbHVtZS5weQ==) | `52.94% <0%> (-47.06%)` | :arrow_down: |
| [airflow/kubernetes/pod\_launcher.py](https://codecov.io/gh/apache/airflow/pull/7472/diff?src=pr&el=tree#diff-YWlyZmxvdy9rdWJlcm5ldGVzL3BvZF9sYXVuY2hlci5weQ==) | `47.18% <0%> (-45.08%)` | :arrow_down: |
| [...viders/cncf/kubernetes/operators/kubernetes\_pod.py](https://codecov.io/gh/apache/airflow/pull/7472/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvY25jZi9rdWJlcm5ldGVzL29wZXJhdG9ycy9rdWJlcm5ldGVzX3BvZC5weQ==) | `69.38% <0%> (-25.52%)` | :arrow_down: |
| [airflow/kubernetes/refresh\_config.py](https://codecov.io/gh/apache/airflow/pull/7472/diff?src=pr&el=tree#diff-YWlyZmxvdy9rdWJlcm5ldGVzL3JlZnJlc2hfY29uZmlnLnB5) | `50.98% <0%> (-23.53%)` | :arrow_down: |
| [...oogle/marketing\_platform/hooks/campaign\_manager.py](https://codecov.io/gh/apache/airflow/pull/7472/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvZ29vZ2xlL21hcmtldGluZ19wbGF0Zm9ybS9ob29rcy9jYW1wYWlnbl9tYW5hZ2VyLnB5) | `89.23% <0%> (-10.77%)` | :arrow_down: |
| [...\_platform/example\_dags/example\_campaign\_manager.py](https://codecov.io/gh/apache/airflow/pull/7472/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvZ29vZ2xlL21hcmtldGluZ19wbGF0Zm9ybS9leGFtcGxlX2RhZ3MvZXhhbXBsZV9jYW1wYWlnbl9tYW5hZ2VyLnB5) | `93.93% <0%> (-6.07%)` | :arrow_down: |
| [.../microsoft/azure/hooks/azure\_container\_instance.py](https://codecov.io/gh/apache/airflow/pull/7472/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvbWljcm9zb2Z0L2F6dXJlL2hvb2tzL2F6dXJlX2NvbnRhaW5lcl9pbnN0YW5jZS5weQ==) | `65.38% <0%> (-2.62%)` | :arrow_down: |
| [airflow/providers/google/cloud/hooks/base.py](https://codecov.io/gh/apache/airflow/pull/7472/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvZ29vZ2xlL2Nsb3VkL2hvb2tzL2Jhc2UucHk=) | `95.9% <0%> (-0.55%)` | :arrow_down: |
| ... and [50 more](https://codecov.io/gh/apache/airflow/pull/7472/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/airflow/pull/7472?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/airflow/pull/7472?src=pr&el=footer). Last update [d1ab370...0ac31f4](https://codecov.io/gh/apache/airflow/pull/7472?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
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
With regards,
Apache Git Services
[GitHub] [airflow] anitakar commented on a change in pull request #7472:
[AIRFLOW-6850] Handle no access to code in UI
Posted by GitBox <gi...@apache.org>.
anitakar commented on a change in pull request #7472: [AIRFLOW-6850] Handle no access to code in UI
URL: https://github.com/apache/airflow/pull/7472#discussion_r381950672
##########
File path: tests/www/test_views.py
##########
@@ -569,6 +569,11 @@ def test_code(self):
resp = self.client.get(url, follow_redirects=True)
self.check_content_in_response('example_bash_operator', resp)
+ def test_code_no_file(self):
+ url = 'code?dag_id=example_bash_operator_xxx'
+ resp = self.client.get(url, follow_redirects=True)
Review comment:
Yes, sorry, I was being lazy. I did not know how to write the test I needed so I wrote this test instead. I will try to figure it out.
----------------------------------------------------------------
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
With regards,
Apache Git Services
[GitHub] [airflow] anitakar commented on a change in pull request #7472:
[AIRFLOW-6850] Handle no access to code in UI
Posted by GitBox <gi...@apache.org>.
anitakar commented on a change in pull request #7472: [AIRFLOW-6850] Handle no access to code in UI
URL: https://github.com/apache/airflow/pull/7472#discussion_r381979326
##########
File path: airflow/www/views.py
##########
@@ -528,8 +528,8 @@ def code(self, session=None):
code = f.read()
html_code = highlight(
code, lexers.PythonLexer(), HtmlFormatter(linenos=True))
- except OSError as e:
- html_code = str(e)
+ except (OSError, AttributeError) as e:
Review comment:
I had to add this for test to pass.
io.open(f, mode=mode) line in www/utils.py l 222 fails with AttributeError
with wwwutils.open_maybe_zipped(dag.fileloc, 'r') as f:
AttributeError: __enter__
----------------------------------------------------------------
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
With regards,
Apache Git Services
[GitHub] [airflow] ashb commented on a change in pull request #7472:
[AIRFLOW-6850] Handle no access to code in UI
Posted by GitBox <gi...@apache.org>.
ashb commented on a change in pull request #7472: [AIRFLOW-6850] Handle no access to code in UI
URL: https://github.com/apache/airflow/pull/7472#discussion_r381931498
##########
File path: tests/www/test_views.py
##########
@@ -569,6 +569,11 @@ def test_code(self):
resp = self.client.get(url, follow_redirects=True)
self.check_content_in_response('example_bash_operator', resp)
+ def test_code_no_file(self):
+ url = 'code?dag_id=example_bash_operator_xxx'
+ resp = self.client.get(url, follow_redirects=True)
Review comment:
This error is dag not found (i.e. it's not even in the database) which is very different to dag _source_ code could not be read by webserver. i.e. this test isn't checking what you describe in the PR.
(This request should result in a 302 back to home and show a flash of "DAG example_bash_operator_xxx not found" or similar)
----------------------------------------------------------------
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
With regards,
Apache Git Services
[GitHub] [airflow] anitakar commented on a change in pull request #7472:
[AIRFLOW-6850] Handle no access to code in UI
Posted by GitBox <gi...@apache.org>.
anitakar commented on a change in pull request #7472: [AIRFLOW-6850] Handle no access to code in UI
URL: https://github.com/apache/airflow/pull/7472#discussion_r381953183
##########
File path: airflow/www/views.py
##########
@@ -528,8 +528,9 @@ def code(self, session=None):
code = f.read()
html_code = highlight(
code, lexers.PythonLexer(), HtmlFormatter(linenos=True))
- except OSError as e:
- html_code = str(e)
+ except Exception as e:
+ html_code = 'Failed to load file ' + (dag.fileloc if dag else 'unknown') +\
+ '.<br/> Details: ' + str(e)
Review comment:
True. I did not think about it. thanks for spotting!
----------------------------------------------------------------
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
With regards,
Apache Git Services
[GitHub] [airflow] ashb commented on a change in pull request #7472:
[AIRFLOW-6850] Handle no access to code in UI
Posted by GitBox <gi...@apache.org>.
ashb commented on a change in pull request #7472: [AIRFLOW-6850] Handle no access to code in UI
URL: https://github.com/apache/airflow/pull/7472#discussion_r381932205
##########
File path: airflow/www/templates/airflow/dag_code.html
##########
@@ -31,7 +31,7 @@ <h4>{{ title }}</h4>
{% endblock %}
{% block tail %}
- {{ super() }}
+ {{ super() if dag else '' }}
Review comment:
I don't see why this change is 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
With regards,
Apache Git Services
[GitHub] [airflow] ashb commented on a change in pull request #7472:
[AIRFLOW-6850] Handle no access to code in UI
Posted by GitBox <gi...@apache.org>.
ashb commented on a change in pull request #7472: [AIRFLOW-6850] Handle no access to code in UI
URL: https://github.com/apache/airflow/pull/7472#discussion_r381932036
##########
File path: airflow/www/views.py
##########
@@ -528,8 +528,9 @@ def code(self, session=None):
code = f.read()
html_code = highlight(
code, lexers.PythonLexer(), HtmlFormatter(linenos=True))
- except OSError as e:
- html_code = str(e)
+ except Exception as e:
+ html_code = 'Failed to load file ' + (dag.fileloc if dag else 'unknown') +\
+ '.<br/> Details: ' + str(e)
Review comment:
This is a possible HTML escaping vulnerability here. Do not pass untrusted user input of any form to the UI without HTML escaping 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
With regards,
Apache Git Services
[GitHub] [airflow] kaxil commented on issue #7472: [AIRFLOW-6850] Handle no
access to code in UI
Posted by GitBox <gi...@apache.org>.
kaxil commented on issue #7472: [AIRFLOW-6850] Handle no access to code in UI
URL: https://github.com/apache/airflow/pull/7472#issuecomment-589892645
thanks @anitakar
----------------------------------------------------------------
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
With regards,
Apache Git Services
[GitHub] [airflow] anitakar commented on a change in pull request #7472:
[AIRFLOW-6850] Handle no access to code in UI
Posted by GitBox <gi...@apache.org>.
anitakar commented on a change in pull request #7472: [AIRFLOW-6850] Handle no access to code in UI
URL: https://github.com/apache/airflow/pull/7472#discussion_r381979326
##########
File path: airflow/www/views.py
##########
@@ -528,8 +528,8 @@ def code(self, session=None):
code = f.read()
html_code = highlight(
code, lexers.PythonLexer(), HtmlFormatter(linenos=True))
- except OSError as e:
- html_code = str(e)
+ except (OSError, AttributeError) as e:
Review comment:
I had to add this for test to pass.
io.open(f, mode=mode) line in www/utils.py l 222 fails with AttributeError
with wwwutils.open_maybe_zipped(dag.fileloc, 'r') as f:
AttributeError: __enter__
----------------------------------------------------------------
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
With regards,
Apache Git Services
[GitHub] [airflow] anitakar commented on a change in pull request #7472:
[AIRFLOW-6850] Handle no access to code in UI
Posted by GitBox <gi...@apache.org>.
anitakar commented on a change in pull request #7472: [AIRFLOW-6850] Handle no access to code in UI
URL: https://github.com/apache/airflow/pull/7472#discussion_r381953183
##########
File path: airflow/www/views.py
##########
@@ -528,8 +528,9 @@ def code(self, session=None):
code = f.read()
html_code = highlight(
code, lexers.PythonLexer(), HtmlFormatter(linenos=True))
- except OSError as e:
- html_code = str(e)
+ except Exception as e:
+ html_code = 'Failed to load file ' + (dag.fileloc if dag else 'unknown') +\
+ '.<br/> Details: ' + str(e)
Review comment:
True. I did not think about it. Thanks for spotting!
----------------------------------------------------------------
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
With regards,
Apache Git Services
[GitHub] [airflow] kaxil merged pull request #7472: [AIRFLOW-6850] Handle no
access to code in UI
Posted by GitBox <gi...@apache.org>.
kaxil merged pull request #7472: [AIRFLOW-6850] Handle no access to code in UI
URL: https://github.com/apache/airflow/pull/7472
----------------------------------------------------------------
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
With regards,
Apache Git Services