Merge tag 'release/v2.1.8' into develop

Fix urgent OAuth2 bug.
This commit is contained in:
zkldi
2022-03-21 00:22:13 +00:00
3 changed files with 9 additions and 0 deletions
@@ -7,6 +7,8 @@ const router: Router = Router({ mergeParams: true });
/**
* Returns Tachi Configuration info, such as server name, type, supported games
* and more.
*
* @name GET /api/v1/config
*/
router.get("/", (req, res) =>
res.status(200).json({
@@ -32,6 +32,10 @@ t.test("POST /api/v1/oauth/token", (t) => {
"Should assign the permissions this client has configured."
);
const exists = await db["oauth2-auth-codes"].findOne({ code: "AUTH_CODE" });
t.equal(exists, null, "Should remove the code from the database after being used.");
t.end();
});
@@ -67,6 +67,9 @@ router.post(
});
}
// don't let people auth with the same code multiple times.
await db["oauth2-auth-codes"].remove({ code: req.body.code });
const apiDoc = {
userID: codeDoc.userID,
token: Random20Hex(),