mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 15:12:02 +00:00
Previously, we would store authz providers globally and refresh them every now and then. However, creating the providers is fairly cheap (1.3ms in a local trace) so we should not keep them in memory and remember to not forget to start the watcher routine. This will help for multi-tenant Sourcegraph in that providers are now computed for the context in question, and not held globally. Keeping potentially 100k authz providers in memory will not scale. Test plan: Still works, local Jaeger traces are quite acceptable.
67 lines
1.6 KiB
Python
67 lines
1.6 KiB
Python
load("//dev:go_mockgen.bzl", "go_mockgen")
|
|
load("//dev:go_defs.bzl", "go_test")
|
|
load("@io_bazel_rules_go//go:def.bzl", "go_library")
|
|
|
|
go_library(
|
|
name = "authz",
|
|
srcs = [
|
|
"consts.go",
|
|
"header.go",
|
|
"iface.go",
|
|
"mocks_temp.go",
|
|
"perms.go",
|
|
"scopes.go",
|
|
"sub_repo_perms.go",
|
|
],
|
|
importpath = "github.com/sourcegraph/sourcegraph/internal/authz",
|
|
tags = [TAG_PLATFORM_SOURCE],
|
|
visibility = ["//:__subpackages__"],
|
|
deps = [
|
|
"//internal/actor",
|
|
"//internal/api",
|
|
"//internal/collections",
|
|
"//internal/dotcom",
|
|
"//internal/extsvc",
|
|
"//internal/types",
|
|
"//lib/errors",
|
|
"@com_github_prometheus_client_golang//prometheus",
|
|
"@com_github_prometheus_client_golang//prometheus/promauto",
|
|
"@io_opentelemetry_go_otel//attribute",
|
|
],
|
|
)
|
|
|
|
go_test(
|
|
name = "authz_test",
|
|
timeout = "short",
|
|
srcs = [
|
|
"header_test.go",
|
|
"iface_test.go",
|
|
"perms_test.go",
|
|
"sub_repo_perms_test.go",
|
|
],
|
|
embed = [":authz"],
|
|
tags = [TAG_PLATFORM_SOURCE],
|
|
deps = [
|
|
"//internal/actor",
|
|
"//internal/api",
|
|
"//internal/dotcom",
|
|
"//internal/fileutil",
|
|
"//lib/errors",
|
|
"@com_github_gobwas_glob//:glob",
|
|
"@com_github_google_go_cmp//cmp",
|
|
"@com_github_stretchr_testify//assert",
|
|
"@com_github_stretchr_testify//require",
|
|
],
|
|
)
|
|
|
|
go_mockgen(
|
|
name = "generate_mocks",
|
|
out = "mocks_temp.go",
|
|
manifests = [
|
|
"//:mockgen.yaml",
|
|
"//:mockgen.test.yaml",
|
|
"//:mockgen.temp.yaml",
|
|
],
|
|
deps = [":authz"],
|
|
)
|