Bugzilla – Attachment 154122 Details for
Bug 34369
Add CSRF protection to system preferences
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34369: Pass csrf token from syspref API client (for Vue app)
Bug-34369-Pass-csrf-token-from-syspref-API-client-.patch (text/plain), 2.20 KB, created by
Jonathan Druart
on 2023-08-01 07:39:39 UTC
(
hide
)
Description:
Bug 34369: Pass csrf token from syspref API client (for Vue app)
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2023-08-01 07:39:39 UTC
Size:
2.20 KB
patch
obsolete
>From 8cda11379780908ff1371ac1f3e1fdd9c06782d1 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 1 Aug 2023 09:12:10 +0200 >Subject: [PATCH] Bug 34369: Pass csrf token from syspref API client (for Vue > app) > >--- > .../intranet-tmpl/prog/en/modules/preservation/home.tt | 1 + > .../prog/js/vue/fetch/system-preferences-api-client.js | 7 +++++-- > 2 files changed, 6 insertions(+), 2 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/preservation/home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/preservation/home.tt >index 0c3d01ebc6c..45c1c240185 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/preservation/home.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/preservation/home.tt >@@ -34,6 +34,7 @@ > const db_columns = [% To.json(db_columns) | $raw %]; > const api_mappings = [% To.json(api_mappings) | $raw %]; > const notice_templates = [% To.json(notice_templates || []) | $raw %]; >+ const csrf_token = "[% Koha.GenerateCSRF | $raw %]"; > > </script> > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/system-preferences-api-client.js b/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/system-preferences-api-client.js >index 9cfcabf08f4..16a75a2caed 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/system-preferences-api-client.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/system-preferences-api-client.js >@@ -6,7 +6,6 @@ export class SysprefAPIClient extends HttpClient { > baseURL: "/cgi-bin/koha/svc/config/systempreferences", > }); > } >- > get sysprefs() { > return { > get: variable => >@@ -16,7 +15,11 @@ export class SysprefAPIClient extends HttpClient { > update: (variable, value) => > this.post({ > endpoint: "", >- body: "pref_%s=%s".format(variable, value), >+ body: "pref_%s=%s&csrf_token=%s".format( >+ variable, >+ value, >+ csrf_token >+ ), > headers: { > "Content-Type": > "application/x-www-form-urlencoded;charset=utf-8", >-- >2.25.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 34369
:
154121
|
154122
|
154163
|
154164
|
154165
|
154237
|
154238
|
154239