-
Notifications
You must be signed in to change notification settings - Fork 16.3k
Add config to warn public deployment exposure in UI #18557
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
Conversation
|
There were some delays in night which caused waitign for image to timeout. Close/reopen to rebuild |
airflow/www/views.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this message maybe be extended with some more specific or useful information?
Maybe something like:
Recent requests to /robots.txt indicate that this deployment may be accessible to the public internet.
This warning can be disabled by setting webserver.warn_deployment_exposure=False in the configuration.
We could also link to a page in the docs with more information on webserver security.
airflow/www/views.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Flask uses cookie-based sessions. This warning will therefore only be displayed to clients who have visited /robots.txt, in our case bot crawlers. I think we should notify the administrator about this situation, not the bot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what would be the best way to display the message for admin team? is there some way to post the message only for admin sessions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess you need to write it down to the database as a new table or to the event log table.
3e41c64 to
001298d
Compare
001298d to
f584371
Compare
|
quarantined test are failing but having trouble running them locally to fix |
|
@ShakaibKhan please ignore quarantined tests. |
|
LGTM. @mik-laj @SamWheating ? |
airflow/www/views.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be limited to the last week or something? The warning message explicitly states that Recent requests have been made to /robots.txt but this could be triggered by very old requests.
There's also no way to clear this entry without deleting the log event so it might persist for a long time, even if the vulnerability is fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering if it would be good enough to clear requests older than a week and only display the message on recent requests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we also just query for events within one week old? Something like:
robots_file_access_count = (
session.query(Log)
.filter(Log.event == "robots")
.filter(Log.dttm > (utcnow() - timedelta(days=7)))
.count()
)
airflow/www/views.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this warning can be disabled? I don't see the value of warn_deployment_exposure actually being referenced anywhere other than the config.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed it during a merge, I will put it back in the if statement
airflow/www/views.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In one sentence, we are talking about a configuration option, and then we link to a documentation that does not contain a description of that option.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will add the config to documentation
f584371 to
aafffd5
Compare
airflow/www/views.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This query should only be run if webserver.warn_deployment_exposure is enabled. Otherwise its putting additional load on the database for no reason, since the warning isn't going to be displayed anyways.
|
The PR most likely needs to run full matrix of tests because it modifies parts of the core of Airflow. However, committers might decide to merge it quickly and take the risk. If they don't merge it quickly - please rebase it to the latest main at your convenience, or amend the last commit of the PR, and push it with --force-with-lease. |
|
Can you review this again @SamWheating to see if your comments are addressed |
airflow/www/views.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you use the get_docs_url function? Thanks to it, the link will be pinned to the version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably:
| '"https://airflow.apache.org/docs/apache-airflow/stable/security/webserver.html">' | |
| f'"{get_docs_url('security/webserver.html')}">' |
airflow/config_templates/config.yml
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| version_added: 2.2.0 | |
| version_added: 2.2.3 |
I think that this value will need to be updated, but if this is merged in the next week or two it will probably be included in the 2.2.3 release.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's make it 2.3.0 please -- this won't be included in 2.2.3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| version_added: 2.2.0 | |
| version_added: 2.3.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Disable Deployment Exposure Warning | |
| ------------------------------------------------------ | |
| Disable Deployment Exposure Warning | |
| --------------------------------------- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Airflow warns when recent requests are made to /robot.txt. To disable this warning set the below: | |
| Airflow warns when recent requests are made to `/robot.txt`. To disable this warning set ``warn_deployment_exposure`` to ``False`` as below: |
d70a162 to
8dfca34
Compare
|
Needs conflict resolving :( |
ffc8ade to
a3225b1
Compare
Co-authored-by: eladkal <[email protected]>
closes: #17962
Added warning banner message for when /robot.txt is hit with on/off config