You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2021/01/13 04:32:51 UTC

[GitHub] [apisix-dashboard] ThanoshanMV opened a new pull request #1284: fix: Client-side URL redirect

ThanoshanMV opened a new pull request #1284:
URL: https://github.com/apache/apisix-dashboard/pull/1284


   Please answer these questions before submitting a pull request
   
   - Why submit this pull request?
   - [x] Bugfix
   - [ ] New feature provided
   - [ ] Improve performance
   - [ ] Backport patches
   
   - Related issues
   
   ___
   ### Bugfix
   - Description
   Untrusted URL redirection due to user-provided value.
   
   - How to fix?
   We'll get the `redirectUrl` from `decodeURIComponent(redirect)`. Extract hostname from the `redirectUrl` and check if the current host and  `redirectUrl`'s host are same. If yes, we'll perform the redirect action otherwise we don't perform any redirect action. 


----------------------------------------------------------------
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.

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



[GitHub] [apisix-dashboard] ThanoshanMV commented on a change in pull request #1284: fix: Client-side URL redirect

Posted by GitBox <gi...@apache.org>.
ThanoshanMV commented on a change in pull request #1284:
URL: https://github.com/apache/apisix-dashboard/pull/1284#discussion_r557387672



##########
File path: web/src/pages/Setting/Setting.tsx
##########
@@ -75,6 +75,8 @@ const Setting: React.FC = () => {
               }
               history.push(path);
             }
+          } else {
+          history.push('/');

Review comment:
       Sure, I'll try it and let you know




----------------------------------------------------------------
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.

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



[GitHub] [apisix-dashboard] ThanoshanMV commented on a change in pull request #1284: fix: Client-side URL redirect

Posted by GitBox <gi...@apache.org>.
ThanoshanMV commented on a change in pull request #1284:
URL: https://github.com/apache/apisix-dashboard/pull/1284#discussion_r556359385



##########
File path: web/src/pages/Setting/Setting.tsx
##########
@@ -62,7 +62,15 @@ const Setting: React.FC = () => {
         });
         setTimeout(() => {
           const redirect = getUrlQuery('redirect');
-          window.location.href = redirect ? decodeURIComponent(redirect) : '/';
+          const currentHost = window.location.host;
+          if (redirect) {
+            const redirectUrl = decodeURIComponent(redirect);
+            const redirectHost = redirectUrl.split('/')[2];
+            if (currentHost === redirectHost) {
+              window.location.href = redirectUrl;

Review comment:
       I studied the source code and understood that `history.push()` is done via importing history from umi. I referred the [umi documentation on `history.push()`](https://umijs.org/api#history). 
   
   So, in line 70, can we try to replace the code like below:
   `history.push(redirectUrl);`




----------------------------------------------------------------
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.

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



[GitHub] [apisix-dashboard] codecov-io edited a comment on pull request #1284: fix: Client-side URL redirect

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #1284:
URL: https://github.com/apache/apisix-dashboard/pull/1284#issuecomment-759199156


   # [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1284?src=pr&el=h1) Report
   > Merging [#1284](https://codecov.io/gh/apache/apisix-dashboard/pull/1284?src=pr&el=desc) (0db4316) into [master](https://codecov.io/gh/apache/apisix-dashboard/commit/5f2232603588a47f902a90d974692a7c6bea535f?el=desc) (5f22326) will **decrease** coverage by `0.05%`.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-dashboard/pull/1284/graphs/tree.svg?width=650&height=150&src=pr&token=Q1HERXN96P)](https://codecov.io/gh/apache/apisix-dashboard/pull/1284?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master    #1284      +/-   ##
   ==========================================
   - Coverage   42.44%   42.39%   -0.06%     
   ==========================================
     Files          31       31              
     Lines        1932     1932              
   ==========================================
   - Hits          820      819       -1     
   - Misses       1001     1002       +1     
     Partials      111      111              
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/apisix-dashboard/pull/1284?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [api/internal/core/store/store.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1284/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvc3RvcmUvc3RvcmUuZ28=) | `79.37% <0.00%> (-0.63%)` | :arrow_down: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1284?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1284?src=pr&el=footer). Last update [5f22326...0db4316](https://codecov.io/gh/apache/apisix-dashboard/pull/1284?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


----------------------------------------------------------------
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.

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



[GitHub] [apisix-dashboard] ThanoshanMV commented on a change in pull request #1284: fix: Client-side URL redirect

Posted by GitBox <gi...@apache.org>.
ThanoshanMV commented on a change in pull request #1284:
URL: https://github.com/apache/apisix-dashboard/pull/1284#discussion_r557378840



##########
File path: web/src/pages/Setting/Setting.tsx
##########
@@ -75,6 +75,8 @@ const Setting: React.FC = () => {
               }
               history.push(path);
             }
+          } else {
+          history.push('/');

Review comment:
       
   ![yarn-command](https://user-images.githubusercontent.com/48581379/104594063-a21fac80-5696-11eb-893c-5cedbae902c8.png)
   @juzhiyuan, I could not able to execute the command inside the `web` directory




----------------------------------------------------------------
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.

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



[GitHub] [apisix-dashboard] LiteSun commented on pull request #1284: fix: Client-side URL redirect

Posted by GitBox <gi...@apache.org>.
LiteSun commented on pull request #1284:
URL: https://github.com/apache/apisix-dashboard/pull/1284#issuecomment-759436265


   > another unstable fe e2e test case: https://github.com/apache/apisix-dashboard/pull/1284/checks?check_run_id=1693627365
   > may be we need a issue to trace all the unstable test cases.
   > 
   > cc @LiteSun
   
   This test case error is not caused by an unstable e2e test. I ran the test locally and found that the error was caused by the page not automatically jumping after a successful configuration.


----------------------------------------------------------------
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.

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



[GitHub] [apisix-dashboard] membphis commented on pull request #1284: fix: Client-side URL redirect

Posted by GitBox <gi...@apache.org>.
membphis commented on pull request #1284:
URL: https://github.com/apache/apisix-dashboard/pull/1284#issuecomment-759281650


   @ThanoshanMV CI failed


----------------------------------------------------------------
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.

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



[GitHub] [apisix-dashboard] liuxiran commented on a change in pull request #1284: fix: Client-side URL redirect

Posted by GitBox <gi...@apache.org>.
liuxiran commented on a change in pull request #1284:
URL: https://github.com/apache/apisix-dashboard/pull/1284#discussion_r556279018



##########
File path: web/src/pages/Setting/Setting.tsx
##########
@@ -62,7 +62,15 @@ const Setting: React.FC = () => {
         });
         setTimeout(() => {
           const redirect = getUrlQuery('redirect');
-          window.location.href = redirect ? decodeURIComponent(redirect) : '/';
+          const currentHost = window.location.host;
+          if (redirect) {
+            const redirectUrl = decodeURIComponent(redirect);
+            const redirectHost = redirectUrl.split('/')[2];
+            if (currentHost === redirectHost) {
+              window.location.href = redirectUrl;

Review comment:
       > To guard against untrusted URL redirection, it is advisable to avoid putting user input directly into a redirect URL. Instead, maintain a list of authorized redirects on the server; then choose from that list based on the user input provided.
   
   After read the recommended note from codeql, it seems that all urls derived from user input are considered risky, so only limit the same host is not enough( the risky is still exit). 
   
   Since the redirectUrl could not come from server(the recommended way), we may try to use `history.push` instead of `window.location.href` to avoid this sec risky, which can also complete the page redirect action. 




----------------------------------------------------------------
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.

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



[GitHub] [apisix-dashboard] ThanoshanMV commented on a change in pull request #1284: fix: Client-side URL redirect

Posted by GitBox <gi...@apache.org>.
ThanoshanMV commented on a change in pull request #1284:
URL: https://github.com/apache/apisix-dashboard/pull/1284#discussion_r556637495



##########
File path: web/src/pages/Setting/Setting.tsx
##########
@@ -62,7 +62,20 @@ const Setting: React.FC = () => {
         });
         setTimeout(() => {
           const redirect = getUrlQuery('redirect');
-          window.location.href = redirect ? decodeURIComponent(redirect) : '/';
+          const currentHost = window.location.host;
+          if (redirect) {
+            const redirectUrl = decodeURIComponent(redirect);
+            const pathArray = redirectUrl.split('/');
+            const redirectHost = pathArray[2];
+            if (currentHost === redirectHost) {
+              let path = '';
+              for (let i = 3; i < pathArray.length; i++) {
+                path += '/';
+                path += pathArray[i];
+              }
+              history.push(path);
+            }
+          }

Review comment:
       Okay, I'll commit suggestion




----------------------------------------------------------------
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.

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



[GitHub] [apisix-dashboard] liuxiran edited a comment on pull request #1284: fix: Client-side URL redirect

Posted by GitBox <gi...@apache.org>.
liuxiran edited a comment on pull request #1284:
URL: https://github.com/apache/apisix-dashboard/pull/1284#issuecomment-759355740


   another unstable fe e2e test case: https://github.com/apache/apisix-dashboard/pull/1284/checks?check_run_id=1693627365
   may be we need a issue to trace all the unstable test cases.
   
   cc @LiteSun 


----------------------------------------------------------------
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.

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



[GitHub] [apisix-dashboard] juzhiyuan commented on pull request #1284: fix: Client-side URL redirect

Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on pull request #1284:
URL: https://github.com/apache/apisix-dashboard/pull/1284#issuecomment-759404548


   ![image](https://user-images.githubusercontent.com/2106987/104449891-45f75280-55da-11eb-82cc-f83da53f5249.png)
   
   Too curious, but @LiteSun has been working on this.


----------------------------------------------------------------
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.

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



[GitHub] [apisix-dashboard] liuxiran commented on a change in pull request #1284: fix: Client-side URL redirect

Posted by GitBox <gi...@apache.org>.
liuxiran commented on a change in pull request #1284:
URL: https://github.com/apache/apisix-dashboard/pull/1284#discussion_r556279018



##########
File path: web/src/pages/Setting/Setting.tsx
##########
@@ -62,7 +62,15 @@ const Setting: React.FC = () => {
         });
         setTimeout(() => {
           const redirect = getUrlQuery('redirect');
-          window.location.href = redirect ? decodeURIComponent(redirect) : '/';
+          const currentHost = window.location.host;
+          if (redirect) {
+            const redirectUrl = decodeURIComponent(redirect);
+            const redirectHost = redirectUrl.split('/')[2];
+            if (currentHost === redirectHost) {
+              window.location.href = redirectUrl;

Review comment:
       > To guard against untrusted URL redirection, it is advisable to avoid putting user input directly into a redirect URL. Instead, maintain a list of authorized redirects on the server; then choose from that list based on the user input provided.
   
   After read the recommended note from codeql, it seems that all urls derived from user input are considered risky, so only limit the same host is not enough(I seem the risky is still exit). 
   
   Since the redirectUrl could not come from server(the recommended way), we may try to use `history.push` instead of `window.location.href` to avoid this sec risky, which can also complete the page redirect action. 




----------------------------------------------------------------
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.

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



[GitHub] [apisix-dashboard] ThanoshanMV commented on a change in pull request #1284: fix: Client-side URL redirect

Posted by GitBox <gi...@apache.org>.
ThanoshanMV commented on a change in pull request #1284:
URL: https://github.com/apache/apisix-dashboard/pull/1284#discussion_r556637495



##########
File path: web/src/pages/Setting/Setting.tsx
##########
@@ -62,7 +62,20 @@ const Setting: React.FC = () => {
         });
         setTimeout(() => {
           const redirect = getUrlQuery('redirect');
-          window.location.href = redirect ? decodeURIComponent(redirect) : '/';
+          const currentHost = window.location.host;
+          if (redirect) {
+            const redirectUrl = decodeURIComponent(redirect);
+            const pathArray = redirectUrl.split('/');
+            const redirectHost = pathArray[2];
+            if (currentHost === redirectHost) {
+              let path = '';
+              for (let i = 3; i < pathArray.length; i++) {
+                path += '/';
+                path += pathArray[i];
+              }
+              history.push(path);
+            }
+          }

Review comment:
       Okay, I'll commit sugesstion




----------------------------------------------------------------
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.

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



[GitHub] [apisix-dashboard] liuxiran commented on a change in pull request #1284: fix: Client-side URL redirect

Posted by GitBox <gi...@apache.org>.
liuxiran commented on a change in pull request #1284:
URL: https://github.com/apache/apisix-dashboard/pull/1284#discussion_r556612568



##########
File path: web/src/pages/Setting/Setting.tsx
##########
@@ -62,7 +62,20 @@ const Setting: React.FC = () => {
         });
         setTimeout(() => {
           const redirect = getUrlQuery('redirect');
-          window.location.href = redirect ? decodeURIComponent(redirect) : '/';
+          const currentHost = window.location.host;
+          if (redirect) {
+            const redirectUrl = decodeURIComponent(redirect);
+            const pathArray = redirectUrl.split('/');
+            const redirectHost = pathArray[2];
+            if (currentHost === redirectHost) {
+              let path = '';
+              for (let i = 3; i < pathArray.length; i++) {
+                path += '/';
+                path += pathArray[i];
+              }
+              history.push(path);
+            }
+          }

Review comment:
       it still needs a case to cover when redirect is ''
   ```suggestion
             } else {
             history.push('/');
             }
   ```




----------------------------------------------------------------
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.

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



[GitHub] [apisix-dashboard] LiteSun commented on a change in pull request #1284: fix: Client-side URL redirect

Posted by GitBox <gi...@apache.org>.
LiteSun commented on a change in pull request #1284:
URL: https://github.com/apache/apisix-dashboard/pull/1284#discussion_r556988932



##########
File path: web/src/pages/Setting/Setting.tsx
##########
@@ -75,6 +75,8 @@ const Setting: React.FC = () => {
               }
               history.push(path);
             }
+          } else {
+          history.push('/');

Review comment:
       you can also click https://github.com/apache/apisix-dashboard/pull/1284/checks?check_run_id=1696195316 to find out what lint error it is.




----------------------------------------------------------------
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.

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



[GitHub] [apisix-dashboard] juzhiyuan commented on a change in pull request #1284: fix: Client-side URL redirect

Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on a change in pull request #1284:
URL: https://github.com/apache/apisix-dashboard/pull/1284#discussion_r556975801



##########
File path: web/src/pages/Setting/Setting.tsx
##########
@@ -75,6 +75,8 @@ const Setting: React.FC = () => {
               }
               history.push(path);
             }
+          } else {
+          history.push('/');

Review comment:
       you could run `yarn prettier --write .` under the `web` directory to format codes.




----------------------------------------------------------------
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.

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



[GitHub] [apisix-dashboard] liuxiran commented on pull request #1284: fix: Client-side URL redirect

Posted by GitBox <gi...@apache.org>.
liuxiran commented on pull request #1284:
URL: https://github.com/apache/apisix-dashboard/pull/1284#issuecomment-759535147


   > > another unstable fe e2e test case: https://github.com/apache/apisix-dashboard/pull/1284/checks?check_run_id=1693627365
   > > may be we need a issue to trace all the unstable test cases.
   > > cc @LiteSun
   > 
   > This test case error is not caused by an unstable e2e test. I ran the test locally and found that the error was caused by the page not automatically jumping after a successful configuration.
   
   I'm sorry for misjudgment, I found that there is a bug in the updated code, just wait for updating again.
   
   cc @LiteSun @juzhiyuan 


----------------------------------------------------------------
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.

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



[GitHub] [apisix-dashboard] juzhiyuan commented on a change in pull request #1284: fix: Client-side URL redirect

Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on a change in pull request #1284:
URL: https://github.com/apache/apisix-dashboard/pull/1284#discussion_r557380436



##########
File path: web/src/pages/Setting/Setting.tsx
##########
@@ -75,6 +75,8 @@ const Setting: React.FC = () => {
               }
               history.push(path);
             }
+          } else {
+          history.push('/');

Review comment:
       Try running yarn install then have a try? It seems that the prettier Module is missing :)




----------------------------------------------------------------
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.

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



[GitHub] [apisix-dashboard] liuxiran commented on a change in pull request #1284: fix: Client-side URL redirect

Posted by GitBox <gi...@apache.org>.
liuxiran commented on a change in pull request #1284:
URL: https://github.com/apache/apisix-dashboard/pull/1284#discussion_r556279018



##########
File path: web/src/pages/Setting/Setting.tsx
##########
@@ -62,7 +62,15 @@ const Setting: React.FC = () => {
         });
         setTimeout(() => {
           const redirect = getUrlQuery('redirect');
-          window.location.href = redirect ? decodeURIComponent(redirect) : '/';
+          const currentHost = window.location.host;
+          if (redirect) {
+            const redirectUrl = decodeURIComponent(redirect);
+            const redirectHost = redirectUrl.split('/')[2];
+            if (currentHost === redirectHost) {
+              window.location.href = redirectUrl;

Review comment:
       > To guard against untrusted URL redirection, it is advisable to avoid putting user input directly into a redirect URL. Instead, maintain a list of authorized redirects on the server; then choose from that list based on the user input provided.
   
   After read the recommended note from codeql, it seems that all urls derived from user input are considered risky, so only limit the same host is not enough( the risky is still exist). 
   
   Since the redirectUrl could not come from server(the recommended way), we may try to use `history.push` instead of `window.location.href` to avoid this sec risky, which can also complete the page redirect action. 




----------------------------------------------------------------
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.

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



[GitHub] [apisix-dashboard] juzhiyuan merged pull request #1284: fix: Client-side URL redirect

Posted by GitBox <gi...@apache.org>.
juzhiyuan merged pull request #1284:
URL: https://github.com/apache/apisix-dashboard/pull/1284


   


----------------------------------------------------------------
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.

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



[GitHub] [apisix-dashboard] codecov-io commented on pull request #1284: fix: Client-side URL redirect

Posted by GitBox <gi...@apache.org>.
codecov-io commented on pull request #1284:
URL: https://github.com/apache/apisix-dashboard/pull/1284#issuecomment-759199156


   # [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1284?src=pr&el=h1) Report
   > Merging [#1284](https://codecov.io/gh/apache/apisix-dashboard/pull/1284?src=pr&el=desc) (325879e) into [master](https://codecov.io/gh/apache/apisix-dashboard/commit/ecfef5b63247ca13cac8280201d423dd52b98036?el=desc) (ecfef5b) will **increase** coverage by `0.05%`.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-dashboard/pull/1284/graphs/tree.svg?width=650&height=150&src=pr&token=Q1HERXN96P)](https://codecov.io/gh/apache/apisix-dashboard/pull/1284?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master    #1284      +/-   ##
   ==========================================
   + Coverage   42.39%   42.44%   +0.05%     
   ==========================================
     Files          31       31              
     Lines        1932     1932              
   ==========================================
   + Hits          819      820       +1     
   + Misses       1002     1001       -1     
     Partials      111      111              
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/apisix-dashboard/pull/1284?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [api/internal/core/store/store.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1284/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvc3RvcmUvc3RvcmUuZ28=) | `80.00% <0.00%> (+0.62%)` | :arrow_up: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1284?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1284?src=pr&el=footer). Last update [ecfef5b...325879e](https://codecov.io/gh/apache/apisix-dashboard/pull/1284?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


----------------------------------------------------------------
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.

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



[GitHub] [apisix-dashboard] liuxiran commented on pull request #1284: fix: Client-side URL redirect

Posted by GitBox <gi...@apache.org>.
liuxiran commented on pull request #1284:
URL: https://github.com/apache/apisix-dashboard/pull/1284#issuecomment-759355740


   another unstable fe e2e teat case: https://github.com/apache/apisix-dashboard/pull/1284/checks?check_run_id=1693627365
   may be we need a issue to trace all the unstable test cases.
   
   cc @LiteSun 


----------------------------------------------------------------
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.

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



[GitHub] [apisix-dashboard] liuxiran commented on a change in pull request #1284: fix: Client-side URL redirect

Posted by GitBox <gi...@apache.org>.
liuxiran commented on a change in pull request #1284:
URL: https://github.com/apache/apisix-dashboard/pull/1284#discussion_r556413992



##########
File path: web/src/pages/Setting/Setting.tsx
##########
@@ -62,7 +62,15 @@ const Setting: React.FC = () => {
         });
         setTimeout(() => {
           const redirect = getUrlQuery('redirect');
-          window.location.href = redirect ? decodeURIComponent(redirect) : '/';
+          const currentHost = window.location.host;
+          if (redirect) {
+            const redirectUrl = decodeURIComponent(redirect);
+            const redirectHost = redirectUrl.split('/')[2];
+            if (currentHost === redirectHost) {
+              window.location.href = redirectUrl;

Review comment:
       > I studied the source code and understood that `history.push()` is done via importing history from umi. I referred the [umi documentation on `history.push()`](https://umijs.org/api#history).
   > 
   > So, in line 70, can we try to replace the code like below:
   > `history.push(redirectUrl);`
   
   you would better only pass the path in the `redirecrUrl` to the `history.push()`
   so you have to:
   1. extract the `path` form `redirecrUrl`
   2. replace the code in line 70 to `history.push(path);`
   
   just try it ^_^  @ThanoshanMV 
   




----------------------------------------------------------------
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.

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



[GitHub] [apisix-dashboard] juzhiyuan commented on pull request #1284: fix: Client-side URL redirect

Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on pull request #1284:
URL: https://github.com/apache/apisix-dashboard/pull/1284#issuecomment-759439466


   Please fix it ASAP.


----------------------------------------------------------------
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.

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