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

Auth: Catch all exceptions while waiting for token validation and reject it instead of crashing #1032

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion modules/Auth/Auth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,17 @@ void Auth::ready() {
this->auth_handler->register_validate_token_callback([this](const ProvidedIdToken& provided_token) {
std::vector<ValidationResult> validation_results;
for (const auto& token_validator : this->r_token_validator) {
validation_results.push_back(token_validator->call_validate_token(provided_token));
try {
const auto result = token_validator->call_validate_token(provided_token);
validation_results.push_back(result);
// TODO: This is very broad catch, make it more narrow when the everest-framework error handling will be
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the record, this refers to EVerest/everest-framework#210

// established
} catch (const std::exception& e) {
EVLOG_warning << "Exception during validating token: " << e.what();
ValidationResult validation_result;
validation_result.authorization_status = AuthorizationStatus::Unknown;
validation_results.push_back(validation_result);
}
}
return validation_results;
});
Expand Down