[Bug]: A refused request's analytics event and traffic log lose the path the client called
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 78/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- go
- Lĩnh vực
- backend-api-design
Hướng nghiên cứu
Bắt đầu với prepareAnalyticEvent trong gateway/gateway-runtime/policy-engine/internal/analytics/analytics.go; issue xác định đường dẫn request và APIResourceTemplate trống là các điểm chính. Theo dõi cách giá trị đó đi tới publishers/traffic_log_event.go và publishers/moesif.go. Công việc hoàn tất khi các request bị từ chối có đường dẫn được gọi trong thao tác ghi log lưu lượng, URI và metadata của Moesif, giống như các request thành công.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Please select the area the issue is related to
Gateway
Please select the aspect the issue is related to
Aspect/API (API backends, definitions, contracts, interfaces, OpenAPI)
Description
When a policy refuses a request, for example a 401 from jwt-auth, the analytics event and the traffic log lose the path the client called:
- The traffic log line's
operationhas onlymethod, with nopath. - The Moesif event's URI is the API context alone, and its
apiResourceTemplatemetadata is missing.
A request that reaches the backend reports its full path in both, so refused requests can't be grouped or filtered by operation.
Observed
Setup: gateway built from current main, with the Moesif publisher and the traffic log enabled. One REST API, context /probe-path-ktel3flz-3, with jwt-auth on GET /data.
Request 1: GET /probe-path-ktel3flz-3/data with a valid token, 200.
- Traffic log:
"operation":{"method":"GET","path":"/probe-path-ktel3flz-3/data"}. - Moesif event: URI
/probe-path-ktel3flz-3/data, metadataapiResourceTemplate/probe-path-ktel3flz-3/data.
Request 2: the same path with no token, 401.
- Traffic log:
"operation":{"method":"GET"}. The client's path appears only in"target":{"statusCode":401,"destination":"127.0.0.1:33384/probe-path-ktel3flz-3/data"}. - Moesif event: URI
/probe-path-ktel3flz-3, with noapiResourceTemplatein its metadata.
Expected
The refused request's traffic log operation.path, Moesif URI and apiResourceTemplate are the path the client called, /probe-path-ktel3flz-3/data, as for the request that succeeded.
Cause
prepareAnalyticEvent in gateway/gateway-runtime/policy-engine/internal/analytics/analytics.go sets operation.APIResourceTemplate only from the access log entry's original path, the pre-rewrite :path (Envoy's x-envoy-original-path). gateway/configs/config-template.toml notes that Envoy sets it "whenever a route rewrite occurred". A request a policy refuses never reaches the upstream, so it's never rewritten and the original path is empty.
The same function already reads the request's own path into requestPath (it uses it for target.destination), but doesn't fall back to it.
With APIResourceTemplate empty:
- The traffic log publisher omits
path, becauseTrafficLogOperation.Pathisomitemptyinpublishers/traffic_log_event.go. - The Moesif publisher (
publishers/moesif.go,Publish) builds the URI asAPIContext + APIResourceTemplate, which is the context alone.
Steps to Reproduce
- Start a gateway with
[traffic_logging] enabled = trueand the Moesif analytics publisher. - Create a REST API with context
/orders, operationGET /dataand the policy{"name": "jwt-auth", "version": "v1"}, with a key manager configured. - Call
GET /orders/datawith a valid token. The traffic log line has"path":"/orders/data", and the Moesif URI is/orders/data. - Call
GET /orders/datawith noAuthorizationheader. It returns 401. The traffic log line has"operation":{"method":"GET"}, and the Moesif URI is/orders.
Severity Level of the Issue
Severity/Minor (Minor functionality is broken. Doesn't need immediate attention)
Environment Details (with versions)
Current main. The gateway is built from source and run by the IT suite (tests/framework), on macOS with Rancher Desktop.
- Ngôn ngữ chính
- Go
- Star
- 85
- Fork
- 137
- Merge trung bình
- 1 ngày 12 giờ
- Pull request đã merge (30 ngày)
- 247
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của wso2/api-platform
-
Area/DeveloperPortal Aspect/UI Severity/Minor Type/Bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
wso2/api-platform#4369 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: host-rewrite policy documentation lists fewer allowed host characters than the policy acceptsĐang mởArea/Policies Aspect/Other Severity/Trivial Type/Bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 91/100
wso2/api-platform#4355 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Aspect/AI Aspect/API. Severity/Major
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
wso2/api-platform#4343 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: content-length-guardrail policy accepts a non-string streamingJsonPath at API creationĐang mởArea/Policies Aspect/Configuration Severity/Minor Type/Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
wso2/api-platform#4330 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Area/Policies Aspect/API Aspect/Configuration Severity/Minor Type/Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
wso2/api-platform#4329 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của wso2/api-platform
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
keyxmakerx/Chronicle#2285 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
vLLM metrics adapter tests start the adapter twice and race on its request countersCó thể đã có người làm @bhargavchintam đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
llm-d/llm-d-inference-sim#933 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
spellshift/realm#2509 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[数据源补充]111.55.160.167等Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
lionsoul2014/ip2region#552 ·
Maintainer thường phản hồi trong vòng 1 ngày