Commit Graph

5523 Commits

Author SHA1 Message Date
Archi
b32548d366 Remove explicit NLog dependency
NLog is included as part of NLog.Web.AspNetCore, we do not require a direct dependency.
2021-08-30 01:08:23 +02:00
Archi
1f556f9264 Remove no longer needed workaround 2021-08-26 11:45:44 +02:00
Sebastian Göls
9f26e72843 Remove two unnecessary context switches (#2407)
* Remove unnecessary context switch

* Remove unnecessary context switch
2021-08-25 13:08:29 +02:00
ArchiBot
3f426546c2 Automatic translations update 2021-08-24 02:06:55 +00:00
Archi
69e2a3590c ApiAuthenticationMiddleware performance improvements
Previously we've used one semaphore per all ongoing authentication attempts, which is suboptimal given the existence of a lot of consumers, including ongoing (D)DoS or distributed bruteforce attack. ASF should be as resistant to that as possible, therefore it makes sense to replace the global semaphore with per-IP semaphore (actually task), that can control the access just as well, without stopping other consumers from accessing the same authentication process concurrently.
2021-08-24 01:37:14 +02:00
Archi
5f5dcfbb99 Misc 2021-08-23 16:50:26 +02:00
Archi
882443711b Optimize ApiAuthenticationMiddleware for bruteforcing
We can favour bruteforcers by checking first if the client is even eligible for talking with us, this will (in a very negligible way) improve defense against common DoS.

Also rewrite Timer initialization while at it. This is internal class and we don't expect this middleware to be initialized more than once anyway.
2021-08-23 16:49:19 +02:00
Archi
3dec189e14 Misc 2021-08-20 14:31:12 +02:00
Vitaliya
06b11a3129 Disable unsafe for netf (#2405) 2021-08-19 17:50:18 +02:00
ArchiBot
cf9b90a73c Automatic translations update 2021-08-15 02:07:03 +00:00
Archi
dff549bd27 Misc 2021-08-13 23:34:44 +02:00
Łukasz Domeradzki
bb513921f1 Include ASF's windows-only parts only in generic and windows builds (#2404)
* Include ASF's windows-only parts only in generic and windows builds

* Apply Abry's note
2021-08-13 23:07:17 +02:00
ArchiBot
4fd411fd56 Automatic translations update 2021-08-12 02:07:58 +00:00
Archi
e3711dde26 Handle LimitExceeded in SendMessagePart()
Thanks ArchiBot
2021-08-11 20:54:10 +02:00
Archi
b3d1f96824 Misc
> This call site is reachable on: 'FreeBSD', 'Linux', 'MacOS'. 'OS.UnixSetFileAccess(string, OS.EUnixPermission)' is only supported on: 'Linux', 'FreeBSD', 'OSX'.
2021-08-10 17:37:18 +02:00
Archi
de0ee3a497 Make use of latest Madness 1.1.0 features 2021-08-10 17:09:46 +02:00
Łukasz Domeradzki
f403e9c296 Better April Fools (#2401)
* Better April Fools

* Guard timer with lock

It's not thread-safe

* Address Abry note

* Add extra 100ms to the timer calculation
2021-08-10 11:43:36 +02:00
Archi
46b2376849 Mark JetBrains.Annotations as private asset
Madness research shows that this doesn't need dll inclusion
2021-08-08 12:51:38 +02:00
Archi
911680d606 Remove IndexRange from explicit dependencies
Madness implicitly includes it already
2021-08-07 14:08:06 +02:00
Łukasz Domeradzki
9f281c6055 Embrace madness (#2394)
* Embrace madness

* Remove unused code

* Misc

* Address Abry's note

* Update for Madness 0.3.0
2021-08-07 14:03:46 +02:00
Archi
a9fd774988 Decrease netf code burden with SupportedOSPlatform 2021-08-05 21:31:12 +02:00
Archi
4eb4bc98ed Annotate remaining OS-specific parts of OS.cs 2021-08-05 21:24:23 +02:00
Archi
aa7fce300d Use new OperatingSystem API for OS detection
Supporting netf gets harder every day...
2021-08-05 21:17:42 +02:00
Vitaliya
8cd57efe33 Don't serialize AdditionalProperties for Asset (#2393)
* Don't serialize AdditionalProperties for Asset

* Don't serialize additional properties in InventoryResponse as well
2021-08-05 00:31:37 +02:00
Archi
a1955bc881 Mark additional stuff for removal 2021-08-02 22:15:37 +02:00
Archi
93a8af71e9 Limit HashCode compatibility helper to netf 2021-08-02 21:51:21 +02:00
Archi
929d57709a Remove obsolete properties 2021-08-02 21:45:04 +02:00
ArchiBot
4ac2774eaf Automatic translations update 2021-08-01 02:13:36 +00:00
Archi
b853bf0cf6 Back to sha1
Full sign doesn't work with sha256 (sad)
2021-07-31 19:19:32 +02:00
Archi
b3f490c328 Fix debug builds and use SHA256 public key 2021-07-31 18:47:18 +02:00
Archi
2be8a8b2a8 Avoid a potential synchronous flush when serializing api authentication middleware response
Might result in something along:

2021-07-30 16:39:43|ArchiSteamFarm-6766|ERROR|Microsoft.AspNetCore.Server.Kestrel|Connection id "0HMAJF2E5IVHB", Request id "0HMAJF2E5IVHB:00000005": An unhandled exception was thrown by the application. System.InvalidOperationException: Synchronous operations are disallowed. Call WriteAsync or set AllowSynchronousIO to true instead.
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpResponseStream.Flush()
   at Microsoft.AspNetCore.ResponseCaching.ResponseCachingStream.Flush()
   at Microsoft.AspNetCore.ResponseCompression.ResponseCompressionBody.Flush()
   at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)
   at System.IO.StreamWriter.Dispose(Boolean disposing)
   at System.IO.StreamWriter.Close()
   at Newtonsoft.Json.JsonTextWriter.CloseBufferAndWriter()
   at Newtonsoft.Json.JsonTextWriter.Close()
   at Newtonsoft.Json.JsonWriter.Dispose(Boolean disposing)
   at Newtonsoft.Json.JsonWriter.System.IDisposable.Dispose()
   at ArchiSteamFarm.IPC.WebUtilities.WriteJsonAsync[TValue](HttpResponse response, TValue value, JsonSerializerSettings jsonSerializerSettings)
   at ArchiSteamFarm.IPC.WebUtilities.WriteJsonAsync[TValue](HttpResponse response, TValue value, JsonSerializerSettings jsonSerializerSettings)
   at ArchiSteamFarm.IPC.Integration.ApiAuthenticationMiddleware.InvokeAsync(HttpContext context, IOptions`1 jsonOptions)
   at Microsoft.AspNetCore.ResponseCompression.ResponseCompressionMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.ResponseCaching.ResponseCachingMiddleware.Invoke(HttpContext httpContext)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)
2021-07-30 20:54:52 +02:00
Archi
0b32862efe Use 4096-bit private key for public sign 2021-07-30 16:19:52 +02:00
Archi
77d34a2ac8 Enable public signing of ASF binaries
Pending tests whether this is going to have any drawbacks, but so far looks good
2021-07-30 16:09:46 +02:00
renovate[bot]
97a5a94220 Update dependency SteamKit2 to v2.4.0-Alpha.3 (#2392)
* Update dependency SteamKit2 to v2.4.0-Alpha.3

* Address SK2 breaking changes

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Archi <JustArchi@JustArchi.net>
2021-07-30 15:33:29 +02:00
Sebastian Göls
5cbc25c44e Fix command mabadd working incorrectly (#2390)
* Fix command mabadd working incorrectly

* Do the same for mabrm
2021-07-28 22:43:17 +02:00
ArchiBot
9811d5973b Automatic translations update 2021-07-28 02:11:59 +00:00
Archi
1df9c6290b Misc 2021-07-27 20:28:33 +02:00
ArchiBot
98c18756c5 Automatic translations update 2021-07-26 02:11:26 +00:00
Archi
0e2510528b Cleanup program initialization
Initial string[] args actually can't be null according to MSDN
2021-07-26 00:19:09 +02:00
Archi
ead2d460f5 Make program args case-insensitive
There is no good reason why it should be case-sensitive
2021-07-25 23:50:02 +02:00
Archi
21c3e4a1a3 Refuse to handle Resart() when in --no-restart mode
While AutoRestart property in the config is a hint for ASF what it should be doing, --no-restart cmd-line argument is used in scripts and environments that must directly monitor the process, e.g. Docker. In such environments, we should refuse a call to Restart() action, as it's never feasible.
2021-07-25 23:35:56 +02:00
Archi
6e285178d4 Misc 2021-07-23 20:35:48 +02:00
Archi
7ff747fb6e Misc 2021-07-23 17:05:43 +02:00
Sebastian Göls
4b7edf388c Fix GlobalConfig update via IPC removing IPCPassword (#2379) 2021-07-23 16:54:20 +02:00
Archi
859d2d54c6 Misc 2021-07-21 09:58:09 +02:00
ArchiBot
2533b05ede Automatic translations update 2021-07-21 02:11:34 +00:00
Archi
a92c212a69 Misc 2021-07-20 14:43:16 +02:00
Archi
1b3ef7a41d Add support for supplying additional information on 401/403 status codes
In particular permanent: true/false value indicating whether 403 comes from rate limiting or ASF block due to lack of IPCPassword
2021-07-20 14:32:53 +02:00
Łukasz Domeradzki
81eb5c2b7c Update Strings.resx 2021-07-20 11:40:11 +02:00
Archi
5d5baca72e Include more information as program identifier and user-agent 2021-07-19 14:37:58 +02:00