Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: delete misleading comments #3844

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions src/utils/cookie.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,11 @@ const _serialize = (name: string, value: string, opt: CookieOptions = {}): strin
let cookie = `${name}=${value}`

if (name.startsWith('__Secure-') && !opt.secure) {
// FIXME: replace link to RFC
// https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis-13#section-4.1.3.1
throw new Error('__Secure- Cookie must have Secure attributes')
}

if (name.startsWith('__Host-')) {
// FIXME: replace link to RFC
// https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis-13#section-4.1.3.2
if (!opt.secure) {
throw new Error('__Host- Cookie must have Secure attributes')
Expand All @@ -165,7 +163,6 @@ const _serialize = (name: string, value: string, opt: CookieOptions = {}): strin

if (opt && typeof opt.maxAge === 'number' && opt.maxAge >= 0) {
if (opt.maxAge > 34560000) {
// FIXME: replace link to RFC
// https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis-13#section-4.1.2.2
throw new Error(
'Cookies Max-Age SHOULD NOT be greater than 400 days (34560000 seconds) in duration.'
Expand All @@ -184,7 +181,6 @@ const _serialize = (name: string, value: string, opt: CookieOptions = {}): strin

if (opt.expires) {
if (opt.expires.getTime() - Date.now() > 34560000_000) {
// FIXME: replace link to RFC
// https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis-13#section-4.1.2.1
throw new Error(
'Cookies Expires SHOULD NOT be greater than 400 days (34560000 seconds) in the future.'
Expand All @@ -210,7 +206,6 @@ const _serialize = (name: string, value: string, opt: CookieOptions = {}): strin
}

if (opt.partitioned) {
// FIXME: replace link to RFC
// https://www.ietf.org/archive/id/draft-cutler-httpbis-partitioned-cookies-01.html#section-2.3
if (!opt.secure) {
throw new Error('Partitioned Cookie must have Secure attributes')
Expand Down
Loading