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

Improve security and error handling for the internal API #40999

Merged
merged 1 commit into from
Jul 24, 2024

Conversation

potiuk
Copy link
Member

@potiuk potiuk commented Jul 24, 2024

There are a few fixes to the internal API error handling that caused errors when handling permission errors. The internal API now handles only application/json content type and only requests that explicitly accept only application/json responses - which is an extra layer of security that makes CSRF protection not necessary (though our token validation should already prevent CSRF issues.

The Permission Denied exceptions did not like the exc_info parameter, so it has been removed. Also in case of auth_manager not initialized we should return a very generic error message as this is only in case of standalone internal_api component.


^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in newsfragments.

There are a few fixes to the internal API error handling that
caused errors when handling permission errors. The internal API
now handles only application/json content type and only requests
that explicitly accept only application/json responses - which is
an extra layer of security that makes CSRF protection not necessary
(though our token validation should already prevent CSRF issues.

The Permission Denied exceptions did not like the exc_info parameter,
so it has been removed. Also in case of auth_manager not initialized
we should return a very generic error message as this is only in
case of standalone internal_api component.

Co-authored-by: Vincent <[email protected]>
@potiuk potiuk force-pushed the fix-error-handling-for-internal-api branch from 45a605e to 14d9a2e Compare July 24, 2024 15:27
@potiuk
Copy link
Member Author

potiuk commented Jul 24, 2024

Fixed failing tests and added two more for "accept" header.

@potiuk potiuk merged commit 33e1909 into apache:main Jul 24, 2024
48 checks passed
@potiuk potiuk deleted the fix-error-handling-for-internal-api branch July 24, 2024 15:53
@potiuk potiuk added this to the Airflow 2.10.0 milestone Jul 24, 2024
@ephraimbuddy ephraimbuddy added the type:improvement Changelog: Improvements label Jul 25, 2024
molcay pushed a commit to VladaZakharova/airflow that referenced this pull request Aug 19, 2024
There are a few fixes to the internal API error handling that
caused errors when handling permission errors. The internal API
now handles only application/json content type and only requests
that explicitly accept only application/json responses - which is
an extra layer of security that makes CSRF protection not necessary
(though our token validation should already prevent CSRF issues.

The Permission Denied exceptions did not like the exc_info parameter,
so it has been removed. Also in case of auth_manager not initialized
we should return a very generic error message as this is only in
case of standalone internal_api component.

Co-authored-by: Vincent <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:webserver Webserver related Issues type:improvement Changelog: Improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants