diff --git a/.github/workflows/ci-suite.yml b/.github/workflows/ci-suite.yml index 63a9677b57..9b13b86000 100644 --- a/.github/workflows/ci-suite.yml +++ b/.github/workflows/ci-suite.yml @@ -791,6 +791,13 @@ jobs: asset_name: ServerUpdatePackage.zip asset_content_type: application/zip + - name: Post Comment to Server Update Thread + uses: peter-evans/create-or-update-comment@v1 + with: + token: ${{ secrets.DEV_PUSH_TOKEN }} + issue-number: 1322 + body: \[tgstation-server-v${{ env.TGS_VERSION }}](${{ steps.create_release.outputs.html_url }}) released. + deploy-docker: name: Deploy TGS (Docker) needs: [deploy-tgs] diff --git a/SECURITY.md b/SECURITY.md index 7bf70fce52..c821acd452 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -13,6 +13,6 @@ Vulnerabilities should ideally be reported by directly messaging one of the main Here is a list of their discord IDs. -- Cyberboss#8246 +- Cyberboss#0016 Once reported, they will handle the processing of the security advisory. diff --git a/src/Tgstation.Server.Host/Components/Chat/Providers/DiscordProvider.cs b/src/Tgstation.Server.Host/Components/Chat/Providers/DiscordProvider.cs index 160bdebd9c..e22aa9f605 100644 --- a/src/Tgstation.Server.Host/Components/Chat/Providers/DiscordProvider.cs +++ b/src/Tgstation.Server.Host/Components/Chat/Providers/DiscordProvider.cs @@ -374,9 +374,8 @@ namespace Tgstation.Server.Host.Components.Chat.Providers var fields = BuildUpdateEmbedFields(revisionInformation, byondVersion, gitHubOwner, gitHubRepo, localCommitPushed); var embed = new Embed { - Author = new EmbedAuthor + Author = new EmbedAuthor(assemblyInformationProvider.VersionPrefix) { - Name = assemblyInformationProvider.VersionPrefix, Url = "https://github.com/tgstation/tgstation-server", IconUrl = "https://avatars0.githubusercontent.com/u/1363778?s=280&v=4", }, diff --git a/src/Tgstation.Server.Host/Components/Events/EventConsumer.cs b/src/Tgstation.Server.Host/Components/Events/EventConsumer.cs index f5129d7a06..07fc17b243 100644 --- a/src/Tgstation.Server.Host/Components/Events/EventConsumer.cs +++ b/src/Tgstation.Server.Host/Components/Events/EventConsumer.cs @@ -39,8 +39,9 @@ namespace Tgstation.Server.Host.Components.Events if (watchdog == null) throw new InvalidOperationException("EventConsumer used without watchdog set!"); - await configuration.HandleEvent(eventType, parameters, cancellationToken).ConfigureAwait(false); + var scriptTask = configuration.HandleEvent(eventType, parameters, cancellationToken); await watchdog.HandleEvent(eventType, parameters, cancellationToken).ConfigureAwait(false); + await scriptTask.ConfigureAwait(false); } /// diff --git a/src/Tgstation.Server.Host/Components/StaticFiles/Configuration.cs b/src/Tgstation.Server.Host/Components/StaticFiles/Configuration.cs index 9fcb712f26..ca75e5d396 100644 --- a/src/Tgstation.Server.Host/Components/StaticFiles/Configuration.cs +++ b/src/Tgstation.Server.Host/Components/StaticFiles/Configuration.cs @@ -631,7 +631,11 @@ namespace Tgstation.Server.Host.Components.StaticFiles await ioManager.WriteAllBytes(staticIgnorePath, Array.Empty(), cancellationToken).ConfigureAwait(false); } - await Task.WhenAll(ioManager.CreateDirectory(CodeModificationsSubdirectory, cancellationToken), ioManager.CreateDirectory(EventScriptsSubdirectory, cancellationToken), ValidateStaticFolder()).ConfigureAwait(false); + await Task.WhenAll( + ioManager.CreateDirectory(CodeModificationsSubdirectory, cancellationToken), + ioManager.CreateDirectory(EventScriptsSubdirectory, cancellationToken), + ValidateStaticFolder()) + .ConfigureAwait(false); } /// diff --git a/src/Tgstation.Server.Host/Components/Watchdog/BasicWatchdog.cs b/src/Tgstation.Server.Host/Components/Watchdog/BasicWatchdog.cs index ec41aa29f4..f62bc2d2c8 100644 --- a/src/Tgstation.Server.Host/Components/Watchdog/BasicWatchdog.cs +++ b/src/Tgstation.Server.Host/Components/Watchdog/BasicWatchdog.cs @@ -111,7 +111,7 @@ namespace Tgstation.Server.Host.Components.Watchdog var eventType = Server.TerminationWasRequested ? EventType.WorldEndProcess : EventType.WatchdogCrash; - await EventConsumer.HandleEvent(eventType, Enumerable.Empty(), cancellationToken).ConfigureAwait(false); + await HandleNonRelayedEvent(eventType, Enumerable.Empty(), cancellationToken).ConfigureAwait(false); var exitWord = Server.TerminationWasRequested ? "exited" : "crashed"; if (Server.RebootState == Session.RebootState.Shutdown) @@ -146,7 +146,7 @@ namespace Tgstation.Server.Host.Components.Watchdog gracefulRebootRequired = false; Server.ResetRebootState(); - await EventConsumer.HandleEvent(EventType.WorldReboot, Enumerable.Empty(), cancellationToken).ConfigureAwait(false); + await HandleNonRelayedEvent(EventType.WorldReboot, Enumerable.Empty(), cancellationToken).ConfigureAwait(false); switch (rebootState) { @@ -173,7 +173,7 @@ namespace Tgstation.Server.Host.Components.Watchdog await HandleNewDmbAvailable(cancellationToken).ConfigureAwait(false); break; case MonitorActivationReason.ActiveServerPrimed: - await EventConsumer.HandleEvent(EventType.WorldPrime, Enumerable.Empty(), cancellationToken).ConfigureAwait(false); + await HandleNonRelayedEvent(EventType.WorldPrime, Enumerable.Empty(), cancellationToken).ConfigureAwait(false); break; case MonitorActivationReason.Heartbeat: default: diff --git a/src/Tgstation.Server.Host/Components/Watchdog/WatchdogBase.cs b/src/Tgstation.Server.Host/Components/Watchdog/WatchdogBase.cs index e053af0bcc..ebf67b6087 100644 --- a/src/Tgstation.Server.Host/Components/Watchdog/WatchdogBase.cs +++ b/src/Tgstation.Server.Host/Components/Watchdog/WatchdogBase.cs @@ -90,11 +90,6 @@ namespace Tgstation.Server.Host.Components.Watchdog /// protected IAsyncDelayer AsyncDelayer { get; } - /// - /// The that is not the . - /// - protected IEventConsumer EventConsumer { get; } - /// /// The for the . /// @@ -110,6 +105,11 @@ namespace Tgstation.Server.Host.Components.Watchdog /// readonly SemaphoreSlim controllerDisposeSemaphore; + /// + /// The that is not the . + /// + readonly IEventConsumer eventConsumer; + /// /// The for the . /// @@ -205,7 +205,7 @@ namespace Tgstation.Server.Host.Components.Watchdog this.jobManager = jobManager ?? throw new ArgumentNullException(nameof(jobManager)); AsyncDelayer = asyncDelayer ?? throw new ArgumentNullException(nameof(asyncDelayer)); this.diagnosticsIOManager = diagnosticsIOManager ?? throw new ArgumentNullException(nameof(diagnosticsIOManager)); - EventConsumer = eventConsumer ?? throw new ArgumentNullException(nameof(eventConsumer)); + this.eventConsumer = eventConsumer ?? throw new ArgumentNullException(nameof(eventConsumer)); this.remoteDeploymentManagerFactory = remoteDeploymentManagerFactory ?? throw new ArgumentNullException(nameof(remoteDeploymentManagerFactory)); Logger = logger ?? throw new ArgumentNullException(nameof(logger)); ActiveLaunchParameters = initialLaunchParameters ?? throw new ArgumentNullException(nameof(initialLaunchParameters)); @@ -505,7 +505,7 @@ namespace Tgstation.Server.Host.Components.Watchdog cancellationToken); // simple announce if (reattachInfo == null) announceTask = Task.WhenAll( - EventConsumer.HandleEvent(EventType.WatchdogLaunch, Enumerable.Empty(), cancellationToken), + HandleNonRelayedEvent(EventType.WatchdogLaunch, Enumerable.Empty(), cancellationToken), announceTask); } else @@ -676,6 +676,25 @@ namespace Tgstation.Server.Host.Components.Watchdog return remoteDeploymentManager.ApplyDeployment(newCompileJob, ActiveCompileJob, cancellationToken); } + /// + /// Handle a given without re-throwing errors. + /// + /// The . + /// An of parameters for . + /// The for the operation. + /// A representing the running operation. + protected async Task HandleNonRelayedEvent(EventType eventType, IEnumerable parameters, CancellationToken cancellationToken) + { + try + { + await eventConsumer.HandleEvent(eventType, parameters, cancellationToken); + } + catch (JobException ex) + { + Logger.LogError(ex, "Suppressing exception triggered by event!"); + } + } + /// /// Attempt to restart the monitor from scratch. /// @@ -954,7 +973,7 @@ namespace Tgstation.Server.Host.Components.Watchdog return; if (!graceful) { - var eventTask = EventConsumer.HandleEvent( + var eventTask = HandleNonRelayedEvent( releaseServers ? EventType.WatchdogDetach : EventType.WatchdogShutdown, diff --git a/src/Tgstation.Server.Host/Tgstation.Server.Host.csproj b/src/Tgstation.Server.Host/Tgstation.Server.Host.csproj index 579b98fa6c..3424ea6dbc 100644 --- a/src/Tgstation.Server.Host/Tgstation.Server.Host.csproj +++ b/src/Tgstation.Server.Host/Tgstation.Server.Host.csproj @@ -1,4 +1,4 @@ - + @@ -87,7 +87,7 @@ - + diff --git a/tests/Tgstation.Server.Host.Tests/Components/Chat/Providers/TestDiscordProvider.cs b/tests/Tgstation.Server.Host.Tests/Components/Chat/Providers/TestDiscordProvider.cs index d0dffe4f4f..2a2f3d795b 100644 --- a/tests/Tgstation.Server.Host.Tests/Components/Chat/Providers/TestDiscordProvider.cs +++ b/tests/Tgstation.Server.Host.Tests/Components/Chat/Providers/TestDiscordProvider.cs @@ -61,8 +61,6 @@ namespace Tgstation.Server.Host.Components.Chat.Providers.Tests [TestMethod] public async Task TestConnectWithFakeTokenFails() { - Assert.Inconclusive("Doesn't happen, see https://github.com/Nihlus/Remora.Discord/issues/99 for resolution"); - var mockLogger = new Mock>(); await using var provider = new DiscordProvider(mockJobManager, Mock.Of(), mockLogger.Object, new ChatBot {