Exempt some of the Views/blueprints from CSRF protection
(self, app)
| 20 | self._pg_csrf_exempt(app) |
| 21 | |
| 22 | def _pg_csrf_exempt(self, app): |
| 23 | """Exempt some of the Views/blueprints from CSRF protection |
| 24 | """ |
| 25 | |
| 26 | exempt_views = [ |
| 27 | 'flask.app.<lambda>', |
| 28 | 'flask.scaffold.send_static_file', # For Flask 2.* |
| 29 | 'flask.blueprints.send_static_file', |
| 30 | 'flask_security.views.login', |
| 31 | 'flask_security.views.logout', |
| 32 | 'pgadmin.tools.translations', |
| 33 | app.blueprints['redirects'], |
| 34 | 'pgadmin.browser.server_groups.servers.supported_servers-js', |
| 35 | 'pgadmin.tools.sqleditor.initialize_sqleditor', |
| 36 | 'pgadmin.tools.datagrid.panel', |
| 37 | 'pgadmin.tools.sqleditor.panel', |
| 38 | 'pgadmin.tools.debugger.initialize_target', |
| 39 | 'pgadmin.tools.debugger.direct_new', |
| 40 | 'pgadmin.tools.schema_diff.panel', |
| 41 | 'pgadmin.tools.schema_diff.ddl_compare', |
| 42 | 'pgadmin.authenticate.login', |
| 43 | 'pgadmin.tools.erd.panel', |
| 44 | 'pgadmin.tools.psql.panel', |
| 45 | 'pgadmin.preferences.get_all_cli', |
| 46 | ] |
| 47 | |
| 48 | for exempt in exempt_views: |
| 49 | self.exempt(exempt) |
| 50 | |
| 51 | |
| 52 | pgCSRFProtect = _PGCSRFProtect() |