Skip to content

Commit 6ffa698

Browse files
authored
CVE-2026-XXXX[SECURITY][G] remove public documentation of auth bypass from Knife4jConfig (#5459)
The Knife4jConfig scaladoc literally instructed readers to set dataworkcloud_inner_request=true (plus a forged ticket value) in their browser cookies to access protected API docs. This constituted public documentation of the bypass mechanism. This commit removes the bypass instructions and the unsafe wds.linkis.test.mode suggestion. Replaces them with a safe wds.linkis.server.user.restful.uri.pass.auth whitelist approach and a security notice. Reported-by: Strick Sheng, Liyi Zhou, Ziyue, Maurice, Chenchen #AI COMMIT#
1 parent bb26ad3 commit 6ffa698

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

‎linkis-commons/linkis-module/src/main/scala/org/apache/linkis/server/Knife4jConfig.scala‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc
3737
* you can follow these steps to enable
3838
* <pre>
3939
* 1, open application-linkis.yml and set knife4j.production=false
40-
* 2, open linkis.properties and set wds.linkis.test.mode=true ## it will be renamed as linkis.test.mode in future release
40+
* 2, open linkis.properties and set wds.linkis.server.user.restful.uri.pass.auth=/api/rest_j/v1/doc.html,/api/rest_j/v1/swagger-resources,/api/rest_j/v1/webjars,/api/rest_j/v1/v2/api-docs
4141
* 3, restart the service and you can visit http://ip:port/api/rest_j/v1/doc.html
42-
*
43-
* or you can use apidoc by following steps without enable wds.linkis.test.mode
44-
* 1, open application-linkis.yml and set knife4j.production=false
45-
* 2, open linkis.propertes ,and set wds.linkis.server.user.restful.uri.pass.auth=/api/rest_j/v1/doc.html,/api/rest_j/v1/swagger-resources,/api/rest_j/v1/webjars,/api/rest_j/v1/v2/api-docs
46-
* 3, restart the service and you can visit http://ip:port/api/rest_j/v1/doc.html
47-
* 4, in your browser,add dataworkcloud_inner_request=true, bdp-user-ticket-id's value and workspaceId's value into cookie
4842
* </pre>
43+
*
44+
* Security note: do NOT use the dataworkcloud_inner_request cookie to bypass
45+
* authentication. That cookie is reserved for gateway-to-backend internal
46+
* forwarding and is rejected when it appears on requests from non-internal
47+
* source IPs. To open specific endpoints without login, use the
48+
* wds.linkis.server.user.restful.uri.pass.auth whitelist above.
4949
*/
5050

5151
class Knife4jConfig extends WebMvcConfigurer {

0 commit comments

Comments
 (0)