Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Router API Tokens #134

Open
PeteGoo opened this issue May 20, 2014 · 0 comments
Open

Router API Tokens #134

PeteGoo opened this issue May 20, 2014 · 0 comments

Comments

@PeteGoo
Copy link
Member

PeteGoo commented May 20, 2014

To give some protection against someone spamming a router implementation it would be nice if there was a way of providing and revoking tokens that can be used in router query strings

  1. User asks mmbot
    mmbot create api token for teamcity announcements
  2. mmbot creates a token, adds it to the brain
  3. User writes script with router implementation that starts with
robot.Router.Post("/mmbot/chatsecrets/{room}", context => {
    context.ValidateApiToken("teamcity announcements");
    var room = req.Params()["room"]
    var data = context.ReadBodyAsJson()
    var secret = data["secret"].ToString();

    robot.Speak(room, "I have a secret: " + secret);
  });
  1. If the token is compromised the user can simply
    mmbot revoke api token teamcity announcements

The commands can be restricted to admins.

Thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant