Compare commits

...
6 Commits
Author SHA1 Message Date
txix 011a1d7048 2026-03-24 17:42:31: merge [main:c523d2347d1bdc87bceae397a11ecfc8776ff8aa];
Create and publish a Docker image / build-and-push-image (push) Canceled after 0s
2026-03-24 17:42:31 +03:00
txix f3fb9cff75 2026-03-18 17:07:55: merge [main:1bd032e5aa9a3d83735ea3fb30aeab719d917b82];
Create and publish a Docker image / build-and-push-image (push) Canceled after 0s
2026-03-18 17:07:55 +03:00
txix c7bd042239 2026-03-10 10:38:58: merge [main:aae3c282252c73901b8e48b1412f48217b1a6195];
Create and publish a Docker image / build-and-push-image (push) Canceled after 0s
2026-03-10 10:38:58 +03:00
txix 202fa7035e 2026-01-27 15:11:45: merge [main:30d731ebfa46bcfb3fa1c39f4580293dc546acc0];
Create and publish a Docker image / build-and-push-image (push) Canceled after 0s
2026-01-27 15:11:45 +03:00
txix 602a2a1ac4 2026-01-27 13:25:45: merge [main:e5e723811e7a9dc57a6ff5d1c067c07c23a97210];
Create and publish a Docker image / build-and-push-image (push) Canceled after 0s
2026-01-27 13:25:45 +03:00
txix 6a3abf67a2 2026-01-23 13:09:31: merge [main:63c694e2a33c8c0b025f62619d2814f536915e49];
Create and publish a Docker image / build-and-push-image (push) Canceled after 0s
2026-01-23 13:09:31 +03:00
30 changed files with 405 additions and 222 deletions

No files matched your search

+2
View File
@@ -74,3 +74,5 @@ package.json
yarn.lock yarn.lock
conf/config_dev.yml conf/config_dev.yml
.DS_Store
+6
View File
@@ -19,6 +19,8 @@ linters:
- varnamelen # очень индивидуально (db) - varnamelen # очень индивидуально (db)
- wsl # расставление пробелов очень индивидуально - wsl # расставление пробелов очень индивидуально
- wsl_v5 # расставление пробелов очень индивидуально - wsl_v5 # расставление пробелов очень индивидуально
- godoclint # ругается на // nolint, не удобно
- prealloc # слишком аггресивный, в большинстве случаев не требуется
settings: settings:
cyclop: cyclop:
max-complexity: 15 # по умолчанию 10 мало max-complexity: 15 # по умолчанию 10 мало
@@ -55,6 +57,10 @@ linters:
- linters: - linters:
- wrapcheck - wrapcheck
path: transaction # транзакции прозрачны path: transaction # транзакции прозрачны
- linters:
- unqueryvet
- prealloc
path: ".*_test\\.go$"
- linters: - linters:
- wrapcheck - wrapcheck
path: middleware #отсутствует необходимость оборачивать ошибки path: middleware #отсутствует необходимость оборачивать ошибки
+1 -1
View File
@@ -1 +1 @@
5.6.2 5.9.2
+15
View File
@@ -1,3 +1,18 @@
### v5.9.2
* При проверке `logging.skipBodyLoggingEndpointPrefixes` игнорируется `/` в начале, путь для проверки берётся из `pathSchema`, если `pathSchema` пустая, берётся вызываемый `endpoint`
* В логе `log request` из значения в поле `endpoint` удаляется `/` в начале, путь берётся из `pathSchema`, если `pathSchema` пустая, берётся вызываемый `endpoint`
### v5.9.1
* Добавлен `warn` лог на неизвестный endpoint
### v5.9.0
* Теперь в зависимоси от `StatusCode` выводится соотвествующий уровень логирования: 400 -> warn, 500 -> error
* Исправлен порядок мидлварей, для корректного проброса `requestId`
### v5.8.1
* Обновлены зависимости
### v5.8.0
* Изменён resolve для endpoint'ов, теперь используется `lookup` у `github.com/julienschmidt/httprouter`
* Добавлен http метод в запрос авторизации (`system/secure/authorize`)
### v5.7.0
* Добавлено лог поле `applicationName` в логи `log request` и `bypassing unauthorized request because it has admin privilege`
### v5.6.2 ### v5.6.2
* Обновлено заполнение заголовка `x-application-name` для поддержки кириллических символов * Обновлено заполнение заголовка `x-application-name` для поддержки кириллических символов
### v5.6.1 ### v5.6.1
+1 -1
View File
@@ -74,7 +74,7 @@ func New(boot *bootstrap.Bootstrap) (*Assembly, error) {
boot: boot, boot: boot,
server: server, server: server,
logger: boot.App.Logger(), logger: boot.App.Logger(),
routes: routes.NewRoutes(), routes: routes.NewRoutes(boot.App.Logger()),
locations: localConfig.Locations, locations: localConfig.Locations,
grpcClientByModuleName: grpcClientByModuleName, grpcClientByModuleName: grpcClientByModuleName,
httpHostManagerByModuleName: httpHostManagerByModuleName, httpHostManagerByModuleName: httpHostManagerByModuleName,
+22 -8
View File
@@ -1,10 +1,12 @@
package assembly package assembly
import ( import (
"net/http"
"strings"
"time"
"github.com/txix-open/isp-kit/metrics" "github.com/txix-open/isp-kit/metrics"
"github.com/txix-open/isp-kit/metrics/http_metrics" "github.com/txix-open/isp-kit/metrics/http_metrics"
"net/http"
"time"
"isp-gate-service/conf" "isp-gate-service/conf"
"isp-gate-service/middleware" "isp-gate-service/middleware"
@@ -71,6 +73,11 @@ func (l Locator) Handler(config conf.Remote, locations []conf.Location) (http.Ha
dailyLimitService := service.NewDailyLimit(lockRepo, config.DailyLimits) dailyLimitService := service.NewDailyLimit(lockRepo, config.DailyLimits)
throttlingService := service.NewThrottling(lockRepo, config.Throttling) throttlingService := service.NewThrottling(lockRepo, config.Throttling)
skipBodyLoggingEndpointPrefixes := make([]string, 0, len(config.Logging.SkipBodyLoggingEndpointPrefixes))
for _, prefix := range config.Logging.SkipBodyLoggingEndpointPrefixes {
skipBodyLoggingEndpointPrefixes = append(skipBodyLoggingEndpointPrefixes, strings.TrimPrefix(prefix, "/"))
}
mux := mux2.NewRouter() mux := mux2.NewRouter()
for _, location := range locations { for _, location := range locations {
var proxyFunc middleware.Handler var proxyFunc middleware.Handler
@@ -106,26 +113,31 @@ func (l Locator) Handler(config conf.Remote, locations []conf.Location) (http.Ha
config.Logging.SkipBodyLoggingEndpointPrefixes, config.Logging.SkipBodyLoggingEndpointPrefixes,
config.Logging.EnableForceUnescapingUnicode, config.Logging.EnableForceUnescapingUnicode,
), ),
middleware.RequestId(),
middleware.ErrorHandler(l.logger), middleware.ErrorHandler(l.logger),
middleware.Authenticate(authentication), middleware.Authenticate(authentication),
middleware.AdminAuthenticate(adminService), middleware.AdminAuthenticate(adminService),
middleware.ClientRequestId(config.EnableClientRequestIdForwarding, forwardReqIdByAppId),
middleware.Authorize(authorization, l.logger), middleware.Authorize(authorization, l.logger),
middleware.AdminAuthorize(l.routes, adminService), middleware.AdminAuthorize(adminService),
middleware.Throttling(throttlingService), middleware.Throttling(throttlingService),
middleware.DailyLimit(dailyLimitService), middleware.DailyLimit(dailyLimitService),
middleware.RequestId(config.EnableClientRequestIdForwarding, forwardReqIdByAppId),
middleware.Metrics(metricsStorage), middleware.Metrics(metricsStorage),
) )
errorOnUnknownEndpoint := true
if location.SkipAuth { if location.SkipAuth {
errorOnUnknownEndpoint = false
handler = middleware.Chain( handler = middleware.Chain(
proxyFunc, proxyFunc,
middleware.Logger(l.logger, config.Logging.RequestLogEnable, middleware.Logger(l.logger, config.Logging.RequestLogEnable,
enableBodyLog, enableBodyLog,
config.Logging.SkipBodyLoggingEndpointPrefixes, skipBodyLoggingEndpointPrefixes,
config.Logging.EnableForceUnescapingUnicode, config.Logging.EnableForceUnescapingUnicode,
), ),
middleware.RequestId(),
middleware.ErrorHandler(l.logger), middleware.ErrorHandler(l.logger),
middleware.RequestId(config.EnableClientRequestIdForwarding, forwardReqIdByAppId), middleware.ClientRequestId(config.EnableClientRequestIdForwarding, forwardReqIdByAppId),
middleware.Metrics(metricsStorage), middleware.Metrics(metricsStorage),
) )
} }
@@ -133,8 +145,10 @@ func (l Locator) Handler(config conf.Remote, locations []conf.Location) (http.Ha
config.Http.MaxRequestBodySizeInMb*1024*1024, //nolint:mnd config.Http.MaxRequestBodySizeInMb*1024*1024, //nolint:mnd
handler, handler,
middleware.EntryPointConfig{ middleware.EntryPointConfig{
WithPrefix: location.WithPrefix, WithPrefix: location.WithPrefix,
PathPrefix: location.PathPrefix, PathPrefix: location.PathPrefix,
ErrorOnUnknownEndpoint: errorOnUnknownEndpoint,
WithLendingSlash: location.Protocol != conf.GrpcProtocol,
}, },
l.routes, l.routes,
l.logger, l.logger,
+2 -2
View File
@@ -12,7 +12,7 @@ import (
func init() { func init() {
schema.CustomGenerators.Register("logLevel", func(field reflect.StructField, t *jsonschema.Schema) { schema.CustomGenerators.Register("logLevel", func(field reflect.StructField, t *jsonschema.Schema) {
t.Type = "string" t.Type = "string"
t.Enum = []interface{}{"debug", "info", "warn", "error", "fatal"} t.Enum = []any{"debug", "info", "warn", "error", "fatal"}
}) })
} }
@@ -40,7 +40,7 @@ type Logging struct {
LogLevel log.Level `schemaGen:"logLevel" schema:"Уровень логирования,логирование запросов осуществляется на уровне debug"` LogLevel log.Level `schemaGen:"logLevel" schema:"Уровень логирования,логирование запросов осуществляется на уровне debug"`
RequestLogEnable bool `schema:"Включить логирование запросов"` RequestLogEnable bool `schema:"Включить логирование запросов"`
BodyLogEnable bool `schema:"Включить логирование тел запросов и ответов,должно быть включено логирование запросов"` BodyLogEnable bool `schema:"Включить логирование тел запросов и ответов,должно быть включено логирование запросов"`
SkipBodyLoggingEndpointPrefixes []string `schema:"регулярные выражения для отключения логирования"` SkipBodyLoggingEndpointPrefixes []string `schema:"Выключить логирование тел запросов и ответов для путей имеющих префикс из списка,'/' в начале игнорируется"`
EnableForceUnescapingUnicode bool `schema:"Включить перевод тел запроса из unicode в utf-8, должно быть включено логирование тел запросов и ответов"` EnableForceUnescapingUnicode bool `schema:"Включить перевод тел запроса из unicode в utf-8, должно быть включено логирование тел запросов и ответов"`
} }
+23
View File
@@ -0,0 +1,23 @@
package domain
import "context"
type EndpointMeta struct {
Inner bool
RequiredAdminPermission string
// Объявляемый сервисом метод
PathSchema string
// Вызываемый метод
Endpoint string
}
type endpointMetaKey struct{}
func (m EndpointMeta) ToContext(ctx context.Context) context.Context {
return context.WithValue(ctx, endpointMetaKey{}, m)
}
func EndpointMetaFromContext(ctx context.Context) EndpointMeta {
meta, _ := ctx.Value(endpointMetaKey{}).(EndpointMeta)
return meta
}
+1
View File
@@ -12,6 +12,7 @@ type AuthenticateResponse struct {
type AuthorizeRequest struct { type AuthorizeRequest struct {
ApplicationId int ApplicationId int
HttpMethod string
Endpoint string Endpoint string
} }
+28 -28
View File
@@ -1,6 +1,6 @@
module isp-gate-service module isp-gate-service
go 1.25 go 1.26
require ( require (
github.com/google/uuid v1.6.0 github.com/google/uuid v1.6.0
@@ -10,18 +10,18 @@ require (
github.com/redis/go-redis/v9 v9.11.0 github.com/redis/go-redis/v9 v9.11.0
github.com/stretchr/testify v1.11.1 github.com/stretchr/testify v1.11.1
github.com/tomakado/websocketproxy v0.1.0 github.com/tomakado/websocketproxy v0.1.0
github.com/txix-open/isp-kit v1.64.4 github.com/txix-open/isp-kit v1.65.1
github.com/txix-open/jsonschema v1.3.0 github.com/txix-open/jsonschema v1.3.0
golang.org/x/net v0.47.0 golang.org/x/net v0.52.0
google.golang.org/genproto/googleapis/rpc v0.0.0-20250908214217-97024824d090 google.golang.org/genproto/googleapis/rpc v0.0.0-20260311181403-84a4fc48630c
google.golang.org/grpc v1.75.1 google.golang.org/grpc v1.79.2
) )
require ( require (
github.com/cenkalti/backoff/v5 v5.0.3 // indirect github.com/cenkalti/backoff/v5 v5.0.3 // indirect
github.com/txix-open/etp/v4 v4.0.1 // indirect github.com/txix-open/etp/v4 v4.0.1 // indirect
go.opentelemetry.io/auto/sdk v1.2.0 // indirect go.opentelemetry.io/auto/sdk v1.2.1 // indirect
go.yaml.in/yaml/v2 v2.4.3 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect
) )
require ( require (
@@ -32,17 +32,17 @@ require (
github.com/coder/websocket v1.8.14 // indirect github.com/coder/websocket v1.8.14 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/gabriel-vasile/mimetype v1.4.10 // indirect github.com/gabriel-vasile/mimetype v1.4.13 // indirect
github.com/getsentry/sentry-go v0.35.2 // indirect github.com/getsentry/sentry-go v0.43.0 // indirect
github.com/go-logr/logr v1.4.3 // indirect github.com/go-logr/logr v1.4.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.28.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect github.com/json-iterator/go v1.1.12 // indirect
github.com/julienschmidt/httprouter v1.3.0 // indirect github.com/julienschmidt/httprouter v1.3.0
github.com/leodido/go-urn v1.4.0 // indirect github.com/leodido/go-urn v1.4.0 // indirect
github.com/mailru/easyjson v0.9.0 // indirect github.com/mailru/easyjson v0.9.1 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect github.com/modern-go/reflect2 v1.0.2 // indirect
@@ -50,8 +50,8 @@ require (
github.com/pmezard/go-difflib v1.0.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_golang v1.23.2 // indirect
github.com/prometheus/client_model v0.6.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect
github.com/prometheus/common v0.66.1 // indirect github.com/prometheus/common v0.67.5 // indirect
github.com/prometheus/procfs v0.17.0 // indirect github.com/prometheus/procfs v0.20.1 // indirect
github.com/txix-open/bellows v1.2.0 // indirect github.com/txix-open/bellows v1.2.0 // indirect
github.com/txix-open/etp/v3 v3.2.0 github.com/txix-open/etp/v3 v3.2.0
github.com/txix-open/validator/v10 v10.0.0-20250506161033-f8ce404fffdb // indirect github.com/txix-open/validator/v10 v10.0.0-20250506161033-f8ce404fffdb // indirect
@@ -59,21 +59,21 @@ require (
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/xeipuuv/gojsonschema v1.2.0 // indirect github.com/xeipuuv/gojsonschema v1.2.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.63.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.67.0 // indirect
go.opentelemetry.io/otel v1.38.0 // indirect go.opentelemetry.io/otel v1.42.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.42.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.38.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.42.0 // indirect
go.opentelemetry.io/otel/metric v1.38.0 // indirect go.opentelemetry.io/otel/metric v1.42.0 // indirect
go.opentelemetry.io/otel/sdk v1.38.0 // indirect go.opentelemetry.io/otel/sdk v1.42.0 // indirect
go.opentelemetry.io/otel/trace v1.38.0 // indirect go.opentelemetry.io/otel/trace v1.42.0 // indirect
go.opentelemetry.io/proto/otlp v1.8.0 // indirect go.opentelemetry.io/proto/otlp v1.10.0 // indirect
go.uber.org/multierr v1.11.0 // indirect go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect go.uber.org/zap v1.27.1 // indirect
golang.org/x/crypto v0.45.0 // indirect golang.org/x/crypto v0.49.0 // indirect
golang.org/x/sys v0.38.0 // indirect golang.org/x/sys v0.42.0 // indirect
golang.org/x/text v0.31.0 // indirect golang.org/x/text v0.35.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20250908214217-97024824d090 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20260311181403-84a4fc48630c // indirect
google.golang.org/protobuf v1.36.9 // indirect google.golang.org/protobuf v1.36.11 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect
) )
+66 -68
View File
@@ -10,8 +10,6 @@ github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA=
github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0= github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0=
github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs= github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs=
github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0= github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0=
github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8=
github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
github.com/cenkalti/backoff/v5 v5.0.3 h1:ZN+IMa753KfX5hd8vVaMixjnqRZ3y8CuJKRKj1xcsSM= github.com/cenkalti/backoff/v5 v5.0.3 h1:ZN+IMa753KfX5hd8vVaMixjnqRZ3y8CuJKRKj1xcsSM=
github.com/cenkalti/backoff/v5 v5.0.3/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw= github.com/cenkalti/backoff/v5 v5.0.3/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw=
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
@@ -25,14 +23,14 @@ github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/r
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/gabriel-vasile/mimetype v1.4.10 h1:zyueNbySn/z8mJZHLt6IPw0KoZsiQNszIpU+bX4+ZK0= github.com/gabriel-vasile/mimetype v1.4.13 h1:46nXokslUBsAJE/wMsp5gtO500a4F3Nkz9Ufpk2AcUM=
github.com/gabriel-vasile/mimetype v1.4.10/go.mod h1:d+9Oxyo1wTzWdyVUPMmXFvp4F9tea18J8ufA774AB3s= github.com/gabriel-vasile/mimetype v1.4.13/go.mod h1:d+9Oxyo1wTzWdyVUPMmXFvp4F9tea18J8ufA774AB3s=
github.com/getsentry/sentry-go v0.35.2 h1:jKuujpRwa8FFRYMIwwZpu83Xh0voll9bmvyc6310WBM= github.com/getsentry/sentry-go v0.43.0 h1:XbXLpFicpo8HmBDaInk7dum18G9KSLcjZiyUKS+hLW4=
github.com/getsentry/sentry-go v0.35.2/go.mod h1:mdL49ixwT2yi57k5eh7mpnDyPybixPzlzEJFu0Z76QA= github.com/getsentry/sentry-go v0.43.0/go.mod h1:XDotiNZbgf5U8bPDUAfvcFmOnMQQceESxyKaObSssW0=
github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA=
github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og=
github.com/go-faker/faker/v4 v4.6.1 h1:xUyVpAjEtB04l6XFY0V/29oR332rOSPWV4lU8RwDt4k= github.com/go-faker/faker/v4 v4.7.0 h1:VboC02cXHl/NuQh5lM2W8b87yp4iFXIu59x4w0RZi4E=
github.com/go-faker/faker/v4 v4.6.1/go.mod h1:arSdxNCSt7mOhdk8tEolvHeIJ7eX4OX80wXjKKvkKBY= github.com/go-faker/faker/v4 v4.7.0/go.mod h1:u1dIRP5neLB6kTzgyVjdBOV5R1uP7BdxkcWk7tiKQXk=
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=
github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
@@ -44,8 +42,8 @@ github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/o
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
github.com/go-resty/resty/v2 v2.16.5 h1:hBKqmWrr7uRc3euHVqmh1HTHcKn99Smr7o5spptdhTM= github.com/go-resty/resty/v2 v2.17.2 h1:FQW5oHYcIlkCNrMD2lloGScxcHJ0gkjshV3qcQAyHQk=
github.com/go-resty/resty/v2 v2.16.5/go.mod h1:hkJtXbA2iKHzJheXYvQ8snQES5ZLGKMwQ07xAwp/fiA= github.com/go-resty/resty/v2 v2.17.2/go.mod h1:kCKZ3wWmwJaNc7S29BRtUhJwy7iqmn+2mLtQrOyQlVA=
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
@@ -57,14 +55,14 @@ github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY=
github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ=
github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 h1:8Tjv8EJ+pM1xP8mK6egEbD1OgnVTyacbefKhmbLhIhU= github.com/grpc-ecosystem/grpc-gateway/v2 v2.28.0 h1:HWRh5R2+9EifMyIHV7ZV+MIZqgz+PMpZ14Jynv3O2Zs=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2/go.mod h1:pkJQ2tZHJ0aFOVEEot6oZmaVEZcRme73eIFmhiVuRWs= github.com/grpc-ecosystem/grpc-gateway/v2 v2.28.0/go.mod h1:JfhWUomR1baixubs02l85lZYYOm7LV6om4ceouMv45c=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/julienschmidt/httprouter v1.3.0 h1:U0609e9tgbseu3rBINet9P48AI/D3oJs4dN7jwJOQ1U= github.com/julienschmidt/httprouter v1.3.0 h1:U0609e9tgbseu3rBINet9P48AI/D3oJs4dN7jwJOQ1U=
github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM=
github.com/klauspost/compress v1.18.1 h1:bcSGx7UbpBqMChDtsF28Lw6v/G94LPrrbMbdC3JH2co= github.com/klauspost/compress v1.18.4 h1:RPhnKRAQ4Fh8zU2FY/6ZFDwTVTxgJ/EMydqSTzE9a2c=
github.com/klauspost/compress v1.18.1/go.mod h1:ZQFFVG+MdnR0P+l6wpXgIL4NTtwiKIdBnrBd8Nrxr+0= github.com/klauspost/compress v1.18.4/go.mod h1:R0h/fSBs8DE4ENlcrlib3PsXS61voFxhIs2DeRhCvJ4=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
@@ -73,8 +71,8 @@ github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
github.com/mailru/easyjson v0.9.0 h1:PrnmzHw7262yW8sTBwxi1PdJA3Iw/EKBa8psRf7d9a4= github.com/mailru/easyjson v0.9.1 h1:LbtsOm5WAswyWbvTEOqhypdPeZzHavpZx96/n553mR8=
github.com/mailru/easyjson v0.9.0/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU= github.com/mailru/easyjson v0.9.1/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU=
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
@@ -94,10 +92,10 @@ github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h
github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg= github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg=
github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk=
github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE= github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE=
github.com/prometheus/common v0.66.1 h1:h5E0h5/Y8niHc5DlaLlWLArTQI7tMrsfQjHV+d9ZoGs= github.com/prometheus/common v0.67.5 h1:pIgK94WWlQt1WLwAC5j2ynLaBRDiinoAb86HZHTUGI4=
github.com/prometheus/common v0.66.1/go.mod h1:gcaUsgf3KfRSwHY4dIMXLPV0K/Wg1oZ8+SbZk/HH/dA= github.com/prometheus/common v0.67.5/go.mod h1:SjE/0MzDEEAyrdr5Gqc6G+sXI67maCxzaT3A2+HqjUw=
github.com/prometheus/procfs v0.17.0 h1:FuLQ+05u4ZI+SS/w9+BWEM2TXiHKsUQ9TADiRH7DuK0= github.com/prometheus/procfs v0.20.1 h1:XwbrGOIplXW/AU3YhIhLODXMJYyC1isLFfYCsTEycfc=
github.com/prometheus/procfs v0.17.0/go.mod h1:oPQLaDAMRbA+u8H5Pbfq+dl3VDAvHxMUOVhe0wYB2zw= github.com/prometheus/procfs v0.20.1/go.mod h1:o9EMBZGRyvDrSPH1RqdxhojkuXstoe4UlK79eF5TGGo=
github.com/rabbitmq/amqp091-go v1.10.0 h1:STpn5XsHlHGcecLmMFCtg7mqq0RnD+zFr4uzukfVhBw= github.com/rabbitmq/amqp091-go v1.10.0 h1:STpn5XsHlHGcecLmMFCtg7mqq0RnD+zFr4uzukfVhBw=
github.com/rabbitmq/amqp091-go v1.10.0/go.mod h1:Hy4jKW5kQART1u+JkDTF9YYOQUHXqMuhrgxOEeS7G4o= github.com/rabbitmq/amqp091-go v1.10.0/go.mod h1:Hy4jKW5kQART1u+JkDTF9YYOQUHXqMuhrgxOEeS7G4o=
github.com/redis/go-redis/v9 v9.11.0 h1:E3S08Gl/nJNn5vkxd2i78wZxWAPNZgUNTp8WIJUAiIs= github.com/redis/go-redis/v9 v9.11.0 h1:E3S08Gl/nJNn5vkxd2i78wZxWAPNZgUNTp8WIJUAiIs=
@@ -123,10 +121,10 @@ github.com/txix-open/etp/v3 v3.2.0 h1:EgTchT8VtCYV1iEo/y4jII3/NybrXiQDE0y6pmS350
github.com/txix-open/etp/v3 v3.2.0/go.mod h1:lgen0TJmiturgBhvlxH1/PQ7iLL/OebKbxPAQYkuKI0= github.com/txix-open/etp/v3 v3.2.0/go.mod h1:lgen0TJmiturgBhvlxH1/PQ7iLL/OebKbxPAQYkuKI0=
github.com/txix-open/etp/v4 v4.0.1 h1:5VSYgGsvnMz0tvUHsjVWFETI0qWBTCF1O3ARCHaCIgA= github.com/txix-open/etp/v4 v4.0.1 h1:5VSYgGsvnMz0tvUHsjVWFETI0qWBTCF1O3ARCHaCIgA=
github.com/txix-open/etp/v4 v4.0.1/go.mod h1:FIu7TUDdwcgmtmF6tFTV1bGA2fRY/iVaPQdsGzvqYc8= github.com/txix-open/etp/v4 v4.0.1/go.mod h1:FIu7TUDdwcgmtmF6tFTV1bGA2fRY/iVaPQdsGzvqYc8=
github.com/txix-open/grmq v1.9.0 h1:ArDbJJcFX9zXKEcPf49rp9nYiRyGMJxGKJAxdbSsfaM= github.com/txix-open/grmq v1.10.0 h1:1bXuF+7TxtUvoh+Wn6SOCYpVACFbWDuDmz/+tKwW9Ms=
github.com/txix-open/grmq v1.9.0/go.mod h1:EyFOP17KrwEFOUjR+PH8iH3LCtiN9TSQ8t0ysyk62po= github.com/txix-open/grmq v1.10.0/go.mod h1:EyFOP17KrwEFOUjR+PH8iH3LCtiN9TSQ8t0ysyk62po=
github.com/txix-open/isp-kit v1.64.4 h1:Z8YuaAhfJnvTdHAZB03GY5Kgnz7RyxWh1i3mALmj7A8= github.com/txix-open/isp-kit v1.65.1 h1:KehXIJdPZMnewDd5XQxk87yNAtNhvJXApaLFvbUau5U=
github.com/txix-open/isp-kit v1.64.4/go.mod h1:GvBsX5p2U3/ugK6PuWANYzSy/4YgawROm3eAKb35G6o= github.com/txix-open/isp-kit v1.65.1/go.mod h1:F4B/+ErbNVaWzIIGasXM5DtcDKtjl6u2OESO02RyzCI=
github.com/txix-open/jsonschema v1.3.0 h1:XGuOTg22G7PdqfKypjajM20/i5FyGfFYsJKmheebKi4= github.com/txix-open/jsonschema v1.3.0 h1:XGuOTg22G7PdqfKypjajM20/i5FyGfFYsJKmheebKi4=
github.com/txix-open/jsonschema v1.3.0/go.mod h1:l8YDZ1nvJrw6uxWowSVOxCV/ebiMJyapffW87ZEqH00= github.com/txix-open/jsonschema v1.3.0/go.mod h1:l8YDZ1nvJrw6uxWowSVOxCV/ebiMJyapffW87ZEqH00=
github.com/txix-open/validator/v10 v10.0.0-20250506161033-f8ce404fffdb h1:UJgT4u/QMv5QHKOQeJ7igShHa36c2/vIRqJiRLdDlf0= github.com/txix-open/validator/v10 v10.0.0-20250506161033-f8ce404fffdb h1:UJgT4u/QMv5QHKOQeJ7igShHa36c2/vIRqJiRLdDlf0=
@@ -140,56 +138,56 @@ github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHo
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ=
github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74= github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74=
github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y=
go.opentelemetry.io/auto/sdk v1.2.0 h1:YpRtUFjvhSymycLS2T81lT6IGhcUP+LUPtv0iv1N8bM= go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64=
go.opentelemetry.io/auto/sdk v1.2.0/go.mod h1:1deq2zL7rwjwC8mR7XgY2N+tlIl6pjmEUoLDENMEzwk= go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y=
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.63.0 h1:2pn7OzMewmYRiNtv1doZnLo3gONcnMHlFnmOR8Vgt+8= go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.67.0 h1:c9r/G1CSw4dPI1jaNNG9RnQP+q4SvZnHciDQJVIvchU=
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.63.0/go.mod h1:rjbQTDEPQymPE0YnRQp9/NuPwwtL0sesz/fnqRW/v84= go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.67.0/go.mod h1:gO9smoZe9KnZcJCqcB0lMmQ4Z5VEifYmjMTpnwtTSuQ=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.63.0 h1:RbKq8BG0FI8OiXhBfcRtqqHcZcka+gU3cskNuf05R18= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.67.0 h1:OyrsyzuttWTSur2qN/Lm0m2a8yqyIjUVBZcxFPuXq2o=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.63.0/go.mod h1:h06DGIukJOevXaj/xrNjhi/2098RZzcLTbc0jDAUbsg= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.67.0/go.mod h1:C2NGBr+kAB4bk3xtMXfZ94gqFDtg/GkI7e9zqGh5Beg=
go.opentelemetry.io/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8= go.opentelemetry.io/otel v1.42.0 h1:lSQGzTgVR3+sgJDAU/7/ZMjN9Z+vUip7leaqBKy4sho=
go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM= go.opentelemetry.io/otel v1.42.0/go.mod h1:lJNsdRMxCUIWuMlVJWzecSMuNjE7dOYyWlqOXWkdqCc=
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0 h1:GqRJVj7UmLjCVyVJ3ZFLdPRmhDUp2zFmQe3RHIOsw24= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.42.0 h1:THuZiwpQZuHPul65w4WcwEnkX2QIuMT+UFoOrygtoJw=
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0/go.mod h1:ri3aaHSmCTVYu2AWv44YMauwAQc0aqI9gHKIcSbI1pU= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.42.0/go.mod h1:J2pvYM5NGHofZ2/Ru6zw/TNWnEQp5crgyDeSrYpXkAw=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.38.0 h1:aTL7F04bJHUlztTsNGJ2l+6he8c+y/b//eR0jjjemT4= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.42.0 h1:uLXP+3mghfMf7XmV4PkGfFhFKuNWoCvvx5wP/wOXo0o=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.38.0/go.mod h1:kldtb7jDTeol0l3ewcmd8SDvx3EmIE7lyvqbasU3QC4= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.42.0/go.mod h1:v0Tj04armyT59mnURNUJf7RCKcKzq+lgJs6QSjHjaTc=
go.opentelemetry.io/otel/metric v1.38.0 h1:Kl6lzIYGAh5M159u9NgiRkmoMKjvbsKtYRwgfrA6WpA= go.opentelemetry.io/otel/metric v1.42.0 h1:2jXG+3oZLNXEPfNmnpxKDeZsFI5o4J+nz6xUlaFdF/4=
go.opentelemetry.io/otel/metric v1.38.0/go.mod h1:kB5n/QoRM8YwmUahxvI3bO34eVtQf2i4utNVLr9gEmI= go.opentelemetry.io/otel/metric v1.42.0/go.mod h1:RlUN/7vTU7Ao/diDkEpQpnz3/92J9ko05BIwxYa2SSI=
go.opentelemetry.io/otel/sdk v1.38.0 h1:l48sr5YbNf2hpCUj/FoGhW9yDkl+Ma+LrVl8qaM5b+E= go.opentelemetry.io/otel/sdk v1.42.0 h1:LyC8+jqk6UJwdrI/8VydAq/hvkFKNHZVIWuslJXYsDo=
go.opentelemetry.io/otel/sdk v1.38.0/go.mod h1:ghmNdGlVemJI3+ZB5iDEuk4bWA3GkTpW+DOoZMYBVVg= go.opentelemetry.io/otel/sdk v1.42.0/go.mod h1:rGHCAxd9DAph0joO4W6OPwxjNTYWghRWmkHuGbayMts=
go.opentelemetry.io/otel/sdk/metric v1.38.0 h1:aSH66iL0aZqo//xXzQLYozmWrXxyFkBJ6qT5wthqPoM= go.opentelemetry.io/otel/sdk/metric v1.42.0 h1:D/1QR46Clz6ajyZ3G8SgNlTJKBdGp84q9RKCAZ3YGuA=
go.opentelemetry.io/otel/sdk/metric v1.38.0/go.mod h1:dg9PBnW9XdQ1Hd6ZnRz689CbtrUp0wMMs9iPcgT9EZA= go.opentelemetry.io/otel/sdk/metric v1.42.0/go.mod h1:Ua6AAlDKdZ7tdvaQKfSmnFTdHx37+J4ba8MwVCYM5hc=
go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE= go.opentelemetry.io/otel/trace v1.42.0 h1:OUCgIPt+mzOnaUTpOQcBiM/PLQ/Op7oq6g4LenLmOYY=
go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs= go.opentelemetry.io/otel/trace v1.42.0/go.mod h1:f3K9S+IFqnumBkKhRJMeaZeNk9epyhnCmQh/EysQCdc=
go.opentelemetry.io/proto/otlp v1.8.0 h1:fRAZQDcAFHySxpJ1TwlA1cJ4tvcrw7nXl9xWWC8N5CE= go.opentelemetry.io/proto/otlp v1.10.0 h1:IQRWgT5srOCYfiWnpqUYz9CVmbO8bFmKcwYxpuCSL2g=
go.opentelemetry.io/proto/otlp v1.8.0/go.mod h1:tIeYOeNBU4cvmPqpaji1P+KbB4Oloai8wN4rWzRrFF0= go.opentelemetry.io/proto/otlp v1.10.0/go.mod h1:/CV4QoCR/S9yaPj8utp3lvQPoqMtxXdzn7ozvvozVqk=
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= go.uber.org/zap v1.27.1 h1:08RqriUEv8+ArZRYSTXy1LeBScaMpVSTBhCeaZYfMYc=
go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= go.uber.org/zap v1.27.1/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
go.yaml.in/yaml/v2 v2.4.3 h1:6gvOSjQoTB3vt1l+CU+tSyi/HOjfOjRLJ4YwYZGwRO0= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ=
go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ=
golang.org/x/crypto v0.45.0 h1:jMBrvKuj23MTlT0bQEOBcAE0mjg8mK9RXFhRH6nyF3Q= golang.org/x/crypto v0.49.0 h1:+Ng2ULVvLHnJ/ZFEq4KdcDd/cfjrrjjNSXNzxg0Y4U4=
golang.org/x/crypto v0.45.0/go.mod h1:XTGrrkGJve7CYK7J8PEww4aY7gM3qMCElcJQ8n8JdX4= golang.org/x/crypto v0.49.0/go.mod h1:ErX4dUh2UM+CFYiXZRTcMpEcN8b/1gxEuv3nODoYtCA=
golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY= golang.org/x/net v0.52.0 h1:He/TN1l0e4mmR3QqHMT2Xab3Aj3L9qjbhRm78/6jrW0=
golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU= golang.org/x/net v0.52.0/go.mod h1:R1MAz7uMZxVMualyPXb+VaqGSa3LIaUqk0eEt3w36Sw=
golang.org/x/sync v0.18.0 h1:kr88TuHDroi+UVf+0hZnirlk8o8T+4MrK6mr60WkH/I= golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4=
golang.org/x/sync v0.18.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=
golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc= golang.org/x/sys v0.42.0 h1:omrd2nAlyT5ESRdCLYdm3+fMfNFE/+Rf4bDIQImRJeo=
golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= golang.org/x/sys v0.42.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
golang.org/x/text v0.31.0 h1:aC8ghyu4JhP8VojJ2lEHBnochRno1sgL6nEi9WGFGMM= golang.org/x/text v0.35.0 h1:JOVx6vVDFokkpaq1AEptVzLTpDe9KGpj5tR4/X+ybL8=
golang.org/x/text v0.31.0/go.mod h1:tKRAlv61yKIjGGHX/4tP1LTbc13YSec1pxVEWXzfoeM= golang.org/x/text v0.35.0/go.mod h1:khi/HExzZJ2pGnjenulevKNX1W67CUy0AsXcNubPGCA=
gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk= gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk=
gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E= gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E=
google.golang.org/genproto/googleapis/api v0.0.0-20250908214217-97024824d090 h1:d8Nakh1G+ur7+P3GcMjpRDEkoLUcLW2iU92XVqR+XMQ= google.golang.org/genproto/googleapis/api v0.0.0-20260311181403-84a4fc48630c h1:OyQPd6I3pN/9gDxz6L13kYGJgqkpdrAohJRBeXyxlgI=
google.golang.org/genproto/googleapis/api v0.0.0-20250908214217-97024824d090/go.mod h1:U8EXRNSd8sUYyDfs/It7KVWodQr+Hf9xtxyxWudSwEw= google.golang.org/genproto/googleapis/api v0.0.0-20260311181403-84a4fc48630c/go.mod h1:X2gu9Qwng7Nn009s/r3RUxqkzQNqOrAy79bluY7ojIg=
google.golang.org/genproto/googleapis/rpc v0.0.0-20250908214217-97024824d090 h1:/OQuEa4YWtDt7uQWHd3q3sUMb+QOLQUg1xa8CEsRv5w= google.golang.org/genproto/googleapis/rpc v0.0.0-20260311181403-84a4fc48630c h1:xgCzyF2LFIO/0X2UAoVRiXKU5Xg6VjToG4i2/ecSswk=
google.golang.org/genproto/googleapis/rpc v0.0.0-20250908214217-97024824d090/go.mod h1:GmFNa4BdJZ2a8G+wCe9Bg3wwThLrJun751XstdJt5Og= google.golang.org/genproto/googleapis/rpc v0.0.0-20260311181403-84a4fc48630c/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8=
google.golang.org/grpc v1.75.1 h1:/ODCNEuf9VghjgO3rqLcfg8fiOP0nSluljWFlDxELLI= google.golang.org/grpc v1.79.2 h1:fRMD94s2tITpyJGtBBn7MkMseNpOZU8ZxgC3MMBaXRU=
google.golang.org/grpc v1.75.1/go.mod h1:JtPAzKiq4v1xcAB2hydNlWI2RnF85XXcV0mhKXr2ecQ= google.golang.org/grpc v1.79.2/go.mod h1:KmT0Kjez+0dde/v2j9vzwoAScgEPx/Bw1CYChhHLrHQ=
google.golang.org/protobuf v1.36.9 h1:w2gp2mA27hUeUzj9Ex9FBjsBm40zfaDtEWow293U7Iw= google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE=
google.golang.org/protobuf v1.36.9/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU= google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
+1 -1
View File
@@ -1,4 +1,4 @@
// nolint:mnd // nolint:mnd,gosec
package helpers package helpers
import ( import (
+1 -1
View File
@@ -28,7 +28,7 @@ func (e *HttpError) Error() string {
func (e *HttpError) WriteError(w http.ResponseWriter) error { func (e *HttpError) WriteError(w http.ResponseWriter) error {
w.Header().Set("Content-Type", "application/json") w.Header().Set("Content-Type", "application/json")
w.WriteHeader(e.statusCode) w.WriteHeader(e.statusCode)
data := map[string]interface{}{ data := map[string]any{
"errorCode": http.StatusText(e.statusCode), "errorCode": http.StatusText(e.statusCode),
"errorMessage": e.userMessage, "errorMessage": e.userMessage,
"details": e.details, "details": e.details,
+5 -3
View File
@@ -1,10 +1,12 @@
package main package main
import ( import (
"github.com/txix-open/isp-kit/bootstrap"
"github.com/txix-open/isp-kit/shutdown"
"isp-gate-service/assembly" "isp-gate-service/assembly"
"isp-gate-service/conf" "isp-gate-service/conf"
"github.com/txix-open/isp-kit/bootstrap"
"github.com/txix-open/isp-kit/cluster"
"github.com/txix-open/isp-kit/shutdown"
) )
var ( var (
@@ -12,7 +14,7 @@ var (
) )
func main() { func main() {
boot := bootstrap.New(version, conf.Remote{}, nil) boot := bootstrap.New(version, conf.Remote{}, nil, cluster.HttpTransport)
app := boot.App app := boot.App
logger := app.Logger() logger := app.Logger()
+9 -11
View File
@@ -9,19 +9,16 @@ import (
"isp-gate-service/request" "isp-gate-service/request"
) )
type AdminMethodStore interface {
IsInnerEndpoint(endpoint string) bool
RequiredAdminPermission(endpoint string) (string, bool)
}
type AdminAuthorizer interface { type AdminAuthorizer interface {
AdminAuthorize(ctx context.Context, adminId int, permission string) (bool, error) AdminAuthorize(ctx context.Context, adminId int, permission string) (bool, error)
} }
func AdminAuthorize(store AdminMethodStore, authorizer AdminAuthorizer) Middleware { func AdminAuthorize(authorizer AdminAuthorizer) Middleware {
return func(next Handler) Handler { return func(next Handler) Handler {
return HandlerFunc(func(ctx *request.Context) error { return HandlerFunc(func(ctx *request.Context) error {
isInner := store.IsInnerEndpoint(ctx.Endpoint()) endpointMeta := ctx.EndpointMeta()
isInner := endpointMeta.Inner
if !isInner { if !isInner {
return next.Handle(ctx) return next.Handle(ctx)
} }
@@ -30,12 +27,13 @@ func AdminAuthorize(store AdminMethodStore, authorizer AdminAuthorizer) Middlewa
return httperrors.New( return httperrors.New(
http.StatusForbidden, http.StatusForbidden,
"admin authentication required", "admin authentication required",
errors.Errorf("admin authorization: admin authentication required for '%s'", ctx.Endpoint()), errors.Errorf("admin authorization: admin authentication required for '%s'",
endpointMeta.Endpoint),
) )
} }
requiredPerm, ok := store.RequiredAdminPermission(ctx.Endpoint()) requiredPerm := endpointMeta.RequiredAdminPermission
if !ok { if requiredPerm == "" {
return next.Handle(ctx) return next.Handle(ctx)
} }
@@ -49,7 +47,7 @@ func AdminAuthorize(store AdminMethodStore, authorizer AdminAuthorizer) Middlewa
"endpoint is not allowed", "endpoint is not allowed",
errors.Errorf( errors.Errorf(
"admin authorization: endpoint '%s' requires '%s' permission, but admin '%d' doesn't have it", "admin authorization: endpoint '%s' requires '%s' permission, but admin '%d' doesn't have it",
ctx.Endpoint(), requiredPerm, ctx.AdminId(), endpointMeta.Endpoint, requiredPerm, ctx.AdminId(),
), ),
) )
} }
+12 -3
View File
@@ -11,7 +11,7 @@ import (
) )
type Authorizer interface { type Authorizer interface {
Authorize(ctx context.Context, applicationId int, endpoint string) (bool, error) Authorize(ctx context.Context, applicationId int, httpMethod string, pathSchema string) (bool, error)
} }
func Authorize(authorizer Authorizer, logger log.Logger) Middleware { func Authorize(authorizer Authorizer, logger log.Logger) Middleware {
@@ -22,7 +22,13 @@ func Authorize(authorizer Authorizer, logger log.Logger) Middleware {
return errors.WithMessage(err, "authorize: get auth data") return errors.WithMessage(err, "authorize: get auth data")
} }
ok, err := authorizer.Authorize(ctx.Context(), authData.ApplicationId, ctx.Endpoint()) endpointMeta := ctx.EndpointMeta()
ok, err := authorizer.Authorize(
ctx.Context(),
authData.ApplicationId,
ctx.Request().Method,
endpointMeta.PathSchema,
)
if err != nil { if err != nil {
return errors.WithMessage(err, "authorize: authorize") return errors.WithMessage(err, "authorize: authorize")
} }
@@ -31,6 +37,7 @@ func Authorize(authorizer Authorizer, logger log.Logger) Middleware {
ctx.Context(), ctx.Context(),
"bypassing unauthorized request because it has admin privilege", "bypassing unauthorized request because it has admin privilege",
log.Int("applicationId", authData.ApplicationId), log.Int("applicationId", authData.ApplicationId),
log.String("applicationName", authData.AppName),
log.Int("adminId", ctx.AdminId()), log.Int("adminId", ctx.AdminId()),
) )
return next.Handle(ctx) return next.Handle(ctx)
@@ -39,7 +46,9 @@ func Authorize(authorizer Authorizer, logger log.Logger) Middleware {
return httperrors.New( return httperrors.New(
http.StatusForbidden, http.StatusForbidden,
"endpoint is not allowed", "endpoint is not allowed",
errors.Errorf("authorize: endpoint '%s' is not allowed for application '%d'", ctx.Endpoint(), authData.ApplicationId), errors.Errorf("authorize: endpoint '%s' with http method '%s' is not allowed for application '%d'",
endpointMeta.PathSchema, ctx.Request().Method, authData.ApplicationId,
),
) )
} }
+28 -7
View File
@@ -1,19 +1,24 @@
package middleware package middleware
import ( import (
"github.com/pkg/errors" "isp-gate-service/domain"
"github.com/txix-open/isp-kit/log"
"isp-gate-service/request" "isp-gate-service/request"
"net/http" "net/http"
"github.com/pkg/errors"
"github.com/txix-open/isp-kit/log"
) )
type EntryPointConfig struct { type EntryPointConfig struct {
PathPrefix string PathPrefix string
WithPrefix bool WithPrefix bool
ErrorOnUnknownEndpoint bool
WithLendingSlash bool
} }
type EndpointResolver interface { type EndpointResolver interface {
ResolveEndpoint(path string, cfg EntryPointConfig) string ResolveEndpoint(method string, path string, cfg EntryPointConfig) (*domain.EndpointMeta, error)
GetPaths(path string, cfg EntryPointConfig) (string, string)
} }
func Entrypoint( func Entrypoint(
@@ -26,10 +31,26 @@ func Entrypoint(
return http.HandlerFunc(func(writer http.ResponseWriter, req *http.Request) { return http.HandlerFunc(func(writer http.ResponseWriter, req *http.Request) {
req.Body = http.MaxBytesReader(writer, req.Body, maxReqBodySize) req.Body = http.MaxBytesReader(writer, req.Body, maxReqBodySize)
endpoint := entryPointResolver.ResolveEndpoint(req.URL.Path, cfg) endpoint, err := entryPointResolver.ResolveEndpoint(req.Method, req.URL.Path, cfg)
if err != nil {
lookupPath, endpoint := entryPointResolver.GetPaths(req.URL.Path, cfg)
logger.Warn(
req.Context(),
"call unknown method",
log.String("pathPrefix", cfg.PathPrefix),
log.String("httpMethod", req.Method),
log.String("originalPath", req.URL.Path),
log.String("lookupPath", lookupPath),
log.String("enpoint", endpoint),
)
http.Error(writer, err.Error(), http.StatusNotImplemented)
return
}
ctx := request.NewContext(req, writer, endpoint) ctx := request.NewContext(req, writer, endpoint)
err := next.Handle(ctx) err = next.Handle(ctx)
if err != nil { if err != nil {
logger.Error(req.Context(), errors.WithMessage(err, "uncaught error")) logger.Error(req.Context(), errors.WithMessage(err, "uncaught error"))
} }
+19 -4
View File
@@ -50,7 +50,7 @@ func (w *writerWrapper) WriteHeader(statusCode int) {
w.ResponseWriter.WriteHeader(statusCode) w.ResponseWriter.WriteHeader(statusCode)
} }
func Logger( // nolint:gocognit func Logger( // nolint:gocognit,funlen
logger log.Logger, logger log.Logger,
enableRequestLogging bool, enableRequestLogging bool,
enableBodyLogging bool, enableBodyLogging bool,
@@ -65,10 +65,16 @@ func Logger( // nolint:gocognit
r := ctx.Request() r := ctx.Request()
endpoint := ctx.EndpointMeta().Endpoint
if ctx.EndpointMeta().PathSchema != "" {
endpoint = ctx.EndpointMeta().PathSchema
}
strings.TrimPrefix(endpoint, "/")
logBodyFromCurrenRequest := enableBodyLogging logBodyFromCurrenRequest := enableBodyLogging
if logBodyFromCurrenRequest { if logBodyFromCurrenRequest {
for _, prefix := range skipBodyLoggingEndpointPrefixes { for _, prefix := range skipBodyLoggingEndpointPrefixes {
if strings.HasPrefix(ctx.Endpoint(), prefix) { if strings.HasPrefix(endpoint, prefix) {
logBodyFromCurrenRequest = false logBodyFromCurrenRequest = false
break break
} }
@@ -110,8 +116,9 @@ func Logger( // nolint:gocognit
log.String("xForwardedFor", r.Header.Get("X-Forwarded-For")), log.String("xForwardedFor", r.Header.Get("X-Forwarded-For")),
log.Int("statusCode", scSrc.StatusCode()), log.Int("statusCode", scSrc.StatusCode()),
log.String("path", originalPath), log.String("path", originalPath),
log.String("endpoint", ctx.Endpoint()), log.String("endpoint", endpoint),
log.Int("applicationId", authData.ApplicationId), log.Int("applicationId", authData.ApplicationId),
log.String("applicationName", authData.AppName),
log.Int("adminId", ctx.AdminId()), log.Int("adminId", ctx.AdminId()),
} }
@@ -124,7 +131,15 @@ func Logger( // nolint:gocognit
fields = append(fields, log.ByteString("response", buf.ResponseBody())) fields = append(fields, log.ByteString("response", buf.ResponseBody()))
} }
logger.Debug(ctx.Context(), "log request", fields...)
switch {
case scSrc.StatusCode() >= http.StatusInternalServerError:
logger.Error(ctx.Context(), "log request", fields...)
case scSrc.StatusCode() >= http.StatusBadRequest:
logger.Warn(ctx.Context(), "log request", fields...)
default:
logger.Debug(ctx.Context(), "log request", fields...)
}
return err return err
}) })
+3 -3
View File
@@ -10,8 +10,8 @@ import (
func Metrics(storage *http_metrics.ServerStorage) Middleware { func Metrics(storage *http_metrics.ServerStorage) Middleware {
return func(next Handler) Handler { return func(next Handler) Handler {
return HandlerFunc(func(ctx *request.Context) error { return HandlerFunc(func(ctx *request.Context) error {
endpoint := ctx.Endpoint() pathSchema := ctx.EndpointMeta().PathSchema
if endpoint == "" { if pathSchema == "" {
return next.Handle(ctx) return next.Handle(ctx)
} }
@@ -23,7 +23,7 @@ func Metrics(storage *http_metrics.ServerStorage) Middleware {
return err return err
} }
storage.ObserveDuration(r.Method, endpoint, time.Since(start)) storage.ObserveDuration(r.Method, pathSchema, time.Since(start))
return nil return nil
}) })
+19 -1
View File
@@ -13,10 +13,28 @@ const (
requestIdHeader = "x-request-id" requestIdHeader = "x-request-id"
) )
func RequestId(forwardClientRequestId bool, forwardReqIdByApp map[int]bool) Middleware { func RequestId() Middleware {
return func(next Handler) Handler { return func(next Handler) Handler {
return HandlerFunc(func(ctx *request.Context) error { return HandlerFunc(func(ctx *request.Context) error {
requestId := requestid.Next() requestId := requestid.Next()
context := requestid.ToContext(ctx.Context(), requestId)
context = log.ToContext(context, log.String("requestId", requestId))
ctx.SetContext(context)
return next.Handle(ctx)
})
}
}
func ClientRequestId(forwardClientRequestId bool, forwardReqIdByApp map[int]bool) Middleware {
return func(next Handler) Handler {
return HandlerFunc(func(ctx *request.Context) error {
requestId := requestid.FromContext(ctx.Context())
if requestId == "" {
requestId = requestid.Next()
}
clientRequestId := strings.TrimSpace(ctx.Request().Header.Get(requestIdHeader)) clientRequestId := strings.TrimSpace(ctx.Request().Header.Get(requestIdHeader))
logFields := make([]log.Field, 0) logFields := make([]log.Field, 0)
+3 -3
View File
@@ -71,7 +71,7 @@ func (p Grpc) Handle(ctx *request.Context) error {
requestId := requestid.FromContext(ctx.Context()) requestId := requestid.FromContext(ctx.Context())
md := metadata.MD{ md := metadata.MD{
grpc.ProxyMethodNameHeader: {ctx.Endpoint()}, grpc.ProxyMethodNameHeader: {ctx.EndpointMeta().Endpoint},
requestid.Header: {requestId}, requestid.Header: {requestId},
} }
@@ -98,7 +98,7 @@ func (p Grpc) Handle(ctx *request.Context) error {
Body: &isp.Message_BytesBody{BytesBody: body}, Body: &isp.Message_BytesBody{BytesBody: body},
}) })
if err != nil { if err != nil {
return p.handleError(err, ctx.ResponseWriter(), ctx.Endpoint()) return p.handleError(err, ctx.ResponseWriter(), ctx.EndpointMeta().Endpoint)
} }
return p.writeResponse(http.StatusOK, result.GetBytesBody(), requestId, ctx.ResponseWriter()) return p.writeResponse(http.StatusOK, result.GetBytesBody(), requestId, ctx.ResponseWriter())
@@ -138,7 +138,7 @@ func (p Grpc) handleError(err error, w http.ResponseWriter, endpoint string) err
) )
} }
func (p Grpc) writeProto(statusCode int, proto interface{}, w http.ResponseWriter) error { func (p Grpc) writeProto(statusCode int, proto any, w http.ResponseWriter) error {
data, err := json.Marshal(proto) data, err := json.Marshal(proto)
if err != nil { if err != nil {
return errors.WithMessage(err, "marshal grpc details to json") return errors.WithMessage(err, "marshal grpc details to json")
+1 -1
View File
@@ -66,7 +66,7 @@ func (p Http) Handle(ctx *request.Context) error {
} }
request := ctx.Request() request := ctx.Request()
request.URL.Path = ctx.Endpoint() request.URL.Path = ctx.EndpointMeta().Endpoint
err = setHttpHeaders(ctx, request.Header, p.skipAuth) err = setHttpHeaders(ctx, request.Header, p.skipAuth)
if err != nil { if err != nil {
return err return err
+1 -1
View File
@@ -38,7 +38,7 @@ func (ws Ws) Handle(ctx *request.Context) error {
} }
request := ctx.Request() request := ctx.Request()
request.URL.Path = ctx.Endpoint() request.URL.Path = ctx.EndpointMeta().Endpoint
var resultError error var resultError error
proxy := websocketproxy.NewProxy(target) proxy := websocketproxy.NewProxy(target)
+4 -3
View File
@@ -4,9 +4,10 @@ package repository
import ( import (
"context" "context"
"isp-gate-service/domain"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/txix-open/isp-kit/grpc/client" "github.com/txix-open/isp-kit/grpc/client"
"isp-gate-service/domain"
) )
const ( const (
@@ -36,10 +37,10 @@ func (r System) Authenticate(ctx context.Context, token string) (*domain.Authent
return &resp, nil return &resp, nil
} }
func (r System) Authorize(ctx context.Context, applicationId int, endpoint string) (bool, error) { func (r System) Authorize(ctx context.Context, req domain.AuthorizeRequest) (bool, error) {
resp := domain.AuthorizeResponse{} resp := domain.AuthorizeResponse{}
err := r.cli.Invoke(authorize). err := r.cli.Invoke(authorize).
JsonRequestBody(domain.AuthorizeRequest{ApplicationId: applicationId, Endpoint: endpoint}). JsonRequestBody(req).
JsonResponseBody(&resp). JsonResponseBody(&resp).
Do(ctx) Do(ctx)
if err != nil { if err != nil {
+10 -5
View File
@@ -2,6 +2,7 @@ package request
import ( import (
"context" "context"
"isp-gate-service/domain"
"net/http" "net/http"
"strings" "strings"
@@ -24,7 +25,7 @@ type Context struct {
request *http.Request request *http.Request
responseWriter http.ResponseWriter responseWriter http.ResponseWriter
endpoint string endpointMeta *domain.EndpointMeta
authenticated bool authenticated bool
authData *AuthData authData *AuthData
@@ -36,11 +37,15 @@ type Context struct {
queryParams map[string]string queryParams map[string]string
} }
func NewContext(request *http.Request, response http.ResponseWriter, endpoint string) *Context { func NewContext(
request *http.Request,
response http.ResponseWriter,
endpointMeta *domain.EndpointMeta,
) *Context {
return &Context{ return &Context{
request: request, request: request,
responseWriter: response, responseWriter: response,
endpoint: endpoint, endpointMeta: endpointMeta,
} }
} }
@@ -56,8 +61,8 @@ func (c *Context) SetResponseWriter(writer http.ResponseWriter) {
c.responseWriter = writer c.responseWriter = writer
} }
func (c *Context) Endpoint() string { func (c *Context) EndpointMeta() *domain.EndpointMeta {
return c.endpoint return c.endpointMeta
} }
func (c *Context) Authenticate(authData AuthData) { func (c *Context) Authenticate(authData AuthData) {
+86 -54
View File
@@ -2,85 +2,117 @@ package routes
import ( import (
"context" "context"
"fmt" "isp-gate-service/domain"
"isp-gate-service/middleware" "isp-gate-service/middleware"
"net/http"
"strings" "strings"
"github.com/julienschmidt/httprouter"
"github.com/pkg/errors"
"github.com/txix-open/isp-kit/cluster" "github.com/txix-open/isp-kit/cluster"
"github.com/txix-open/isp-kit/log"
) )
type Routes struct { type Routes struct {
allEndpoints map[string]bool logger log.Logger
innerEndpoints map[string]bool allHttpMethods []string
requiredPermissions map[string]string router *httprouter.Router
} }
func NewRoutes() *Routes { func NewRoutes(logger log.Logger) *Routes {
return &Routes{ return &Routes{
allEndpoints: make(map[string]bool), logger: logger,
innerEndpoints: make(map[string]bool), allHttpMethods: []string{
requiredPermissions: make(map[string]string), http.MethodGet,
http.MethodHead,
http.MethodPost,
http.MethodPut,
http.MethodPatch,
http.MethodDelete,
http.MethodConnect,
http.MethodOptions,
http.MethodTrace,
},
router: httprouter.New(),
} }
} }
func (s *Routes) ReceiveRoutes(ctx context.Context, routes cluster.RoutingConfig) error { func (s *Routes) ReceiveRoutes(ctx context.Context, routes cluster.RoutingConfig) error {
newAllEndpoints := make(map[string]bool) router := httprouter.New()
newInnerMethods := make(map[string]bool)
newRequiredPermissions := make(map[string]string)
for _, backend := range routes { for _, backend := range routes {
for _, v := range backend.Endpoints { for _, descriptor := range backend.Endpoints {
newAllEndpoints[v.Path] = true path := normalizeDescriptorPath(descriptor.Path)
if v.Inner { if descriptor.HttpMethod != "" {
newInnerMethods[v.Path] = true s.registerEndpoint(router, descriptor.HttpMethod, path, descriptor)
} } else {
perm, ok := cluster.GetRequiredAdminPermission(v) for _, httpMethod := range s.allHttpMethods {
if ok { s.registerEndpoint(router, httpMethod, path, descriptor)
newRequiredPermissions[v.Path] = perm }
} }
} }
} }
s.allEndpoints = newAllEndpoints s.router = router
s.innerEndpoints = newInnerMethods
s.requiredPermissions = newRequiredPermissions
return nil return nil
} }
func (s *Routes) ResolveEndpoint(path string, cfg middleware.EntryPointConfig) string { func (s *Routes) ResolveEndpoint(method string, path string, cfg middleware.EntryPointConfig) (*domain.EndpointMeta, error) {
if cfg.WithPrefix { lookupPath, metaEndpoint := s.GetPaths(path, cfg)
return path
handler, params, _ := s.router.Lookup(method, lookupPath)
if handler == nil {
if cfg.ErrorOnUnknownEndpoint {
return nil, errors.Errorf("unknown endpoint '%s'", lookupPath)
}
return &domain.EndpointMeta{
Endpoint: metaEndpoint,
}, nil
} }
prefix := fmt.Sprintf("%s/", cfg.PathPrefix) req, _ := http.NewRequestWithContext(context.Background(), method, lookupPath, nil)
noPrefixPath := strings.TrimPrefix(path, prefix) handler(nil, req, params)
ok := s.allEndpoints[noPrefixPath]
if ok { meta := domain.EndpointMetaFromContext(req.Context())
return noPrefixPath meta.Endpoint = metaEndpoint
return &meta, nil
}
func (s *Routes) GetPaths(path string, cfg middleware.EntryPointConfig) (string, string) {
lookupPath := path
if !cfg.WithPrefix {
lookupPath = strings.TrimPrefix(lookupPath, cfg.PathPrefix)
}
metaEndpoint := lookupPath
if !cfg.WithLendingSlash {
metaEndpoint = strings.TrimLeft(metaEndpoint, "/")
}
return lookupPath, metaEndpoint
}
func (s *Routes) registerEndpoint(
router *httprouter.Router,
httpMethod string,
path string,
descriptor cluster.EndpointDescriptor,
) {
defer func() {
_ = recover()
}()
requiredAdminPerm, _ := cluster.GetRequiredAdminPermission(descriptor)
meta := domain.EndpointMeta{
Inner: descriptor.Inner,
RequiredAdminPermission: requiredAdminPerm,
PathSchema: descriptor.Path,
} }
invertedLeadingSlash := invertLeadingSlash(noPrefixPath) handler := func(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
ok = s.allEndpoints[invertedLeadingSlash] ctx := meta.ToContext(r.Context())
if ok { // хак для передачи метадаты обратно в код
return invertedLeadingSlash *r = *r.WithContext(ctx)
} }
router.Handle(httpMethod, path, handler)
return noPrefixPath // pdp-webapi-service(анонсирует вот такой ендпоинт GET /api/:token/profile/me/:blocks) hack =(
}
func (s *Routes) IsInnerEndpoint(endpoint string) bool {
return s.innerEndpoints[endpoint]
}
func (s *Routes) RequiredAdminPermission(endpoint string) (string, bool) {
perm, ok := s.requiredPermissions[endpoint]
return perm, ok
}
func invertLeadingSlash(path string) string {
path, withoutSlash := strings.CutPrefix(path, "/")
if withoutSlash {
return path
}
return "/" + path
} }
+16
View File
@@ -0,0 +1,16 @@
package routes
import "strings"
// nolint:mnd
func normalizeDescriptorPath(path string) string {
pathParts := strings.Split(path, " ")
// хак для endpoint'ов с GET /path
if len(pathParts) == 2 {
path = pathParts[1]
}
if !strings.HasPrefix(path, "/") {
path = "/" + path
}
return path
}
+13 -6
View File
@@ -2,6 +2,8 @@ package service
import ( import (
"context" "context"
"fmt"
"isp-gate-service/domain"
"github.com/pkg/errors" "github.com/pkg/errors"
) )
@@ -12,7 +14,7 @@ type AuthorizationCache interface {
} }
type AuthorizationRepo interface { type AuthorizationRepo interface {
Authorize(ctx context.Context, applicationId int, endpoint string) (bool, error) Authorize(ctx context.Context, req domain.AuthorizeRequest) (bool, error)
} }
type Authorization struct { type Authorization struct {
@@ -27,21 +29,26 @@ func NewAuthorization(cache AuthorizationCache, repo AuthorizationRepo) Authoriz
} }
} }
func (s Authorization) Authorize(ctx context.Context, applicationId int, endpoint string) (bool, error) { func (s Authorization) Authorize(ctx context.Context, applicationId int, httpMethod string, endpoint string) (bool, error) {
ok, err := s.cache.Get(ctx, applicationId, endpoint) cacheKey := fmt.Sprintf("%s %s", httpMethod, endpoint)
ok, err := s.cache.Get(ctx, applicationId, cacheKey)
if err != nil { if err != nil {
return false, errors.WithMessage(err, "authz cache get") return false, errors.WithMessage(err, "authz cache get")
} }
if ok { if ok {
return ok, nil return true, nil
} }
ok, err = s.repo.Authorize(ctx, applicationId, endpoint) ok, err = s.repo.Authorize(ctx, domain.AuthorizeRequest{
ApplicationId: applicationId,
HttpMethod: httpMethod,
Endpoint: endpoint,
})
if err != nil { if err != nil {
return false, errors.WithMessagef(err, "authz repo authorize") return false, errors.WithMessagef(err, "authz repo authorize")
} }
if ok { if ok {
err = s.cache.SetAuthorized(ctx, applicationId, endpoint) err = s.cache.SetAuthorized(ctx, applicationId, cacheKey)
if err != nil { if err != nil {
return false, errors.WithMessagef(err, "authz cache set") return false, errors.WithMessagef(err, "authz cache set")
} }
+4 -4
View File
@@ -78,7 +78,7 @@ func (s *HappyPathTestSuite) TestGrpcProxy() {
logger, err := log.New(log.WithLevel(log.DebugLevel)) logger, err := log.New(log.WithLevel(log.DebugLevel))
require.NoError(err) require.NoError(err)
routes := routes.NewRoutes() routes := routes.NewRoutes(logger)
err = routes.ReceiveRoutes(s.T().Context(), cluster.RoutingConfig{{ err = routes.ReceiveRoutes(s.T().Context(), cluster.RoutingConfig{{
Endpoints: []cluster.EndpointDescriptor{{ Endpoints: []cluster.EndpointDescriptor{{
Path: "endpoint", Path: "endpoint",
@@ -128,7 +128,7 @@ func (s *HappyPathTestSuite) TestHttpProxy() {
rr := lb.NewRoundRobin([]string{targetUrl.Host}) rr := lb.NewRoundRobin([]string{targetUrl.Host})
targetClients := map[string]*lb.RoundRobin{"target": rr} targetClients := map[string]*lb.RoundRobin{"target": rr}
routes := routes.NewRoutes() routes := routes.NewRoutes(test.Logger())
err = routes.ReceiveRoutes(s.T().Context(), cluster.RoutingConfig{{ err = routes.ReceiveRoutes(s.T().Context(), cluster.RoutingConfig{{
Endpoints: []cluster.EndpointDescriptor{{ Endpoints: []cluster.EndpointDescriptor{{
Path: "/endpoint", Path: "/endpoint",
@@ -184,7 +184,7 @@ func (s *HappyPathTestSuite) TestWsProxy() { // nolint: funlen
rr := lb.NewRoundRobin([]string{targetUrl.Host}) rr := lb.NewRoundRobin([]string{targetUrl.Host})
targetClients := map[string]*lb.RoundRobin{"target": rr} targetClients := map[string]*lb.RoundRobin{"target": rr}
routes := routes.NewRoutes() routes := routes.NewRoutes(test.Logger())
err = routes.ReceiveRoutes(s.T().Context(), cluster.RoutingConfig{{ err = routes.ReceiveRoutes(s.T().Context(), cluster.RoutingConfig{{
Endpoints: []cluster.EndpointDescriptor{{ Endpoints: []cluster.EndpointDescriptor{{
Path: "/service", Path: "/service",
@@ -251,7 +251,7 @@ func (s *HappyPathTestSuite) TestAdminAuthorization() {
targetClients := map[string]*client.Client{"target": targetCli} targetClients := map[string]*client.Client{"target": targetCli}
logger, err := log.New(log.WithLevel(log.DebugLevel)) logger, err := log.New(log.WithLevel(log.DebugLevel))
require.NoError(err) require.NoError(err)
routes := routes.NewRoutes() routes := routes.NewRoutes(logger)
locator := assembly.NewLocator(logger, targetClients, nil, routes, systemCli, adminCli, nil) locator := assembly.NewLocator(logger, targetClients, nil, routes, systemCli, adminCli, nil)
locations := []conf.Location{{ locations := []conf.Location{{
+3 -3
View File
@@ -84,7 +84,7 @@ func main() {
}) })
targetClients := map[string]*client.Client{"target": targetCli} targetClients := map[string]*client.Client{"target": targetCli}
logger, _ = log.New(log.WithLevel(log.DebugLevel)) logger, _ = log.New(log.WithLevel(log.DebugLevel))
locator := assembly.NewLocator(logger, targetClients, nil, routes.NewRoutes(), systemCli, adminCli, nil) locator := assembly.NewLocator(logger, targetClients, nil, routes.NewRoutes(logger), systemCli, adminCli, nil)
locations := []conf.Location{{ locations := []conf.Location{{
SkipAuth: false, SkipAuth: false,
PathPrefix: "/api", PathPrefix: "/api",
@@ -126,11 +126,11 @@ func NewMock(logger log.Logger) (*MockServer, *client.Client, *client.Client) {
return &MockServer{ return &MockServer{
srv: srv, srv: srv,
logger: logger, logger: logger,
mockEndpoints: make(map[string]interface{}), mockEndpoints: make(map[string]any),
}, syscli, admincli }, syscli, admincli
} }
func (m *MockServer) Mock(endpoint string, handler interface{}) *MockServer { func (m *MockServer) Mock(endpoint string, handler any) *MockServer {
m.mockEndpoints[endpoint] = handler m.mockEndpoints[endpoint] = handler
wrapper := endpoint2.DefaultWrapper(m.logger) wrapper := endpoint2.DefaultWrapper(m.logger)
muxer := grpc.NewMux() muxer := grpc.NewMux()