Skip to content
This repository was archived by the owner on Nov 10, 2025. It is now read-only.

Add oracle global timeout#698

Merged
superboyiii merged 8 commits intoneo-project:3.2.1from
shargon:add-global-timeout
Apr 21, 2022
Merged

Add oracle global timeout#698
superboyiii merged 8 commits intoneo-project:3.2.1from
shargon:add-global-timeout

Conversation

@shargon
Copy link
Member

@shargon shargon commented Mar 11, 2022

Related to #692 (comment)

@erikzhang
Copy link
Member

Use CancellationTokenSource?

CancellationTokenSource ctsTimeout = new(Settings.Default.Https.Timeout);
CancellationTokenSource ctsLinked = CancellationTokenSource.CreateLinkedTokenSource(cancelSource.Token, ctsTimeout.Token);

try
{
    return await protocol.ProcessAsync(uri, ctsLinked.Token);
}
catch
{
    return (OracleResponseCode.Error, null);
}

HttpResponseMessage message;
try
{
int redirects = 2;
Copy link
Member

Choose a reason for hiding this comment

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

Hi @shargon, could it be a merge between max redirects and timeout?
And sum the time taken between redirects?

Anyway, this will solve the issue for now.

Copy link
Member Author

Choose a reason for hiding this comment

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

Then we should create a new HttpClient for each request, because the timeout it's specified in the class

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Because the original issue, we can have a SSRF

Jim8y
Jim8y previously approved these changes Apr 15, 2022
@erikzhang erikzhang changed the base branch from develop to 3.2.1 April 20, 2022 01:38
@erikzhang erikzhang mentioned this pull request Apr 20, 2022
@superboyiii superboyiii merged commit d2ea399 into neo-project:3.2.1 Apr 21, 2022
erikzhang pushed a commit that referenced this pull request Apr 21, 2022
* add invoked contract (#657)

* add in file copyright (#679)

* witness rule support (#676)

* Prevent SSRF (#692)

* limit free gas (#697)

* add log when exception happens under debug mode (#690)

* dbft: tune MaxBlock* parameters (#688)

* Fix StateAPI.MakeFindStatesParams (#699)

* update Console to ConsoleHelper (#682)

* refac log (#700)

* Make RpcServer.ProcessAsync public to enable better neo express integration (#701)

* Limit result stack (#696)

* fix MaxBlockSystemFee (#703)

* code optimise (#704)

* Add oracle global timeout (#698)
@shargon shargon deleted the add-global-timeout branch April 21, 2022 09:47
roman-khimov added a commit to nspcc-dev/neo-go that referenced this pull request May 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants