跨源读取阻止(CORB)是指在istio授权策略中设置notpaths配置时发生的情况。

huangapple go评论105阅读模式
英文:

Cross-Origin Read Blocking (CORB) occurs when setting notpaths config in istio authorization policy

问题

我正在进行Istio配置,以构建自动授权系统。

我使用oauth2-proxy进行外部授权,使用dex进行OICD。

我必须避免对某些子地址进行授权检查,所以我在授权策略中设置了notPaths选项。

但是每次我设置notPaths选项时,网页都会变成空白白页,而不是显示正确的页面。控制台显示CORB警告标志。

我不知道为什么会发生这种情况。

以下是我的授权策略、网关和虚拟服务配置。

  1. apiVersion: security.istio.io/v1beta1
  2. kind: AuthorizationPolicy
  3. metadata:
  4. name: oauth-policy
  5. namespace: istio-system
  6. spec:
  7. selector:
  8. matchLabels:
  9. istio: ingressgateway
  10. action: CUSTOM
  11. provider:
  12. name: "oauth2-proxy"
  13. rules:
  14. - to:
  15. - operation:
  16. hosts:
  17. - "my.domain.com"
  18. notPaths:
  19. - "/main*"
  20. ---
  21. apiVersion: networking.istio.io/v1alpha3
  22. kind: Gateway
  23. metadata:
  24. name: cm-gateway
  25. namespace: cm-temp
  26. spec:
  27. selector:
  28. istio: ingressgateway # use Istio default gateway implementation
  29. servers:
  30. - port:
  31. number: 80
  32. name: http
  33. protocol: HTTP
  34. hosts:
  35. - "my.domain.com"
  36. ---
  37. apiVersion: networking.istio.io/v1alpha3
  38. kind: VirtualService
  39. metadata:
  40. name: cm-vs
  41. namespace: cm-temp
  42. spec:
  43. hosts:
  44. - "my.domain.com"
  45. gateways:
  46. - cm-gateway
  47. http:
  48. - match:
  49. - uri:
  50. prefix: /api
  51. route:
  52. - destination:
  53. host: cm-be-svc
  54. port:
  55. number: 5000
  56. - match:
  57. - uri:
  58. prefix: /
  59. route:
  60. - destination:
  61. host: cm-fe-svc
  62. port:
  63. number: 80
英文:

i'm working on istio configuration to build automatic authorization system.

I use oauth2-proxy for external authorization and dex for OICD.

I have to avoid authorization check for certain sub adress, so I set notPaths option in authorization policy.

But every time I set the notPaths option, the web goes blank white page instead of display proper page. And console shows CORB warning sign.

I don't have any clue why this heppens.

here is my authorization policy and gateway, virtual service configuration.

  1. apiVersion: security.istio.io/v1beta1
  2. kind: AuthorizationPolicy
  3. metadata:
  4. name: oauth-policy
  5. namespace: istio-system
  6. spec:
  7. selector:
  8. matchLabels:
  9. istio: ingressgateway
  10. action: CUSTOM
  11. provider:
  12. name: "oauth2-proxy"
  13. rules:
  14. - to:
  15. - operation:
  16. hosts:
  17. - "my.domain.com"
  18. notPaths:
  19. - "/main*"
  20. ---
  21. apiVersion: networking.istio.io/v1alpha3
  22. kind: Gateway
  23. metadata:
  24. name: cm-gateway
  25. namespace: cm-temp
  26. spec:
  27. selector:
  28. istio: ingressgateway # use Istio default gateway implementation
  29. servers:
  30. - port:
  31. number: 80
  32. name: http
  33. protocol: HTTP
  34. hosts:
  35. - "my.domain.com"
  36. ---
  37. apiVersion: networking.istio.io/v1alpha3
  38. kind: VirtualService
  39. metadata:
  40. name: cm-vs
  41. namespace: cm-temp
  42. spec:
  43. hosts:
  44. - "my.domain.com"
  45. gateways:
  46. - cm-gateway
  47. http:
  48. - match:
  49. - uri:
  50. prefix: /api
  51. route:
  52. - destination:
  53. host: cm-be-svc
  54. port:
  55. number: 5000
  56. - match:
  57. - uri:
  58. prefix: /
  59. route:
  60. - destination:
  61. host: cm-fe-svc
  62. port:
  63. number: 80

答案1

得分: -1

这是授权策略配置问题。

我使用React来显示页面,由于我没有添加其子地址,所以首页的地址被阻止了。

我将子地址添加到了授权策略中,然后它就起作用了。

  1. apiVersion: security.istio.io/v1beta1
  2. kind: AuthorizationPolicy
  3. metadata:
  4. name: oauth-policy
  5. namespace: istio-system
  6. spec:
  7. selector:
  8. matchLabels:
  9. istio: ingressgateway
  10. action: CUSTOM
  11. provider:
  12. name: "oauth2-proxy"
  13. rules:
  14. - to:
  15. - operation:
  16. hosts:
  17. - "my.domain.com"
  18. notPaths:
  19. - "/main*"
  20. - "/index*"
  21. - "/favicon*"
英文:

It was the authorization policy config problem.

I use react to display page, and the address of index page was blocked cuz i didn't add the sub address of it.

i add the sub address to auth policy and it worked.

  1. apiVersion: security.istio.io/v1beta1
  2. kind: AuthorizationPolicy
  3. metadata:
  4. name: oauth-policy
  5. namespace: istio-system
  6. spec:
  7. selector:
  8. matchLabels:
  9. istio: ingressgateway
  10. action: CUSTOM
  11. provider:
  12. name: "oauth2-proxy"
  13. rules:
  14. - to:
  15. - operation:
  16. hosts:
  17. - "my.domain.com"
  18. notPaths:
  19. - "/main*"
  20. - "/index*"
  21. - "/favicon*"

huangapple
  • 本文由 发表于 2022年9月16日 10:57:54
  • 转载请务必保留本文链接:https://go.coder-hub.com/73739390.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定