parse-dashboard icon indicating copy to clipboard operation
parse-dashboard copied to clipboard

PFFile upload via Dashboard fails with 403

Open Roost opened this issue 10 years ago • 4 comments

After a recent update to Parse-Server 2.2.24 running Parse-dashboard 1.1.19, we are having issues with PFFile uploads via the dashboard to S3 server via the filesAdapter config.

Environment Setup

Config

...
            filesAdapter: new S3Adapter(
                "Accesskey", //AccessKey
                "SuperSecret", //Secret
                "some-bucketname", //Bucket
                {
                    directAccess: true,
                    bucketPrefix: "user_uploads/"
                }
            ) 
...

Server

var api = new ParseServer({

    databaseURI: databaseURI,
    cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',

    appId: buildVariables.appId,
    masterKey: buildVariables.masterKey,
    serverURL: buildVariables.serverURL,
    publicServerURL : buildVariables.publicServerURL,
    clientKey: buildVariables.clientKey,
    javascriptKey: buildVariables.javascriptKey,
    appName: buildVariables.appName,
    filesAdapter: buildVariables.filesAdapter,

});

Steps to reproduce

We have been able to replicate the issue by calling the upload mechanism directly in cloud code using only AppId and Masterkey- this results in a 403 error. If we include the ClientKey in the cloud code request, the request is successful as expected (200).

Rolling Parse-Server back to 2.2.23 allows the file upload to work as expected, with unchanged config settings. It appears that additional key requirements on the server need to be supported by the dashboard- ie, we need to supply the Clientkey to the dashboard config for the upload to succeed.

Roost avatar Nov 14 '16 18:11 Roost

You can add any kind of key to the dashboard config - e.g. I needed to add javascriptKey for stuff to work :)

mario avatar Nov 14 '16 21:11 mario

@mario Sigh, thanks. Such an obvious solution escaped me.

FYI, for anyone else with the issue, adding clientKey to Parse-Dashboard config solves the problem.

    "apps": [
        {
            "serverURL": buildVariables.serverURL,
            "appId": buildVariables.appId,
            "masterKey": buildVariables.masterKey,
            "appName": buildVariables.appName,
            "clientKey": buildVariables.clientKey
        }
    ],

Roost avatar Nov 14 '16 22:11 Roost

@Roost it happens to the best of us - let me know if I can help you in any other way :)

mario avatar Nov 14 '16 22:11 mario

What is happening is that you do not specify all 4 auth keys (dotnet, js, rest, client) on parse-server and prior to 2.2.24 this would mean no keys being checked.

In 2.2.24 if the master key is not supplied then at least one auth key must match. It seems file upload is not using the master key so I think this is worth investigating or at least updating the docs if clientKey is required now.

steven-supersolid avatar Nov 15 '16 09:11 steven-supersolid