sentialabs / locksmith-go

1 stars 4 forks source link

Bug when logging in again after a session has timed out #3

Closed svdgraaf closed 6 years ago

svdgraaf commented 6 years ago

When I open a session in a shell, everything works fine. When I have it active for an hour, at some point I will get this error: The security token included in the request is expired.

So far so good. Now, when I leave this shell open, and login again in the same terminal, I get an error.

 1 ❯ locksmith
Locksmith GO
618537606105: Sentia: Organization Internal
✔ MFA Token: 123456
ExpiredToken: The security token included in the request is expired
    status code: 403, request id: 7b8abb91-1e26-11e8-8874-39a5d837071

Probably because it tries to make the request with my current environment present?

svdgraaf commented 6 years ago

When I logout the current active locksmith shell, and run the same command again, it works as expected (of course).

tader commented 6 years ago

Locksmith spawns a new shell when it has successfully assumed a role. You should exit your shell and run locksmith again from your normal shell. Currently you have two problems:

We should have Locksmith detect, based on environment variables, that it is being called from within an enviroment that was spawned from Locksmith itself. When it detects this it should provide a warning message and quit.

I would propose to also add a commandline argument --inception which you can provide in the case you do actually want to use the assumed role to assume yet another role.

tader commented 6 years ago

Fixed in release 0.0.2