You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by GitBox <gi...@apache.org> on 2022/12/14 08:03:16 UTC

[GitHub] [dolphinscheduler] EricGao888 commented on a diff in pull request #13164: [Improvement][Security]Add CSRF protection(issue-12931)

EricGao888 commented on code in PR #13164:
URL: https://github.com/apache/dolphinscheduler/pull/13164#discussion_r1048127023


##########
dolphinscheduler-ui/src/service/service.ts:
##########
@@ -74,9 +74,12 @@ const err = (err: AxiosError): Promise<AxiosError> => {
 service.interceptors.request.use((config: AxiosRequestConfig<any>) => {
   config.headers && (config.headers.sessionId = userStore.getSessionId)
   const language = cookies.get('language')
+  const sessionId = cookies.get('sessionId')
   config.headers = config.headers || {}
   if (language) config.headers.language = language
-
+  if (sessionId) {
+    config.headers['X-CSRF-TOKEN'] = sessionId.split('').reverse().join('')

Review Comment:
   Currently, you invert the sessionId to get a `CSRF` token and put it in headers in front-end. As you wrote in PR change log, you plan to encrypt it in the future, may I ask where and how you plan to encrypt it?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org