Bläddra i källkod

Merge pull request #12880 from overleaf/em-hash-oauth-secrets-4

Hash secrets when creating OAuth clients

GitOrigin-RevId: 5fb05bd825ceaabda635fe554a95879773aa3396
Eric Mc Sween 3 år sedan
förälder
incheckning
8a0a67e2bb
1 ändrade filer med 4 tillägg och 1 borttagningar
  1. 4 1
      services/web/scripts/oauth/register_client.js

+ 4 - 1
services/web/scripts/oauth/register_client.js

@@ -1,6 +1,9 @@
 const minimist = require('minimist')
 const minimist = require('minimist')
 const { ObjectId } = require('mongodb')
 const { ObjectId } = require('mongodb')
 const { waitForDb, db } = require('../../app/src/infrastructure/mongodb')
 const { waitForDb, db } = require('../../app/src/infrastructure/mongodb')
+const {
+  hashSecret,
+} = require('../../modules/oauth2-server/app/src/SecretsHelper')
 
 
 async function main() {
 async function main() {
   const opts = parseArgs()
   const opts = parseArgs()
@@ -40,7 +43,7 @@ async function upsertApplication(opts) {
     updates.name = opts.name
     updates.name = opts.name
   }
   }
   if (opts.secret != null) {
   if (opts.secret != null) {
-    updates.clientSecret = opts.secret
+    updates.clientSecret = hashSecret(opts.secret)
   }
   }
   if (opts.grants != null) {
   if (opts.grants != null) {
     updates.grants = opts.grants
     updates.grants = opts.grants