1
0
Fork 0
mirror of synced 2024-06-30 03:50:37 +12:00

Merge pull request #756 from Budibase/couchdb-security

Couchdb security
This commit is contained in:
Martin McKeaveney 2020-10-19 20:29:35 +01:00 committed by GitHub
commit 5217cce4fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -24,7 +24,7 @@ function replicate(local, remote) {
})
}
async function replicateCouch({ instanceId, clientId, credentials }) {
async function replicateCouch({ instanceId, clientId, session }) {
const databases = [`client_${clientId}`, "client_app_lookup", instanceId]
const replications = databases.map(localDbName => {
@ -32,8 +32,9 @@ async function replicateCouch({ instanceId, clientId, credentials }) {
const remoteDb = new CouchDB(
`${process.env.DEPLOYMENT_DB_URL}/${localDbName}`,
{
auth: {
...credentials,
fetch: function(url, opts) {
opts.headers.set("Cookie", `${session};`)
return CouchDB.fetch(url, opts)
},
}
)
@ -118,7 +119,7 @@ async function deployApp({ instanceId, appId, clientId, deploymentId }) {
await replicateCouch({
instanceId,
clientId,
credentials: credentials.couchDbCreds,
session: credentials.couchDbSession,
})
await updateDeploymentQuota(credentials.quota)