Skip to content

Commit

Permalink
Normalize path (#405)
Browse files Browse the repository at this point in the history
* normalize path

* only merge

* Revert "block some status endpoints (#403)"

This reverts commit 7558272.
  • Loading branch information
Ferdudas97 authored Dec 22, 2023
1 parent 07c4254 commit d6481de
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,6 @@ class AdminRouteProperties {
class StatusRouteProperties {
var enabled = false
var endpoints: MutableList<EndpointMatch> = mutableListOf()
var blockedStatusEndpoints: MutableList<EndpointMatch> = mutableListOf()
var createVirtualCluster = false
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ class HttpConnectionManagerFactory(
.setUseRemoteAddress(BoolValue.newBuilder().setValue(listenersConfig.useRemoteAddress).build())
.setDelayedCloseTimeout(Duration.newBuilder().setSeconds(0).build())
.setCommonHttpProtocolOptions(httpProtocolOptions)
.setNormalizePath(BoolValue.newBuilder().setValue(true).build())
.setMergeSlashes(true)
.setCodecType(HttpConnectionManager.CodecType.AUTO)
.setHttpProtocolOptions(ingressHttp1ProtocolOptions(group.serviceName))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,22 +275,13 @@ class RBACFilterFactory(

private fun createStatusRoutePolicy(statusRouteProperties: StatusRouteProperties): Map<String, Policy.Builder> {
return if (statusRouteProperties.enabled) {
val notRules = statusRouteProperties.blockedStatusEndpoints.map {
rBACFilterPermissions.createPathPermission(
path = it.path,
matchingType = it.matchingType
).build()
}
val permissions = statusRouteProperties.endpoints
.map {
val permission = rBACFilterPermissions.createPathPermission(
rBACFilterPermissions.createPathPermission(
path = it.path,
matchingType = it.matchingType
)
notRules.forEach { permission.setNotRule(it) }
permission.build()
).build()
}

val policy = Policy.newBuilder()
.addPrincipals(anyPrincipal)
.addPermissions(anyOf(permissions))
Expand Down Expand Up @@ -377,18 +368,15 @@ class RBACFilterFactory(
principal
)
)

OAuth.Policy.STRICT -> mergePrincipals(
listOf(
strictPolicyPrincipal,
principal
)
)

OAuth.Policy.ALLOW_MISSING_OR_FAILED -> {
principal
}

null -> {
principal
}
Expand Down

0 comments on commit d6481de

Please sign in to comment.