From 4eac790eaaad61dca35428014a56481727f3ddd7 Mon Sep 17 00:00:00 2001 From: Kim Date: Thu, 16 Mar 2023 16:34:52 +0100 Subject: [PATCH] exchanged api keys for ones with specific restricted permissions --- .../Backend/DataTypes/Methods/Installation.cs | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/csharp/App/Backend/DataTypes/Methods/Installation.cs b/csharp/App/Backend/DataTypes/Methods/Installation.cs index f3ec67b80..be76d69a7 100644 --- a/csharp/App/Backend/DataTypes/Methods/Installation.cs +++ b/csharp/App/Backend/DataTypes/Methods/Installation.cs @@ -34,12 +34,11 @@ public static class InstallationMethods public static async Task CreateBucket(this Installation installation) { - //NOTE this key has all the rights, please be sure you know what you're doing + const String secret = "-T9TAqy9a3-0-xj7HKsFFJOCcxfRpcnL6OW5oOrOcWU"; - const String secret = "z8brNDUAbpktvyWZN1jMIrsQhavDgK2t4cb8GLvsxYg"; - - const String apiKey = "EXO277645911ee6bde3875e99ae"; + const String apiKey = "EXO87ca85e29dd412f1238f1cf0"; const String salt = "3e5b3069-214a-43ee-8d85-57d72000c19d"; + var cmd = Cli .Wrap("python3") .WithArguments(new[] @@ -48,14 +47,29 @@ public static class InstallationMethods apiKey, "--secret_key", secret }); var x = await cmd.ExecuteBufferedAsync(); + + //Updating the url in the db as to not needing to wait until the next + var cmd2 = Cli + .Wrap("python3") + .WithArguments(new[] + { + "Resources/s3cmd.py", "signurl", $"s3://{installation.Id}-{salt}", + TimeSpan.FromDays(1).TotalSeconds.ToString(), "--access_key", + apiKey, "--secret_key", secret + }); + + var y = await cmd2.ExecuteBufferedAsync(); + installation.S3Url = y.StandardOutput.Replace("\n", "").Replace(" ", ""); + + Db.Update(installation); + return x.ExitCode == 0; } public static async Task DeleteBucket(this Installation installation) { - //NOTE this key has all the rights, please be sure you know what you're doing - const String secret = "z8brNDUAbpktvyWZN1jMIrsQhavDgK2t4cb8GLvsxYg"; - const String apiKey = "EXO277645911ee6bde3875e99ae"; + const String secret = "-T9TAqy9a3-0-xj7HKsFFJOCcxfRpcnL6OW5oOrOcWU"; + const String apiKey = "EXO87ca85e29dd412f1238f1cf0"; const String salt = "3e5b3069-214a-43ee-8d85-57d72000c19d"; var cmd = Cli .Wrap("python3")