diff --git a/build/Version.props b/build/Version.props index 6a908f98fd..4a4c556f24 100644 --- a/build/Version.props +++ b/build/Version.props @@ -9,8 +9,8 @@ 6.0.1 11.1.2 12.1.2 - 6.5.3 - 5.6.1 + 6.5.4 + 5.6.2 1.4.0 1.2.1 1.0.2 diff --git a/src/DMAPI/tgs.dm b/src/DMAPI/tgs.dm index 6187a67825..d0466b806f 100644 --- a/src/DMAPI/tgs.dm +++ b/src/DMAPI/tgs.dm @@ -1,6 +1,6 @@ // tgstation-server DMAPI -#define TGS_DMAPI_VERSION "6.5.3" +#define TGS_DMAPI_VERSION "6.5.4" // All functions and datums outside this document are subject to change with any version and should not be relied on. diff --git a/src/DMAPI/tgs/core/core.dm b/src/DMAPI/tgs/core/core.dm index 41a0473394..aa4084904b 100644 --- a/src/DMAPI/tgs/core/core.dm +++ b/src/DMAPI/tgs/core/core.dm @@ -153,4 +153,4 @@ /world/TgsSecurityLevel() var/datum/tgs_api/api = TGS_READ_GLOBAL(tgs) if(api) - api.SecurityLevel() + return api.SecurityLevel() diff --git a/src/DMAPI/tgs/v5/__interop_version.dm b/src/DMAPI/tgs/v5/__interop_version.dm index 5d3d491a73..1b52b31d6a 100644 --- a/src/DMAPI/tgs/v5/__interop_version.dm +++ b/src/DMAPI/tgs/v5/__interop_version.dm @@ -1 +1 @@ -"5.6.1" +"5.6.2" diff --git a/src/Tgstation.Server.Host/Components/Interop/Bridge/RuntimeInformation.cs b/src/Tgstation.Server.Host/Components/Interop/Bridge/RuntimeInformation.cs index 5d0d13b7fa..b7d05b67d7 100644 --- a/src/Tgstation.Server.Host/Components/Interop/Bridge/RuntimeInformation.cs +++ b/src/Tgstation.Server.Host/Components/Interop/Bridge/RuntimeInformation.cs @@ -2,6 +2,8 @@ using System.Collections.Generic; using System.Linq; +using Newtonsoft.Json; + using Tgstation.Server.Api.Models; using Tgstation.Server.Host.Components.Chat; using Tgstation.Server.Host.Components.Deployment; @@ -42,12 +44,14 @@ namespace Tgstation.Server.Host.Components.Interop.Bridge /// /// The level of the launch. /// - public DreamDaemonSecurity? SecurityLevel { get; } + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Include)] + public DreamDaemonSecurity SecurityLevel { get; } /// /// The level of the launch. /// - public DreamDaemonVisibility? Visibility { get; } + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Include)] + public DreamDaemonVisibility Visibility { get; } /// /// The s in the launch. @@ -70,8 +74,8 @@ namespace Tgstation.Server.Host.Components.Interop.Bridge IDmbProvider dmbProvider, Version serverVersion, string instanceName, - DreamDaemonSecurity? securityLevel, - DreamDaemonVisibility? visibility, + DreamDaemonSecurity securityLevel, + DreamDaemonVisibility visibility, ushort serverPort, bool apiValidateOnly) : base(chatTrackingContext?.Channels ?? throw new ArgumentNullException(nameof(chatTrackingContext))) diff --git a/src/Tgstation.Server.Host/Components/Session/ReattachInformation.cs b/src/Tgstation.Server.Host/Components/Session/ReattachInformation.cs index 2c9007f4f3..6c429d2d0a 100644 --- a/src/Tgstation.Server.Host/Components/Session/ReattachInformation.cs +++ b/src/Tgstation.Server.Host/Components/Session/ReattachInformation.cs @@ -76,13 +76,11 @@ namespace Tgstation.Server.Host.Components.Session Dmb = dmb ?? throw new ArgumentNullException(nameof(dmb)); ProcessId = process?.Id ?? throw new ArgumentNullException(nameof(process)); RuntimeInformation = runtimeInformation ?? throw new ArgumentNullException(nameof(runtimeInformation)); - if (!runtimeInformation.SecurityLevel.HasValue) - throw new ArgumentException("runtimeInformation must have a valid SecurityLevel!", nameof(runtimeInformation)); AccessIdentifier = accessIdentifier ?? throw new ArgumentNullException(nameof(accessIdentifier)); - LaunchSecurityLevel = runtimeInformation.SecurityLevel.Value; - LaunchVisibility = runtimeInformation.Visibility.Value; + LaunchSecurityLevel = runtimeInformation.SecurityLevel; + LaunchVisibility = runtimeInformation.Visibility; Port = port; runtimeInformationLock = new object(); diff --git a/src/Tgstation.Server.Host/Components/Session/SessionControllerFactory.cs b/src/Tgstation.Server.Host/Components/Session/SessionControllerFactory.cs index 96228c3c32..cf0dea0468 100644 --- a/src/Tgstation.Server.Host/Components/Session/SessionControllerFactory.cs +++ b/src/Tgstation.Server.Host/Components/Session/SessionControllerFactory.cs @@ -336,7 +336,8 @@ namespace Tgstation.Server.Host.Components.Session var runtimeInformation = CreateRuntimeInformation( dmbProvider, chatTrackingContext, - launchParameters, + launchParameters.SecurityLevel.Value, + launchParameters.Visibility.Value, apiValidate); var reattachInformation = new ReattachInformation( @@ -430,7 +431,8 @@ namespace Tgstation.Server.Host.Components.Session var runtimeInformation = CreateRuntimeInformation( reattachInformation.Dmb, chatTrackingContext, - null, + reattachInformation.LaunchSecurityLevel, + reattachInformation.LaunchVisibility, false); reattachInformation.SetRuntimeInformation(runtimeInformation); @@ -626,21 +628,23 @@ namespace Tgstation.Server.Host.Components.Session /// /// The . /// The . - /// The if any. + /// The the server was launched with. + /// The the server was launched with. /// The value of . /// A new class. RuntimeInformation CreateRuntimeInformation( IDmbProvider dmbProvider, IChatTrackingContext chatTrackingContext, - DreamDaemonLaunchParameters launchParameters, + DreamDaemonSecurity securityLevel, + DreamDaemonVisibility visibility, bool apiValidateOnly) => new ( chatTrackingContext, dmbProvider, assemblyInformationProvider.Version, instance.Name, - launchParameters?.SecurityLevel, - launchParameters?.Visibility, + securityLevel, + visibility, serverPortProvider.HttpApiPort, apiValidateOnly); diff --git a/src/Tgstation.Server.Host/Models/ReattachInformationBase.cs b/src/Tgstation.Server.Host/Models/ReattachInformationBase.cs index 76dfbfda36..241fae5141 100644 --- a/src/Tgstation.Server.Host/Models/ReattachInformationBase.cs +++ b/src/Tgstation.Server.Host/Models/ReattachInformationBase.cs @@ -1,5 +1,4 @@ using System; -using System.ComponentModel.DataAnnotations; using System.Globalization; using Tgstation.Server.Api.Models; @@ -31,14 +30,12 @@ namespace Tgstation.Server.Host.Models /// /// The level DreamDaemon was launched with. /// - [Required] - public DreamDaemonSecurity? LaunchSecurityLevel { get; set; } + public DreamDaemonSecurity LaunchSecurityLevel { get; set; } /// /// The DreamDaemon was launched with. /// - [Required] - public DreamDaemonVisibility? LaunchVisibility { get; set; } + public DreamDaemonVisibility LaunchVisibility { get; set; } /// /// Initializes a new instance of the class. diff --git a/src/Tgstation.Server.Host/Utils/GitHub/GitHubClientFactory.cs b/src/Tgstation.Server.Host/Utils/GitHub/GitHubClientFactory.cs index 47a67728ab..7595a70a43 100644 --- a/src/Tgstation.Server.Host/Utils/GitHub/GitHubClientFactory.cs +++ b/src/Tgstation.Server.Host/Utils/GitHub/GitHubClientFactory.cs @@ -153,7 +153,7 @@ namespace Tgstation.Server.Host.Utils.GitHub rateLimitInfo.Reset.ToString("o")); else logger.LogDebug( - "Requested GitHub client has {remainingRequests} requests remaining after the usage {lastUse}. Limit resets at {resetTime}", + "Requested GitHub client has {remainingRequests} requests remaining after the usage at {lastUse}. Limit resets at {resetTime}", rateLimitInfo.Remaining, lastUsed, rateLimitInfo.Reset.ToString("o")); diff --git a/tests/DMAPI/LongRunning/Test.dm b/tests/DMAPI/LongRunning/Test.dm index bed428eceb..a77c3377b5 100644 --- a/tests/DMAPI/LongRunning/Test.dm +++ b/tests/DMAPI/LongRunning/Test.dm @@ -11,6 +11,12 @@ dab() TgsNew(new /datum/tgs_event_handler/impl, TGS_SECURITY_SAFE) + var/sec = TgsSecurityLevel() + if(isnull(sec)) + FailTest("TGS Security level was null!") + + log << "Running in security level: [sec]" + if(params["expect_chat_channels"]) var/list/channels = TgsChatChannelInfo() if(!length(channels)) diff --git a/tests/DMAPI/LongRunning/long_running_test_rooted.dme b/tests/DMAPI/LongRunning/long_running_test_rooted.dme new file mode 100644 index 0000000000..d8e9d61c96 --- /dev/null +++ b/tests/DMAPI/LongRunning/long_running_test_rooted.dme @@ -0,0 +1,17 @@ +// Hand crafted DME, will not work if saved with DreamMaker + +// BEGIN_INTERNALS +// END_INTERNALS + +// BEGIN_FILE_DIR +#define FILE_DIR . +// END_FILE_DIR + +// BEGIN_PREFERENCES +// END_PREFERENCES + +// BEGIN_INCLUDE +#include "tests/DMAPI/LongRunning/Config.dm" +#include "tests/DMAPI/test_prelude.dm" +#include "tests/DMAPI/LongRunning/Test.dm" +// END_INCLUDE diff --git a/tests/Tgstation.Server.Tests/Live/Instance/ConfigurationTest.cs b/tests/Tgstation.Server.Tests/Live/Instance/ConfigurationTest.cs index 1008406cd7..2dea3e5b12 100644 --- a/tests/Tgstation.Server.Tests/Live/Instance/ConfigurationTest.cs +++ b/tests/Tgstation.Server.Tests/Live/Instance/ConfigurationTest.cs @@ -92,7 +92,7 @@ namespace Tgstation.Server.Tests.Live.Instance await configurationClient.CreateDirectory(staticDir, cancellationToken); } - public Task SetupDMApiTests(CancellationToken cancellationToken) + public Task SetupDMApiTests(bool includingRoot, CancellationToken cancellationToken) { // just use an I/O manager here var ioManager = new DefaultIOManager(); @@ -104,6 +104,12 @@ namespace Tgstation.Server.Tests.Live.Instance ioManager.ConcatPath(instance.Path, "Repository", "tests", "DMAPI"), null, cancellationToken), + includingRoot + ? ioManager.CopyFile( + "../../../../DMAPI/LongRunning/long_running_test_rooted.dme", + ioManager.ConcatPath(instance.Path, "Repository", "long_running_test_rooted.dme"), + cancellationToken) + : Task.CompletedTask, ioManager.CopyDirectory( Enumerable.Empty(), null, @@ -175,8 +181,8 @@ namespace Tgstation.Server.Tests.Live.Instance } public Task RunPreWatchdog(CancellationToken cancellationToken) => Task.WhenAll( + SetupDMApiTests(false, cancellationToken), SequencedApiTests(cancellationToken), - SetupDMApiTests(cancellationToken), TestPregeneratedFilesExist(cancellationToken)); } } diff --git a/tests/Tgstation.Server.Tests/Live/Instance/InstanceTest.cs b/tests/Tgstation.Server.Tests/Live/Instance/InstanceTest.cs index 9265e0e7f6..4457994d79 100644 --- a/tests/Tgstation.Server.Tests/Live/Instance/InstanceTest.cs +++ b/tests/Tgstation.Server.Tests/Live/Instance/InstanceTest.cs @@ -63,6 +63,7 @@ namespace Tgstation.Server.Tests.Live.Instance await chatTask; await dmTask; + await configTest.SetupDMApiTests(true, cancellationToken); await byondTask; await new WatchdogTest( @@ -172,7 +173,7 @@ namespace Tgstation.Server.Tests.Live.Instance dmUpdateRequest, cloneRequest); - var configSetupTask = new ConfigurationTest(instanceClient.Configuration, instanceClient.Metadata).SetupDMApiTests(cancellationToken); + var configSetupTask = new ConfigurationTest(instanceClient.Configuration, instanceClient.Metadata).SetupDMApiTests(true, cancellationToken); if (TestingUtils.RunningInGitHubActions || String.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("TGS_TEST_GITHUB_TOKEN")) diff --git a/tests/Tgstation.Server.Tests/Live/Instance/WatchdogTest.cs b/tests/Tgstation.Server.Tests/Live/Instance/WatchdogTest.cs index 641085529c..329fab6aa1 100644 --- a/tests/Tgstation.Server.Tests/Live/Instance/WatchdogTest.cs +++ b/tests/Tgstation.Server.Tests/Live/Instance/WatchdogTest.cs @@ -1101,7 +1101,7 @@ namespace Tgstation.Server.Tests.Live.Instance var refreshed = await instanceClient.DreamMaker.Update(new DreamMakerRequest { ApiValidationSecurityLevel = deploymentSecurity, - ProjectName = $"tests/DMAPI/{dmeName}", + ProjectName = dmeName.Contains("rooted") ? dmeName : $"tests/DMAPI/{dmeName}", RequireDMApiValidation = requireApi, Timeout = TimeSpan.FromMilliseconds(1), }, cancellationToken); diff --git a/tests/Tgstation.Server.Tests/Live/TestLiveServer.cs b/tests/Tgstation.Server.Tests/Live/TestLiveServer.cs index 5a7da4471a..f058d9795f 100644 --- a/tests/Tgstation.Server.Tests/Live/TestLiveServer.cs +++ b/tests/Tgstation.Server.Tests/Live/TestLiveServer.cs @@ -1471,7 +1471,7 @@ namespace Tgstation.Server.Tests.Live await WatchdogTest.TellWorldToReboot2(instanceClient, WatchdogTest.StaticTopicClient, mainDDPort, cancellationToken); dd = await instanceClient.DreamDaemon.Read(cancellationToken); - Assert.AreEqual(WatchdogStatus.Online, dd.Status.Value); + Assert.AreEqual(WatchdogStatus.Online, dd.Status.Value); // if this assert fails, you likely have to crack open the debugger and read test_fail_reason.txt manually Assert.IsNull(dd.StagedCompileJob); Assert.AreEqual(initialStaged, dd.ActiveCompileJob.Id); diff --git a/tgstation-server.sln b/tgstation-server.sln index 6d183435b8..20eef245e1 100644 --- a/tgstation-server.sln +++ b/tgstation-server.sln @@ -157,6 +157,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "LongRunning", "LongRunning" tests\DMAPI\LongRunning\Config.dm = tests\DMAPI\LongRunning\Config.dm tests\DMAPI\LongRunning\long_running_test.dme = tests\DMAPI\LongRunning\long_running_test.dme tests\DMAPI\LongRunning\long_running_test_copy.dme = tests\DMAPI\LongRunning\long_running_test_copy.dme + tests\DMAPI\LongRunning\long_running_test_rooted.dme = tests\DMAPI\LongRunning\long_running_test_rooted.dme tests\DMAPI\LongRunning\Test.dm = tests\DMAPI\LongRunning\Test.dm EndProjectSection EndProject