mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-30 11:54:33 +03:00
789e2c96c0
fixes https://github.com/TryGhost/Team/issues/1996 **Issue** Our Magic links are valid for 24 hours. After first usage, the token lives for a further 10 minutes, so that in the case of email servers or clients that "visit" links, the token can still be used. The implementation of the 10 minute window uses setTimeout, meaning if the process is interrupted, the 10 minute window is ignored completely, and the token will continue to live for the remainder of it's 24 hour validity period. To prevent that, the tokens are cleared on boot at the moment. **Solution** To remove the boot clearing logic, we need to make sure the tokens are only valid for 10 minutes after first use even during restarts. This commit adds 3 new fields to the SingleUseToken model: - updated_at: for storing the last time the token was changed/used). Not really used atm. - first_used_at: for storing the first time the token was used - used_count: for storing the number of times the token has been used Using these fields: - A token can only be used 3 times - A token is only valid for 10 minutes after first use, even if the server restarts in between - A token is only valid for 24 hours after creation (not changed) We now also delete expired tokens in a separate job instead of on boot / in a timeout.
36 lines
907 B
JSON
36 lines
907 B
JSON
{
|
|
"all": true,
|
|
"check-coverage": true,
|
|
"reporter": [
|
|
"html-spa",
|
|
"text-summary",
|
|
"cobertura"
|
|
],
|
|
"statements": 60,
|
|
"branches": 85,
|
|
"functions": 50,
|
|
"lines": 60,
|
|
"include": [
|
|
"core/{*.js,frontend,server,shared}"
|
|
],
|
|
"exclude": [
|
|
"core/frontend/src/**",
|
|
"core/frontend/public/**",
|
|
"core/server/data/migrations/**",
|
|
"core/server/data/schema/schema.js",
|
|
"!core/server/data/migrations/utils.js",
|
|
"core/frontend/web/**",
|
|
"!core/frontend/web/middleware/**",
|
|
"core/server/web/api/**",
|
|
"!core/server/web/api/middleware/**",
|
|
"core/server/web/api/testmode/**",
|
|
"core/server/web/parent/**",
|
|
"!core/server/web/parent/middleware/**",
|
|
"core/server/web/shared/**",
|
|
"!core/server/web/shared/middleware/**",
|
|
"core/server/api/endpoints/**",
|
|
"!core/server/api/endpoints/utils",
|
|
"core/server/services/members/jobs/**"
|
|
]
|
|
}
|