-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Provide method for external authorization policy #768
Comments
After sitting on this for a while longer, I think option 2 (explicit identifier) is the way to go. However, as a workaround to modifying every script, we can namespace every script by the package/script name. As a result, you can always apply auth to the entire script. If you want finer grained control, you need to fork or submit a PR against the script. In RBAC-speak, the components break down as follows:
The end goal is to allow script developers to easily expose a set of Operations that an end user can organize and authorize however they wish. Things that still need thinking about:
|
Simple example:
developer:
- hubot-heroku.heroku.view-logs
- hubot-heroku.heroku.deploy
customer_service:
- hubot-statuspageio.statuspage.modify
This would result in restrictive rules for the 3 listed Permissions, but everything else would be allowed. This seems simple to me, but I've been thinking a lot about RBAC. Is this simple enough for less-paranoid organizations? |
Example script with Operation names and basic Permission assignment: # somehow need to auto-extract the module and file names for the base namespace
module.exports = (robot) ->
robot.rbac?.addPermissions?({
'modify': ['create-issue', 'comment-on-issue', 'close-issue'],
'read': ['issue-summary'],
})
robot.respond /open an issue ticket for (.*)$/, {id:'create-issue'}, (msg) ->
# create a new ticket
robot.hear /https:\/\/jira.example.com/browse/[A-Z]+-[0-9]+$/, {id:'issue-summary'}, (msg) ->
# display info about the ticket |
@technicalpickles (or whoever you want to redirect to) Can you take a look at the last 2 comments and let me know if that seems like a reasonable path to start implementing? |
I don't personally use hubot much anymore, I have my own private robot implementation. |
bummer... well, thanks for the fast response! |
@michaelansel thanks for putting this all together. It's quite a bit to parse, which is part of why I've been '...', but I've definitely been thinking on making hubot more flexible to allow for these kinds of behaviors. Overall, I'm liking the approach. The things I'm particularly interested/concerned about are backwards-compatability with existing hubot installs/scripts, and the complexity of the code going into hubot itself.
One idea I've been mulling about is the applying the idea of having middleware in place for when listeners are invoked. That's a concept I could see living in hubot itself. That plays nicely into listeners having ids and other metadta. I could easily imagine there being things like automatically collecting metrics & logs. That still has the problem of what adds the middleware? It could be a new For that, I've been considering something similar to rack's config.ru file. That is, an initial file that gets loaded, before any scripts are loaded, that can be used to programatically make changes to the boat. This would be the place to add in middleware. I think it'd have the benefit of eventually being able to get rid of hubot-scripts.json and external-scripts.json in favor of programatically loading things.
Config file, I suppose. Or maybe make a script loaded after the core one, that redefines the permissions?
I think it'd make sense to lay out some use cases to help flesh this out. Here's what I would imagine are the simplest common ones:
Anything after that is going to be more complex, like allowing some roles some things, other roles other things, and blacklisting anything else.
The example looks on par to me. Only comments are:
|
Work is progressing over in #803 to add listener middleware. Once that's done, work can proceed on an external hubot script for authorization ie https://github.com/michaelansel/hubot-rbac Going to leave this open until the listener middleware merges. |
It's been merged for awhile 😂 |
Building off of the filtering mechanism in #724, I'm trying to build a mechanism for setting an authorization policy outside of individual scripts. I want to do this so I can specify my own policy around who can execute commands (and potentially what level of identify verification is required) without forking every script and injecting my own company-specific code.
I think the rough end-result is something like RBAC with a permissions file that maps individual listeners to permitted users/groups. In that model, I need a way to reliably reference individual listeners so that I can apply policy to them.
The most precise, but least stable, method I can think of would be to reference each listener by regex. This feels very dirty though...
The most stable method would be to add an explicit, unique identifier to every command. This could be accomplished by tweaking the respond/hear API to include an identifier field and putting together a PR for every script I intend to use. Not a terrible solution, but it would be a lot of work and requires lots of upstream acceptance.
An in-between option would be to specify an example message and then search for all listeners that match the message. This isn't perfect, but accomplish the goal well enough.
I'm sure other concerns will come up along the way, so opening the issue now to start collecting feedback and posting updates as I work on this.
The text was updated successfully, but these errors were encountered: