Commit Graph
7131 Commits
Author SHA1 Message Date
Jordan DominionandGitHub 3b97530dd3 Merge pull request #1685 from tgstation/SignalR [APIDeploy][NugetDeploy][DMDeploy]
Add SignalR/SSE endpoint for job updates and `JobCode`s
api-v9.13.0 dmapi-v6.6.2
2023-11-05 16:30:52 -05:00
Jordan Dominion 32d1f0ae5e Add FAQ link for DMAPI validation failures 2023-11-05 13:13:01 -05:00
Jordan Dominion 337eb15a7f User connection updates should bypass the jobs hub message rate limiter 2023-11-05 12:12:15 -05:00
Jordan Dominion b79d02c77a Push an update of all active jobs to all clients when a new one connects
I know this is annoying in that we only need to target the connected client, but it's so much simpler this way. How big of an update can it even be if it's only including active jobs?
2023-11-05 11:56:43 -05:00
Jordan Dominion fa13869ea2 Ensure that SignalR works with the webpanel
- Fix issue with CORS preventing static file browsing.
- AllowCredentials in CORS. Switch from `AllowAnyOrigin` to a wildcard matching `Func` to bypass the CORS specification that says you can't do that.
- Add workaround for legacy SignalR `access_token` query string.
- Get token `nbf` from claims rather than through the composition root.
2023-11-05 11:23:47 -05:00
Jordan Dominion ed8453f08e Remove hub abort notifications
Because SignalR buffers messages, we can't guarantee these will be delivered before the connection is aborted.

We'll have to rely on the client not being pants-on-head.
2023-11-05 09:38:57 -05:00
Jordan Dominion d3563394fb OperationCanceledExceptions are not test errors 2023-11-05 09:01:20 -05:00
Jordan Dominion 2c82da46f6 Simplify logic flow in JobsHubTests 2023-11-05 09:00:44 -05:00
Jordan Dominion cab8ce68f5 Simplify this job type check using new JobCodes 2023-11-05 08:40:18 -05:00
Jordan Dominion 9044eb041d Properly document DeploymentActivation event 2023-11-05 00:01:03 -04:00
Jordan Dominion 31ac130b45 Version bumps
- Api
- ApiLibrary
- ClientLibrary
- Core
2023-11-05 00:01:02 -04:00
Jordan Dominion dd2e264477 Document new authentication pipeline
Also fix location of `TgsAuthorizeAttribute` .md documentation.
2023-11-05 00:01:02 -04:00
Jordan Dominion ec81fcdf41 Remove no-op call 2023-11-04 23:28:09 -04:00
Jordan Dominion edcd26e44f Allow GET /Jobs request spam again
Now that we have a hub as a better alternative, it should be less prevalent.
2023-11-04 23:27:57 -04:00
Jordan Dominion ebd09d7e86 Add JobCodes to strongly type jobs
- Default `0` for legacy jobs.
- Standardize job creation prior to registration.
- Add `RightsHelper.TypeToRight()`.
2023-11-04 21:12:25 -04:00
Jordan Dominion 85e1c0d5f1 Fix dotnet-ef version being out of sync 2023-11-04 20:47:41 -04:00
Jordan Dominion 189d594b4c Update nuget packages 2023-11-04 20:47:14 -04:00
Jordan Dominion 385771f477 Change this .OfType() to .Cast() 2023-11-04 20:41:59 -04:00
Jordan Dominion 6fb9ba6f37 Check registered jobs have instance and user IDs 2023-11-04 20:41:59 -04:00
Jordan Dominion 5b1e123e64 Add DeploymentActivation event 2023-11-04 20:41:56 -04:00
Jordan Dominion d85e2b8d36 Add SignalR
- Add one hub `/hubs/jobs`, strongly typed API included.
- Adjust request pipeline to support SignalR.
- Allow `Accept: text/event-stream` for SSE requests.
- Add client library support for hubs.
- Add integration tests.
- Add IPermissionSetNotifyee to support dynamic changes based on perms.
- Keep job state in `JobService` for pushing updates.
2023-11-04 19:22:48 -04:00
Jordan Dominion fda26e1f15 Fix issue with DMAPI validation shutdown timeouts
- Increase grace period to 30s to avoid false positives.
2023-11-04 17:44:00 -04:00
Jordan Dominion 61cae1a02d Fix nested default Linux log directory 2023-11-04 17:40:54 -04:00
Jordan Dominion d851df8276 GET / with an Authorization header should fail if it's not valid 2023-11-02 23:10:34 -04:00
Jordan Dominion fb1aee74a1 Fix using spacing 2023-11-02 22:59:56 -04:00
Jordan Dominion 1b1a91361c Correct documentation for ApiContoller.NotFound() 2023-11-02 22:59:36 -04:00
Jordan Dominion 242c74955d Correct documentation for ApiHeaders.IsTokenAuthentication 2023-11-02 22:58:56 -04:00
Jordan Dominion ba0ccdff53 Set sleep_offline before del(world) 2023-10-31 23:16:19 -04:00
Jordan Dominion f58ea64c96 Remove spammy logging 2023-10-31 23:16:19 -04:00
Jordan Dominion e1d359d2f7 Change instance references to be a ulong 2023-10-31 23:16:18 -04:00
Jordan Dominion 29579a351d Fix JWT compliance issues.
- `nbf` and `exp` should be numbers, not strings.
- Parse JWT in `ApiHeaders` fully for errors.
- Use `iat` and increment `nbf` by one second if equal and may trigger the `LastPasswordUpdate` bug.
  - Make client aware of this change and move the delay there.
- Deprecated `TokenResponse.ExpiresAt`.
2023-10-31 23:16:18 -04:00
Jordan Dominion e41e59a48a Remove unnecessary checks for non-existent PosixSystemIdentitys 2023-10-31 23:16:17 -04:00
Jordan Dominion dd8c8df35f Fix NotImplementedException errors on non-github/gitlab deployments 2023-10-31 23:16:17 -04:00
Jordan Dominion eaebe733bd Improve HeadersException handling
Avoid recreating ApiHeaders in request pipeline where possible
2023-10-31 23:16:16 -04:00
Jordan Dominion 3901512693 The del world issue is caused by sleep_offline
Just do an infinite loop and ensure `sleep_offline` is off. It can't keep getting away with this.

Bump DMAPI version
2023-10-31 23:16:16 -04:00
Jordan Dominion 7bb565d0da Better message formatting for HeadersException 2023-10-31 23:16:16 -04:00
Jordan Dominion ad460d9ae4 Silence VS messages about new() expressions 2023-10-31 23:16:15 -04:00
Jordan Dominion 808f96b968 Clean up some using ordering 2023-10-31 23:16:15 -04:00
Jordan Dominion b86bd51e1f Fix some logging formatter messages 2023-10-31 23:16:15 -04:00
Jordan Dominion 23a4f5758f Include InstanceId in JobResponse 2023-10-31 23:16:10 -04:00
Jordan Dominion ed618de29e ODR use of "Bearer" string 2023-10-29 16:39:56 -04:00
Jordan Dominion 1d0371f84a Make TestServerService more analyzer friendly 2023-10-29 16:23:52 -04:00
Jordan Dominion 6dbf357b8a Silence VS message about a new() expression 2023-10-29 16:23:29 -04:00
Jordan Dominion fd44b61a24 Authentication pipeline rewrite
If you're looking for the future CVE it probably came from here.
2023-10-29 16:23:01 -04:00
Jordan Dominion 590f5c6a55 Fix ApiHeaders improperly storing OAuthCode
- Store in its own property instead of `Token`
2023-10-29 16:23:00 -04:00
Jordan Dominion 4b39bde25d Fix HardFailLogger/provider logging non-errors 2023-10-29 16:23:00 -04:00
Jordan Dominion a7cb72ca84 Fix BOM in ServerClient.cs 2023-10-29 16:23:00 -04:00
Jordan Dominion 78669f486c Fix issue with CORS not working properly 2023-10-29 16:23:00 -04:00
Jordan Dominion 5b615ea04b Upgrade "webpanel not built" message to Debug 2023-10-29 16:22:59 -04:00
Jordan Dominion 49a351ecc6 Move client cache disabling to new ApiControllerBase
It's probably not in a good middleware spot anymore with endpoint routing.

Also disable CA1501 (Excessive inheritance) because our use cases appear to be consistently valid.
2023-10-29 16:22:59 -04:00