StackStorm / StackStorm/st2

Feature request: Invalidate Tokens after use

Open
#3,028 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature proposal
Dominant language
Python
Stars
6.5k
Forks
787
PR merge metrics
No merged PRs in 30d

Description

By default, StackStorm creates a new token for every action executed from WebUI which is valid for next 24hrs. We can have it invalidated after few mins by adding TTL in these cases:

  • WebUI: StackStorm creates new Token for every action and it can be set to expire by TTL but instead can we have Tokens invalidated when user Signs out from WebUI or even when action execution is finished same as rule when it kicks off actions.

  • ChatOps: StackStorm creates new Token for every action and it can be set to expire by TTL but if we can have it invalided after execution is done same as rule

  • sensors_container: I was checking token collection in MongoDB and seems sensor service creates some Tokens which are valid for 24hrs and doesnt honor TTL set in st2.conf:

{ "_id" : ObjectId("582b4e8c29c0522e2871a99f"), "user" : "st2admin", "token" : "xxxxxx", "expiry" : ISODate("2016-11-15T18:36:04.431Z"), "metadata" : {  } }
{ "_id" : ObjectId("582b4ee029c0525f3c1a9a12"), "user" : "sensors_container", "token" : "xxxxxxx", "expiry" : ISODate("2016-11-16T18:07:28.122Z"), "metadata" : {  } }
{ "_id" : ObjectId("582b4ee729c0525f3c1a9a13"), "user" : "sensors_container", "token" : "xxxxxxx", "expiry" : ISODate("2016-11-16T18:07:35.697Z"), "metadata" : {  } }
{ "_id" : ObjectId("582b4eef29c0525f3c1a9a14"), "user" : "sensors_container", "token" : "xxxxxxx", "expiry" : ISODate("2016-11-16T18:07:43.205Z"), "metadata" : {  } }
  • CLI: We dont wish to keep credentials in '~/.st2/config' file and with TTL its inconvenient to re-issue tokens at regular interval so even if we set TTL to some longer duration we are able to delete token when user logs off by just removing all tokens created for '"user" : "st2admin"' from MongoDB.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by mapping token creation, expiry, and cleanup across WebUI, ChatOps, sensors_container, and the CLI, then inspect the MongoDB token records and st2.conf TTL behavior described here. Done should be defined for each surface, including sign-out or action completion, while preserving the stated credential-handling expectations.

Written by the indexing model from the issue text.

Assessment

Tech stack
mongodb, python
Domain
authentication, backend, cli, security
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.