Re: import upload file to pgadmin get CSRF error

From: Fahar Abbas <fahar(dot)abbas(at)enterprisedb(dot)com>
To: Avin Kavish <avinkavish(at)gmail(dot)com>, Dave Page <dpage(at)pgadmin(dot)org>
Cc: Ashesh Vashi <ashesh(dot)vashi(at)enterprisedb(dot)com>, Wh isere <whisere(at)gmail(dot)com>, Murtuza Zabuawala <murtuza(dot)zabuawala(at)enterprisedb(dot)com>, Khushboo Vashi <khushboo(dot)vashi(at)enterprisedb(dot)com>, "pgadmin-support lists(dot)postgresql(dot)org" <pgadmin-support(at)lists(dot)postgresql(dot)org>
Subject: Re: import upload file to pgadmin get CSRF error
Date: 2019-08-06 07:43:12
Message-ID: CAJFwRrNPbGMjx9F43hT+WWvD2JnQrC=_0Pn-PwKbHuO=dbqNsw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-support

Hi Avin,

Please replay on Ashesh question: Is it running in 'web' or 'desktop' mode?

Also adding Dave Page for his further inputs about shutdown pgadmin4 server
process.

Kind Regards,

On Tue, Aug 6, 2019 at 12:06 PM Avin Kavish <avinkavish(at)gmail(dot)com> wrote:

> You can use any one of ps, top, htop, or systemctl to view running
> services/processes and kill them
>
> On Tue, Aug 6, 2019 at 12:21 PM Ashesh Vashi <
> ashesh(dot)vashi(at)enterprisedb(dot)com> wrote:
>
>> On Tue, Aug 6, 2019 at 12:18 PM Fahar Abbas <fahar(dot)abbas(at)enterprisedb(dot)com>
>> wrote:
>>
>>> Hi,
>>>
>>> On Tue, Aug 6, 2019 at 11:36 AM Wh isere <whisere(at)gmail(dot)com> wrote:
>>>
>>>> Thank you! I am running pgadmin on a remote server, so there is not Gui
>>>> interface, is there command to shut down pgadmin4 server?
>>>> I also run yum upgrade pgadmin4*, but it said yum: No match.
>>>>
>>> Kindly first install GUI on remote machine and shut down pgadmin4
>>> server.
>>>
>> Before doing that - how did you setup the pgAdmin 4?
>> Is it running in 'web' or 'desktop' mode?
>>
>> -- Thanks, Ashesh
>>
>>> I don't think so we have any command to shutdown the server.
>>>
>>> When you will shutdown the pgadmin4 server properly and follow the steps
>>> mentioned in the previous replay properly you will not able to see older
>>> pgadmin4 4.8 version.
>>>
>>>> Thanks.
>>>>
>>>> On Tue, Aug 6, 2019 at 4:25 PM Fahar Abbas <
>>>> fahar(dot)abbas(at)enterprisedb(dot)com> wrote:
>>>>
>>>>> Please find attached the snapshot for pgadmin4 shutdown the server.
>>>>>
>>>>> On Tue, Aug 6, 2019 at 11:21 AM Fahar Abbas <
>>>>> fahar(dot)abbas(at)enterprisedb(dot)com> wrote:
>>>>>
>>>>>> Yes it's due to pgadmin4 is not properly upgrade on your system.
>>>>>>
>>>>>> Why not you try yum upgrade pgadmin4* include (*)
>>>>>>
>>>>>> Can you do following steps.
>>>>>>
>>>>>> 1. Clear you cache
>>>>>> 2. Please shutdown the pgadmin4 server through elephant icon
>>>>>> 3. then try yum upgrade pgadmin4*
>>>>>>
>>>>>>
>>>>>> If you are still getting any error message and kindly do following:
>>>>>>
>>>>>> 1. yum erase pgadmin4*
>>>>>> 2. yum clean all
>>>>>> 3. yum erase pgadmin4*
>>>>>> 4. try yum make cache
>>>>>> 5. yum makecache
>>>>>> 6. Now install pgadmin4 through yum install pgadmin4*
>>>>>>
>>>>>> Kindly let us know if your issue is resolve or not?
>>>>>>
>>>>>> Kind Regards?
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Tue, Aug 6, 2019 at 11:07 AM Wh isere <whisere(at)gmail(dot)com> wrote:
>>>>>>
>>>>>>> Thanks, I have tried yum upgrade pgadmin4, it is still the same.
>>>>>>>
>>>>>>> here is the output from previous yum update pgadmin4, and screen
>>>>>>> shot of pgadmin4 attached.:
>>>>>>>
>>>>>>> sudo yum update pgadmin4
>>>>>>> Loaded plugins: enabled_repos_upload, package_upload, product-id,
>>>>>>> search-
>>>>>>> : disabled-repos, subscription-manager, tracer_upload
>>>>>>> rhel-7-server-rpms | 2.0
>>>>>>> kB 00:00
>>>>>>> rhel-7-server-satellite-tools-6.5-rpms | 2.1
>>>>>>> kB 00:00
>>>>>>> Resolving Dependencies
>>>>>>> --> Running transaction check
>>>>>>> ---> Package pgadmin4.x86_64 0:4.8-1.rhel7 will be updated
>>>>>>> ---> Package pgadmin4.x86_64 0:4.11-1.rhel7 will be an update
>>>>>>> --> Finished Dependency Resolution
>>>>>>>
>>>>>>> Dependencies Resolved
>>>>>>>
>>>>>>>
>>>>>>> ================================================================================
>>>>>>> Package Arch Version
>>>>>>> Repository Size
>>>>>>>
>>>>>>> ================================================================================
>>>>>>> Updating:
>>>>>>> pgadmin4 x86_64 4.11-1.rhel7
>>>>>>> pgdg10 11 k
>>>>>>>
>>>>>>> Transaction Summary
>>>>>>>
>>>>>>> ================================================================================
>>>>>>> Upgrade 1 Package
>>>>>>>
>>>>>>> Total download size: 11 k
>>>>>>> Is this ok [y/d/N]: y
>>>>>>> Downloading packages:
>>>>>>> No Presto metadata available for pgdg10
>>>>>>> pgadmin4-4.11-1.rhel7.x86_64.rpm | 11
>>>>>>> kB 00:01
>>>>>>> Running transaction check
>>>>>>> Running transaction test
>>>>>>> Transaction test succeeded
>>>>>>> Running transaction
>>>>>>> Updating :
>>>>>>> pgadmin4-4.11-1.rhel7.x86_64 1/2
>>>>>>> Cleanup :
>>>>>>> pgadmin4-4.8-1.rhel7.x86_64 2/2
>>>>>>> Uploading Package Profile
>>>>>>> Uploading Tracer Profile
>>>>>>> Verifying :
>>>>>>> pgadmin4-4.11-1.rhel7.x86_64 1/2
>>>>>>> Verifying :
>>>>>>> pgadmin4-4.8-1.rhel7.x86_64 2/2
>>>>>>>
>>>>>>> Updated:
>>>>>>> pgadmin4.x86_64
>>>>>>> 0:4.11-1.rhel7
>>>>>>>
>>>>>>> Complete!
>>>>>>> Uploading Enabled Repositories Report
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Tue, Aug 6, 2019 at 3:49 PM Fahar Abbas <
>>>>>>> fahar(dot)abbas(at)enterprisedb(dot)com> wrote:
>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> Can you please try yum upgrade pgadmin4* and check the pgadmin4?
>>>>>>>>
>>>>>>>>
>>>>>>>> On Tue, Aug 6, 2019 at 10:39 AM Wh isere <whisere(at)gmail(dot)com> wrote:
>>>>>>>>
>>>>>>>>> It is web browser cache we need to clean or other cache? Thanks.
>>>>>>>>>
>>>>>>>>> On Tue, Aug 6, 2019 at 3:27 PM Wh isere <whisere(at)gmail(dot)com> wrote:
>>>>>>>>>
>>>>>>>>>> Thanks. I cleaned the cache, but it is still the same.
>>>>>>>>>>
>>>>>>>>>> On Tue, Aug 6, 2019 at 3:18 PM Ashesh Vashi <
>>>>>>>>>> ashesh(dot)vashi(at)enterprisedb(dot)com> wrote:
>>>>>>>>>>
>>>>>>>>>>> Would please try to clear the cache?
>>>>>>>>>>>
>>>>>>>>>>> --
>>>>>>>>>>>
>>>>>>>>>>> Thanks & Regards,
>>>>>>>>>>>
>>>>>>>>>>> Ashesh Vashi
>>>>>>>>>>> EnterpriseDB INDIA: Enterprise PostgreSQL Company
>>>>>>>>>>> <http://www.enterprisedb.com>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> *http://www.linkedin.com/in/asheshvashi*
>>>>>>>>>>> <http://www.linkedin.com/in/asheshvashi>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> On Tue, Aug 6, 2019 at 10:47 AM Wh isere <whisere(at)gmail(dot)com>
>>>>>>>>>>> wrote:
>>>>>>>>>>>
>>>>>>>>>>>> I run 'yum update pgadmin4' it appears pgadmin4 already 4.11,
>>>>>>>>>>>> but on the web interface under about it still shows 4.8. Any idea? Thanks.
>>>>>>>>>>>>
>>>>>>>>>>>> On Tue, Aug 6, 2019 at 3:08 PM Wh isere <whisere(at)gmail(dot)com>
>>>>>>>>>>>> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>> Hello, we have updated pgadmin4 to 4.11 but this problem is
>>>>>>>>>>>>> still there. Thanks.
>>>>>>>>>>>>>
>>>>>>>>>>>>> On Fri, Jun 28, 2019 at 3:09 PM Murtuza Zabuawala <
>>>>>>>>>>>>> murtuza(dot)zabuawala(at)enterprisedb(dot)com> wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> On Fri, Jun 28, 2019 at 10:18 AM Where is Where <
>>>>>>>>>>>>>> whisere(at)gmail(dot)com> wrote:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Thanks for the clarification Murtuza. Any idea about when
>>>>>>>>>>>>>>> it might be, eg the packages in here:
>>>>>>>>>>>>>>> https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7Server-x86_64/
>>>>>>>>>>>>>>> . Thanks!
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Not sure, that is something handled by Postgres packaging
>>>>>>>>>>>>>> community and not by pgAdmin4 team.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> -- Murtuza
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> On Fri, Jun 28, 2019 at 1:55 PM Murtuza Zabuawala <
>>>>>>>>>>>>>>> murtuza(dot)zabuawala(at)enterprisedb(dot)com> wrote:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> On Fri, Jun 28, 2019 at 6:31 AM Where is Where <
>>>>>>>>>>>>>>>> whisere(at)gmail(dot)com> wrote:
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Is there a way to apply this bug fix on a installation on
>>>>>>>>>>>>>>>>> redhat?The 4.9 redhat yum package is not available yet. Thanks!
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> No, Release version of JS files are bundled by webpacker,
>>>>>>>>>>>>>>>> so it is not feasible to patch them.
>>>>>>>>>>>>>>>> You have to wait until the yum repo gets the updated
>>>>>>>>>>>>>>>> version.
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> -- Murtuza
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> On Tue, Jun 25, 2019 at 9:30 AM Where is Where <
>>>>>>>>>>>>>>>>> whisere(at)gmail(dot)com> wrote:
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Thank you! I will wait for the release on Thursday. Will
>>>>>>>>>>>>>>>>>> the redhat yum package be updated too? Or can I download the tar file and
>>>>>>>>>>>>>>>>>> use some file from it to replace the file on the server?
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Thanks.
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> On Mon, Jun 24, 2019 at 4:25 PM Khushboo Vashi <
>>>>>>>>>>>>>>>>>> khushboo(dot)vashi(at)enterprisedb(dot)com> wrote:
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> On Mon, Jun 24, 2019 at 11:42 AM Where is Where <
>>>>>>>>>>>>>>>>>>> whisere(at)gmail(dot)com> wrote:
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> Thank you! I just saw that too. I tried to apply that
>>>>>>>>>>>>>>>>>>>> diff only:
>>>>>>>>>>>>>>>>>>>> https://redmine.postgresql.org/projects/pgadmin4/repository/revisions/08b78fb6a11283731cdf59d2a29fdc75e459582e/diff/web/pgadmin/misc/file_manager/static/js/utility.js
>>>>>>>>>>>>>>>>>>>> But it doesn't seem to fix the problem.
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> It will require bundling of the static files after
>>>>>>>>>>>>>>>>>>> applying the patch.
>>>>>>>>>>>>>>>>>>> Instead, you can install the pgAdmin from the nightly
>>>>>>>>>>>>>>>>>>> builds having the latest code.
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> https://www.postgresql.org/ftp/pgadmin/pgadmin4/snapshots/2019-06-24/
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> * // We need to append our csrf token with dropzone's ajax request header
>>>>>>>>>>>>>>>>>>>> *
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> * let csrfToken = {};
>>>>>>>>>>>>>>>>>>>> *
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> * csrfToken[pgAdmin.csrf_token_header] = pgAdmin.csrf_token;
>>>>>>>>>>>>>>>>>>>> *
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> $('div#multiple-uploads').dropzone({
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> paramName: 'newfile',
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> url: pgAdmin.FileUtils.fileConnector,
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> *headers: csrfToken,*
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> Thanks, Junran
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> On Mon, Jun 24, 2019 at 3:47 PM Khushboo Vashi <
>>>>>>>>>>>>>>>>>>>> khushboo(dot)vashi(at)enterprisedb(dot)com> wrote:
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> On Mon, Jun 24, 2019 at 11:13 AM Where is Where <
>>>>>>>>>>>>>>>>>>>>> whisere(at)gmail(dot)com> wrote:
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> Hello, we are trying to import csv file to database
>>>>>>>>>>>>>>>>>>>>>> from pgadmin, but when uploading file it reports '
>>>>>>>>>>>>>>>>>>>>>> 400 Bad Request <h1>Bad Request</h1> <p>The CSRF
>>>>>>>>>>>>>>>>>>>>>> token is missing.</p> '
>>>>>>>>>>>>>>>>>>>>>> I looked at config.py but can't find any related
>>>>>>>>>>>>>>>>>>>>>> setting.
>>>>>>>>>>>>>>>>>>>>>> Any idea is much appreciated.
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> This issue has already been reported and fixed. (Ref:
>>>>>>>>>>>>>>>>>>>>> https://redmine.postgresql.org/issues/4350)
>>>>>>>>>>>>>>>>>>>>> You will get the fix in the upcoming release which is
>>>>>>>>>>>>>>>>>>>>> scheduled on coming Thursday.
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> Thanks,
>>>>>>>>>>>>>>>>>>>>> Khushboo
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> Fahar Abbas
>>>>>>>> QMG
>>>>>>>> EnterpriseDB Corporation
>>>>>>>> Phone Office: +92-51-835-8874
>>>>>>>> Phone Direct: +92-51-8466803
>>>>>>>> Mobile: +92-333-5409707
>>>>>>>> Skype ID: *live:fahar.abbas*
>>>>>>>> Website: www.enterprisedb.com
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>> --
>>>>>> Fahar Abbas
>>>>>> QMG
>>>>>> EnterpriseDB Corporation
>>>>>> Phone Office: +92-51-835-8874
>>>>>> Phone Direct: +92-51-8466803
>>>>>> Mobile: +92-333-5409707
>>>>>> Skype ID: *live:fahar.abbas*
>>>>>> Website: www.enterprisedb.com
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Fahar Abbas
>>>>> QMG
>>>>> EnterpriseDB Corporation
>>>>> Phone Office: +92-51-835-8874
>>>>> Phone Direct: +92-51-8466803
>>>>> Mobile: +92-333-5409707
>>>>> Skype ID: *live:fahar.abbas*
>>>>> Website: www.enterprisedb.com
>>>>>
>>>>
>>>
>>> --
>>> Fahar Abbas
>>> QMG
>>> EnterpriseDB Corporation
>>> Phone Office: +92-51-835-8874
>>> Phone Direct: +92-51-8466803
>>> Mobile: +92-333-5409707
>>> Skype ID: *live:fahar.abbas*
>>> Website: www.enterprisedb.com
>>>
>>

--
Fahar Abbas
QMG
EnterpriseDB Corporation
Phone Office: +92-51-835-8874
Phone Direct: +92-51-8466803
Mobile: +92-333-5409707
Skype ID: *live:fahar.abbas*
Website: www.enterprisedb.com

In response to

Responses

Browse pgadmin-support by date

  From Date Subject
Next Message Dave Page 2019-08-06 08:02:02 Re: import upload file to pgadmin get CSRF error
Previous Message Avin Kavish 2019-08-06 07:09:34 Re: import upload file to pgadmin get CSRF error