mirror of
https://github.com/mulgadc/spinifex.git
synced 2026-10-15 09:01:31 +00:00
fix(spinifexui): stop logging out on signature errors
SignatureDoesNotMatch and IncompleteSignature no longer clear the session: clock skew and path rewrites also produce them, so the user was logged out repeatedly over a request problem.
This commit is contained in:
@@ -12,10 +12,8 @@ function sdkError(name: string): Error {
|
||||
describe("isStaleCredentialsError", () => {
|
||||
const authCodes = [
|
||||
"InvalidClientTokenId",
|
||||
"SignatureDoesNotMatch",
|
||||
"AuthFailure",
|
||||
"MissingAuthenticationToken",
|
||||
"IncompleteSignature",
|
||||
"UnrecognizedClientException",
|
||||
"ExpiredToken",
|
||||
"ExpiredTokenException",
|
||||
@@ -37,6 +35,9 @@ describe("isStaleCredentialsError", () => {
|
||||
["UnauthorizedOperation denial", sdkError("UnauthorizedOperation")],
|
||||
["ValidationError", sdkError("ValidationError")],
|
||||
["InvalidParameterValue", sdkError("InvalidParameterValue")],
|
||||
// Clock skew and path rewrites also produce these; logging out would loop.
|
||||
["SignatureDoesNotMatch", sdkError("SignatureDoesNotMatch")],
|
||||
["IncompleteSignature", sdkError("IncompleteSignature")],
|
||||
["NotFound", sdkError("InvalidInstanceID.NotFound")],
|
||||
["plain Error", new Error("boom")],
|
||||
["network failure", new TypeError("Failed to fetch")],
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
// AWS error codes that indicate the credentials themselves are stale or
|
||||
// invalid (authentication failures), as opposed to authorization denials
|
||||
// (AccessDenied / UnauthorizedOperation) where valid creds lack permission.
|
||||
// invalid, as opposed to authorization denials. Signature errors are left out:
|
||||
// clock skew and a rewritten request path also cause them.
|
||||
const AUTH_ERROR_CODES = new Set([
|
||||
"InvalidClientTokenId",
|
||||
"SignatureDoesNotMatch",
|
||||
"AuthFailure",
|
||||
"MissingAuthenticationToken",
|
||||
"IncompleteSignature",
|
||||
"UnrecognizedClientException",
|
||||
"ExpiredToken",
|
||||
"ExpiredTokenException",
|
||||
|
||||
Reference in New Issue
Block a user