Skip to content

Conversation

@axw
Copy link
Member

@axw axw commented Jan 21, 2020

Elasticsearch operations that use "doRequest" will now
return an *elasticsearch.Error if the server responds
with a status code > 299. The error type can be used
for special handling of certain status codes, such as
401 Unauthorized when performing _has_privileges checks.

The API Key auth code is updated to cache 401 responses
using this type and errors.As, checking for 401s.
Similarly, the apikey CLI subcommand now checks for 404s
specifically for ignoring failed privilege deletions.

Fixes #3215

@axw axw force-pushed the elasticsearch-error-responses branch from 83386d3 to 66739e4 Compare January 21, 2020 03:54
@codecov-io
Copy link

codecov-io commented Jan 21, 2020

Codecov Report

Merging #3218 into master will increase coverage by 0.28%.
The diff coverage is 92.3%.

@@            Coverage Diff             @@
##           master    #3218      +/-   ##
==========================================
+ Coverage   78.87%   79.15%   +0.28%     
==========================================
  Files         106      106              
  Lines        5600     5609       +9     
==========================================
+ Hits         4417     4440      +23     
+ Misses       1183     1169      -14
Impacted Files Coverage Δ
beater/authorization/apikey.go 93.47% <100%> (+0.29%) ⬆️
elasticsearch/client.go 40.54% <87.5%> (+13.67%) ⬆️
elasticsearch/security_api.go 20.45% <0%> (+20.45%) ⬆️

Elasticsearch operations that use "doRequest" will now
return an *elasticsearch.Error if the server responds
with a status code > 299. The error type can be used
for special handling of certain status codes, such as
401 Unauthorized when performing _has_privileges checks.

The API Key auth code is updated to cache 401 responses
using this type and `errors.As`, checking for 401s.
Similarly, the apikey CLI subcommand now checks for 404s
specifically for ignoring failed privilege deletions.
@axw axw force-pushed the elasticsearch-error-responses branch from 66739e4 to 7f40a99 Compare January 21, 2020 05:18
@axw axw requested a review from a team January 21, 2020 05:50
@axw
Copy link
Member Author

axw commented Jan 21, 2020

Integration tests failed because apm-integration-testing is attempting to build apm-server using Go 1.12. Opened elastic/apm-integration-testing#720

@axw
Copy link
Member Author

axw commented Jan 21, 2020

Jenkins run the tests please

@axw axw merged commit 5724da0 into elastic:master Jan 21, 2020
@axw axw deleted the elasticsearch-error-responses branch January 21, 2020 08:25
axw added a commit to axw/apm-server that referenced this pull request Jan 21, 2020
Elasticsearch operations that use "doRequest" will now
return an *elasticsearch.Error if the server responds
with a status code > 299. The error type can be used
for special handling of certain status codes, such as
401 Unauthorized when performing _has_privileges checks.

The API Key auth code is updated to cache 401 responses
using this type and `errors.As`, checking for 401s.
Similarly, the apikey CLI subcommand now checks for 404s
specifically for ignoring failed privilege deletions.
axw added a commit to axw/apm-server that referenced this pull request Jan 21, 2020
Elasticsearch operations that use "doRequest" will now
return an *elasticsearch.Error if the server responds
with a status code > 299. The error type can be used
for special handling of certain status codes, such as
401 Unauthorized when performing _has_privileges checks.

The API Key auth code is updated to cache 401 responses
using this type and `errors.As`, checking for 401s.
Similarly, the apikey CLI subcommand now checks for 404s
specifically for ignoring failed privilege deletions.
axw added a commit that referenced this pull request Jan 21, 2020
Elasticsearch operations that use "doRequest" will now
return an *elasticsearch.Error if the server responds
with a status code > 299. The error type can be used
for special handling of certain status codes, such as
401 Unauthorized when performing _has_privileges checks.

The API Key auth code is updated to cache 401 responses
using this type and `errors.As`, checking for 401s.
Similarly, the apikey CLI subcommand now checks for 404s
specifically for ignoring failed privilege deletions.
axw added a commit that referenced this pull request Jan 21, 2020
Elasticsearch operations that use "doRequest" will now
return an *elasticsearch.Error if the server responds
with a status code > 299. The error type can be used
for special handling of certain status codes, such as
401 Unauthorized when performing _has_privileges checks.

The API Key auth code is updated to cache 401 responses
using this type and `errors.As`, checking for 401s.
Similarly, the apikey CLI subcommand now checks for 404s
specifically for ignoring failed privilege deletions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[API Key] Invalid API Keys are no longer cached

3 participants