OkHttp是否在重定向上发送授权和其他可能敏感的标头?

编程入门 行业动态 更新时间:2024-10-27 02:24:21
本文介绍了OkHttp是否在重定向上发送授权和其他可能敏感的标头?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在通过Apache NiFi过渡使用OkHttp.我试图确定如何在重定向时处理授权和其他敏感标头.关于重定向,NiFi的InvokeHTTP处理器与OkHttp进行的唯一交互是此处,它在其中读取处理器属性并将选项设置为OkHttpClientBuilder对象:

I'm using OkHttp transitively through Apache NiFi. I'm attempting to determine how Authorization and other sensitive headers are handled on redirect. The only interaction that NiFi's InvokeHTTP processor has with OkHttp in regards to redirects is here, where it reads a processor property and sets the option on the OkHttpClientBuilder object:

// Set whether to follow redirects okHttpClientBuilder.followRedirects(context.getProperty(PROP_FOLLOW_REDIRECTS).asBoolean());

快速 在OkHttp的源中进行搜索,我似乎无法识别重定向的位置,以验证是否从后续请求中删除了Authorization.会期望的.出于安全原因,cURL只是最近采用了该行为.

Quickly searching through the source of OkHttp, I cannot seem to identify where redirects are handled in order to verify that Authorization is stripped from subsequent requests, as I would expect. cURL just recently adopted that behavior for security reasons.

推荐答案

它发生在 RetryAndFollowUpInterceptor .

// When redirecting across hosts, drop all authentication headers. This // is potentially annoying to the application layer since they have no // way to retain them. if (!sameConnection(userResponse, url)) { requestBuilder.removeHeader("Authorization"); }

更多推荐

OkHttp是否在重定向上发送授权和其他可能敏感的标头?

本文发布于:2023-10-11 04:39:35,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1480709.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:重定向   敏感   OkHttp

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!