mirror of
https://blitiri.com.ar/repos/chasquid
synced 2025-12-21 15:17:01 +00:00
sts: Reject policies with max_age > 1y, as per RFC
The MTA-STS standard explicitly says the maximum max_age is 1 year. This patch adds a check to the STS library to enforce this. Policies with max_age > 1y will be treated as invalid. See this email thread for some discussion on the topic: https://mailarchive.ietf.org/arch/msg/uta/bnUjy9jxM_Va-lDXVtbB32zIkYI
This commit is contained in:
@@ -125,7 +125,11 @@ func (p *Policy) Check() error {
|
||||
if p.Version != "STSv1" {
|
||||
return ErrUnknownVersion
|
||||
}
|
||||
if p.MaxAge <= 0 {
|
||||
|
||||
// A 0 max age is invalid (could also represent an Atoi error), and so is
|
||||
// one greater than 31557600 (1 year), as per
|
||||
// https://tools.ietf.org/html/rfc8461#section-3.2.
|
||||
if p.MaxAge <= 0 || p.MaxAge > 31557600*time.Second {
|
||||
return ErrInvalidMaxAge
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user