Skip to content

Reconsider default HSTS max-age value  #50605

Open
@ghost

Description

Currently, the default value for HTTP Strict Transport Security (HSTS) max-age is set to 30 days.

public TimeSpan MaxAge { get; set; } = TimeSpan.FromDays(30);

According to hstspreload.org, it is recommended that the minimum value should be at least 1 year, with a preferable value of 2 years.

The current default value may not align with modern security best practices, and it might be beneficial to reconsider it.

I propose that we reconsider the default value and update it to a more secure and recommended value, such as 1 year.

Also, setting a longer default max-age value will avoid additional configuration, as it is very common to reconfigure this value as follows:

builder.Services.AddHsts(options =>
{
    options.MaxAge = TimeSpan.FromDays(365); // Common practice to set it to 1 year or more
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    Securityarea-middlewareIncludes: URL rewrite, redirect, response cache/compression, session, and other general middlewares

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions