トークン系の乱数ソースではcryptoを使うように (#6200)
This commit is contained in:
parent
e2183400e5
commit
244ef0cb8f
5 changed files with 29 additions and 8 deletions
|
@ -1,4 +1,3 @@
|
|||
import rndstr from 'rndstr';
|
||||
import * as crypto from 'crypto';
|
||||
import $ from 'cafy';
|
||||
import define from '../../define';
|
||||
|
@ -6,6 +5,7 @@ import { ApiError } from '../../error';
|
|||
import { AuthSessions, AccessTokens, Apps } from '../../../../models';
|
||||
import { genId } from '../../../../misc/gen-id';
|
||||
import { ensure } from '../../../../prelude/ensure';
|
||||
import { secureRndstr } from '../../../../misc/secure-rndstr';
|
||||
|
||||
export const meta = {
|
||||
tags: ['auth'],
|
||||
|
@ -39,7 +39,7 @@ export default define(meta, async (ps, user) => {
|
|||
}
|
||||
|
||||
// Generate access token
|
||||
const accessToken = rndstr('a-zA-Z0-9', 32);
|
||||
const accessToken = secureRndstr(32, true);
|
||||
|
||||
// Fetch exist access token
|
||||
const exist = await AccessTokens.findOne({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue