Skip to content

Commit

Permalink
fix: NodeSearch权限校验失败 TencentBlueKing#2724
Browse files Browse the repository at this point in the history
  • Loading branch information
yaoxuwan committed Oct 31, 2024
1 parent b0680b3 commit 0f34371
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,17 @@ import com.tencent.bkrepo.auth.pojo.enums.PermissionAction
import com.tencent.bkrepo.common.api.constant.ensureSuffix
import com.tencent.bkrepo.common.artifact.exception.RepoNotFoundException
import com.tencent.bkrepo.common.artifact.path.PathUtils
import com.tencent.bkrepo.common.metadata.condition.SyncCondition
import com.tencent.bkrepo.common.metadata.permission.PermissionManager
import com.tencent.bkrepo.common.metadata.service.repo.RepositoryService
import com.tencent.bkrepo.common.metadata.util.NodeQueryHelper.listPermissionPaths
import com.tencent.bkrepo.common.metadata.condition.SyncCondition
import com.tencent.bkrepo.common.query.enums.OperationType
import com.tencent.bkrepo.common.query.interceptor.QueryContext
import com.tencent.bkrepo.common.query.interceptor.QueryRuleInterceptor
import com.tencent.bkrepo.common.query.model.Rule
import com.tencent.bkrepo.common.security.exception.PermissionException
import com.tencent.bkrepo.common.security.util.SecurityUtils
import com.tencent.bkrepo.common.service.util.HttpContextHolder
import com.tencent.bkrepo.repository.pojo.node.NodeInfo
import com.tencent.bkrepo.repository.pojo.repo.RepoListOption
import org.slf4j.LoggerFactory
Expand Down Expand Up @@ -217,7 +218,7 @@ class RepoNameRuleInterceptor(
repoName: String,
repoPublic: Boolean? = null
): Boolean {
if (SecurityUtils.isServiceRequest()) {
if (HttpContextHolder.getRequestOrNull() == null || SecurityUtils.isServiceRequest()) {
return true
}
return try {
Expand Down

0 comments on commit 0f34371

Please sign in to comment.