Skip to content

Commit 683498c

Browse files
fix(events): use API key auth for events v2 search endpoint
The SearchEvents endpoint (POST /api/v2/events/search) does not support OAuth authentication and requires API/App keys. This mirrors the same issue already fixed for logs, RUM, and other endpoints. - Add /api/v2/events/search to endpointsWithoutOAuth registry - Switch runEventsSearch to use getClientForEndpoint for automatic OAuth→API key fallback - Add test coverage for the new endpoint requirement Fixes #85 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 8ac5afa commit 683498c

3 files changed

Lines changed: 11 additions & 1 deletion

File tree

cmd/events.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ func runEventsList(cmd *cobra.Command, args []string) error {
120120
}
121121

122122
func runEventsSearch(cmd *cobra.Command, args []string) error {
123-
client, err := getClient()
123+
// Events V2 search does not support OAuth, requires API keys
124+
client, err := getClientForEndpoint("POST", "/api/v2/events/search")
124125
if err != nil {
125126
return err
126127
}

pkg/client/auth_validator.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ var endpointsWithoutOAuth = []EndpointAuthRequirement{
6161
{Path: "/api/v2/app_keys/", Method: "POST", SupportsOAuth: false, RequiresAPIKeys: true, Reason: "App Keys management missing OAuth implementation in spec"},
6262
{Path: "/api/v2/app_keys/", Method: "DELETE", SupportsOAuth: false, RequiresAPIKeys: true, Reason: "App Keys management missing OAuth implementation in spec"},
6363

64+
// Events V2 Search API - OAuth not supported
65+
{Path: "/api/v2/events/search", Method: "POST", SupportsOAuth: false, RequiresAPIKeys: true, Reason: "Events V2 search API does not support OAuth authentication"},
66+
6467
// Error Tracking API - OAuth not working in practice
6568
{Path: "/api/v2/error_tracking/issues/search", Method: "POST", SupportsOAuth: false, RequiresAPIKeys: true, Reason: "Error Tracking API requires API keys"},
6669
{Path: "/api/v2/error_tracking/issues/", Method: "GET", SupportsOAuth: false, RequiresAPIKeys: true, Reason: "Error Tracking API requires API keys"},

pkg/client/auth_validator_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@ func TestRequiresAPIKeyFallback(t *testing.T) {
8686
path: "/api/v2/error_tracking/issues/abc123",
8787
expected: true,
8888
},
89+
{
90+
name: "events v2 search requires API keys",
91+
method: "POST",
92+
path: "/api/v2/events/search",
93+
expected: true,
94+
},
8995
{
9096
name: "monitors list supports OAuth",
9197
method: "GET",

0 commit comments

Comments
 (0)