mirror of
https://github.com/bitwarden/server.git
synced 2025-07-03 00:52:49 -05:00
[PM-5052] Upgrade to .NET 8 (#3461)
* Upgrade to .NET 8 * Linting * Clean up old JSON deserialization code * More .NET 8-oriented linting * Light feedback * Get rid of old test we don't know the root issue for * Fix a new test * Remove now-unnecessary Renovate constraint * Use Any() * Somehow a 6.0 tooling config we don't need snuck back in * Space out properties that always change per release * Bump a few core packages since the last update
This commit is contained in:
@ -59,7 +59,7 @@ public class CreateOrganizationDomainCommand : ICreateOrganizationDomainCommand
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_logger.LogError("Error verifying Organization domain.", e);
|
||||
_logger.LogError(e, "Error verifying Organization domain.");
|
||||
}
|
||||
|
||||
organizationDomain.SetNextRunDate(_globalSettings.DomainVerification.VerificationInterval);
|
||||
|
@ -88,7 +88,7 @@ public class ValidateSponsorshipCommand : CancelSponsorshipCommand, IValidateSpo
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_logger.LogError("Error sending Family sponsorship removed email.", e);
|
||||
_logger.LogError(e, "Error sending Family sponsorship removed email.");
|
||||
}
|
||||
}
|
||||
await base.DeleteSponsorshipAsync(sponsorship);
|
||||
|
@ -45,18 +45,6 @@ public static class JsonHelpers
|
||||
};
|
||||
}
|
||||
|
||||
[Obsolete("This is built into .NET 6, it SHOULD be removed when we upgrade")]
|
||||
public static T ToObject<T>(this JsonElement element, JsonSerializerOptions options = null)
|
||||
{
|
||||
return JsonSerializer.Deserialize<T>(element.GetRawText(), options ?? Default);
|
||||
}
|
||||
|
||||
[Obsolete("This is built into .NET 6, it SHOULD be removed when we upgrade")]
|
||||
public static T ToObject<T>(this JsonDocument document, JsonSerializerOptions options = null)
|
||||
{
|
||||
return JsonSerializer.Deserialize<T>(document.RootElement.GetRawText(), options ?? default);
|
||||
}
|
||||
|
||||
public static T DeserializeOrNew<T>(string json, JsonSerializerOptions options = null)
|
||||
where T : new()
|
||||
{
|
||||
|
@ -15,13 +15,13 @@ public sealed class SecurityHeadersMiddleware
|
||||
public Task Invoke(HttpContext context)
|
||||
{
|
||||
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options
|
||||
context.Response.Headers.Add("x-frame-options", new StringValues("SAMEORIGIN"));
|
||||
context.Response.Headers.Append("x-frame-options", new StringValues("SAMEORIGIN"));
|
||||
|
||||
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-XSS-Protection
|
||||
context.Response.Headers.Add("x-xss-protection", new StringValues("1; mode=block"));
|
||||
context.Response.Headers.Append("x-xss-protection", new StringValues("1; mode=block"));
|
||||
|
||||
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Type-Options
|
||||
context.Response.Headers.Add("x-content-type-options", new StringValues("nosniff"));
|
||||
context.Response.Headers.Append("x-content-type-options", new StringValues("nosniff"));
|
||||
|
||||
return _next(context);
|
||||
}
|
||||
|
@ -18,21 +18,4 @@ public static class SpanExtensions
|
||||
rest = input[++splitIndex..];
|
||||
return true;
|
||||
}
|
||||
|
||||
// Replace with the implementation from .NET 8 when we upgrade
|
||||
// Ref: https://github.com/dotnet/runtime/issues/59466
|
||||
public static int Count<T>(this ReadOnlySpan<T> span, T value)
|
||||
where T : IEquatable<T>
|
||||
{
|
||||
var count = 0;
|
||||
int pos;
|
||||
|
||||
while ((pos = span.IndexOf(value)) >= 0)
|
||||
{
|
||||
span = span[++pos..];
|
||||
count++;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user