Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@OzanCansel
Copy link
Contributor

@OzanCansel OzanCansel commented Dec 9, 2022

  • Discovery token is filtered out at the source of exception.
  • token_should_not_be_leaked test is added for this case.

@OzanCansel OzanCansel self-assigned this Dec 9, 2022
@OzanCansel OzanCansel requested a review from ihsandemir December 9, 2022 15:21
@OzanCansel OzanCansel added this to the 5.1.0 milestone Dec 9, 2022
@devOpsHazelcast
Copy link
Contributor

Linux test PASSed.

1 similar comment
@devOpsHazelcast
Copy link
Contributor

Linux test PASSed.

@devOpsHazelcast
Copy link
Contributor

Windows test PASSed.

FAIL();
} catch (const exception::illegal_state& e) {
std::string message = e.what();
ASSERT_EQ(message.find(discovery_token), std::string::npos);
Copy link
Collaborator

Choose a reason for hiding this comment

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

you should also check the nested exception message!!!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nested exception contains it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

so, it still leaks?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed the implementation, token is filtered out in the class which is the source of the exception. So it is not leaked by neither inner nor outer exceptions.

There is a problem related with an unit test, I wrote the test to check inner exception message but std::rethrow_if_nested doesn't throw the inner exception. Added it to comment.

Copy link
Collaborator

@ihsandemir ihsandemir Dec 13, 2022

Choose a reason for hiding this comment

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

Let's open an issue for this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will open after merge with the link of the test.

} catch (std::exception& e) {
std::string message{ e.what() };
boost::replace_all(message, discovery_token, "<DISCOVERY_TOKEN>");
std::throw_with_nested(
Copy link
Collaborator

Choose a reason for hiding this comment

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

can it leak due to nested exception?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

On application crash it is not printed to stdout. But the token is included nested_exception that's why I added filter handler to SyncHttpsRequest earlier.

@devOpsHazelcast
Copy link
Contributor

Windows test PASSed.

@devOpsHazelcast
Copy link
Contributor

Linux test PASSed.

@devOpsHazelcast
Copy link
Contributor

Windows test PASSed.

1 similar comment
@devOpsHazelcast
Copy link
Contributor

Windows test PASSed.

@devOpsHazelcast
Copy link
Contributor

Linux test PASSed.

@devOpsHazelcast
Copy link
Contributor

Linux test PASSed.

@devOpsHazelcast
Copy link
Contributor

Windows test PASSed.

@devOpsHazelcast
Copy link
Contributor

Linux test PASSed.

@devOpsHazelcast
Copy link
Contributor

Windows test PASSed.

@devOpsHazelcast
Copy link
Contributor

Windows test PASSed.

@devOpsHazelcast
Copy link
Contributor

Linux test PASSed.

@OzanCansel OzanCansel merged commit e1455a6 into hazelcast:master Dec 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants