aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJP Dillingham <jpdillingham@gmail.com>2021-10-23 20:26:44 -0500
committerGitHub <noreply@github.com>2021-10-23 20:26:44 -0500
commitc97abdba209bc96886b28b6cb4bdd5886ed3de33 (patch)
tree18030e2c16c16b5c63a8379e99b2de0b30908808 /src
parentbda2939f940656d3a209c5bd8315e724360a40a3 (diff)
parenteea5d6376a4bfdd8c190bfd8bc031960222af098 (diff)
downloadslskd-c97abdba209bc96886b28b6cb4bdd5886ed3de33.tar.gz
Merge pull request #233 from slskd/jwt
Require 16 character JWT secrets (if supplied), don't encrypt secret with pbkdf2
Diffstat (limited to 'src')
-rw-r--r--src/slskd/Options.cs2
-rw-r--r--src/slskd/Startup.cs4
2 files changed, 3 insertions, 3 deletions
diff --git a/src/slskd/Options.cs b/src/slskd/Options.cs
index e172db41..3bc4903f 100644
--- a/src/slskd/Options.cs
+++ b/src/slskd/Options.cs
@@ -752,7 +752,7 @@ namespace slskd
[Argument(default, "jwt-key")]
[EnvironmentVariable("JWT_KEY")]
[Description("JWT signing key")]
- [StringLength(255, MinimumLength = 1)]
+ [StringLength(255, MinimumLength = 16)]
[RequiresRestart]
public string Key { get; private set; } = Guid.NewGuid().ToString();
diff --git a/src/slskd/Startup.cs b/src/slskd/Startup.cs
index 322d8ed8..0ac5c437 100644
--- a/src/slskd/Startup.cs
+++ b/src/slskd/Startup.cs
@@ -20,6 +20,7 @@ namespace slskd
using System;
using System.IO;
using System.Linq;
+ using System.Text;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication.JwtBearer;
@@ -36,7 +37,6 @@ namespace slskd
using Serilog;
using slskd.Authentication;
using slskd.Core.API;
- using slskd.Cryptography;
using slskd.Integrations.FTP;
using slskd.Integrations.Pushbullet;
using slskd.Messaging;
@@ -71,7 +71,7 @@ namespace slskd
ContentPath = Path.GetFullPath(OptionsAtStartup.Web.ContentPath);
- JwtSigningKey = new SymmetricSecurityKey(Pbkdf2.GetKey(OptionsAtStartup.Web.Authentication.Jwt.Key));
+ JwtSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(OptionsAtStartup.Web.Authentication.Jwt.Key));
}
private IConfiguration Configuration { get; }