fix(backend): reject malformed timestamp (#12554)
This commit is contained in:

committed by
GitHub

parent
34223f3da4
commit
af15f8d09d
@@ -34,3 +34,7 @@ export function parseAid(id: string): { date: Date; } {
|
||||
const time = parseInt(id.slice(0, 8), 36) + TIME2000;
|
||||
return { date: new Date(time) };
|
||||
}
|
||||
|
||||
export function isSafeAidT(t: number): boolean {
|
||||
return t > TIME2000;
|
||||
}
|
||||
|
@@ -41,3 +41,7 @@ export function parseAidx(id: string): { date: Date; } {
|
||||
const time = parseInt(id.slice(0, TIME_LENGTH), 36) + TIME2000;
|
||||
return { date: new Date(time) };
|
||||
}
|
||||
|
||||
export function isSafeAidxT(t: number): boolean {
|
||||
return t > TIME2000;
|
||||
}
|
||||
|
@@ -38,3 +38,7 @@ export function parseMeid(id: string): { date: Date; } {
|
||||
date: new Date(parseInt(id.slice(0, 12), 16) - 0x800000000000),
|
||||
};
|
||||
}
|
||||
|
||||
export function isSafeMeidT(t: number): boolean {
|
||||
return t > 0;
|
||||
}
|
||||
|
@@ -38,3 +38,7 @@ export function parseMeidg(id: string): { date: Date; } {
|
||||
date: new Date(parseInt(id.slice(1, 12), 16)),
|
||||
};
|
||||
}
|
||||
|
||||
export function isSafeMeidgT(t: number): boolean {
|
||||
return t > 0;
|
||||
}
|
||||
|
@@ -38,3 +38,7 @@ export function parseObjectId(id: string): { date: Date; } {
|
||||
date: new Date(parseInt(id.slice(0, 8), 16) * 1000),
|
||||
};
|
||||
}
|
||||
|
||||
export function isSafeObjectIdT(t: number): boolean {
|
||||
return t > 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user