mirror of
https://github.com/pomerium/pomerium.git
synced 2025-07-17 16:48:13 +02:00
authorize: fix authorization check for allowed_domains to only match current route (#624)
This commit is contained in:
parent
ecca5d12dd
commit
b923482ca9
2 changed files with 10 additions and 9 deletions
|
@ -45,7 +45,8 @@ allow {
|
|||
allow {
|
||||
some route
|
||||
input.host = route_policies[route].source
|
||||
allowed_user_domain(token.payload.email)
|
||||
some domain
|
||||
email_in_domain(token.payload.email, route_policies[route].allowed_domains[domain])
|
||||
token.valid
|
||||
count(deny)==0
|
||||
}
|
||||
|
@ -54,18 +55,18 @@ allow {
|
|||
allow {
|
||||
some route
|
||||
input.host = route_policies[route].source
|
||||
allowed_user_domain(token.payload.impersonate_email)
|
||||
some domain
|
||||
email_in_domain(token.payload.impersonate_email, route_policies[route].allowed_domains[domain])
|
||||
token.valid
|
||||
count(deny)==0
|
||||
}
|
||||
|
||||
allowed_user_domain(email){
|
||||
email_in_domain(email, domain) {
|
||||
x := split(email, "@")
|
||||
count(x)=2
|
||||
x[1] == route_policies[route].allowed_domains[_]
|
||||
count(x) == 2
|
||||
x[1] == domain
|
||||
}
|
||||
|
||||
|
||||
default expired = false
|
||||
|
||||
expired {
|
||||
|
|
|
@ -10,7 +10,7 @@ import (
|
|||
const Rego = "rego" // static asset namespace
|
||||
|
||||
func init() {
|
||||
data := "PK\x03\x04\x14\x00\x08\x00\x08\x00\xb5\xbeuP\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\n\x00 \x00authz.regoUT\x05\x00\x01\x06\xa9v^\xbcV_o\xa38\x10\x7f\xf6|\x8a\x91\xabJ\xa0\xe3\xe8\xb5\xd2\x9dth\x91\xf6e?\xc1>F\x11r\xf1$q\x0b6\xc2\xa6I\x16\xe5\xbb\xaflH\xa0iWmw7\xfb\xd2\x861\xf3\x9b\xdf\x1f\x83iD\xf9(\xd6\x84\x8d\xa9\xa9U]\x9d\x8a\xcem\xbe\x01\xa8\xba1\xadC)\x9cH[\xd39*\x1aS\xa9R\x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9\xad\x12\x9e\x1e\xcf\xc2\x9b\x00\xcc\x03/\xb8B\xdf\x85\xda\xe8\xbfC90\xb4\xb8jM\x8d\xa2,\xc9*\xbd\x1e\xd8\x0e[\xcd\x8e\x81\x1d\x85x\x1f\x06\xbce\xff\xba+\xef\xd0\xf2n\xbaC\xe49\xf6|\x84\xe0\xd9\x94\x19\x0ff\xf0\x0c\xc3\xff\x83\xf7u\x11~&x\x96\xef\xcbp\x8b'j\xd5j\x1f\x01cS\xcc\x89\x87`\x8c[*[r<\xc3\xe9\xb3 \x0b\xa2\xf3\xe3f;\x0b\x18;\x00\x0bT=@\x96?\xd7\xebk\x10D\x9f\xaf\x0c\x07\xdb\xf0:>_\x1b\xaa`\xd5Z\x93,\x1e\xb6.\xcbG\xee\xa4\x03w\xbf\x12\xf5\\Tk\x9e!\xff\xf2\xf5\xee\xdf\xff\xf8\xe1\xcc\xebd\xfc\xb0Qk\xad\xf4\xdaK\x88\x01\xe0<+\xff' \xc6\xd8\x03\xa2\xbf\x1e\xce\x11_\x83\xc3\xf7\x00\x00\x00\xff\xffPK\x07\x08\xdb\xe3\xb1\x8d\xbd\x02\x00\x00W \x00\x00PK\x01\x02\x14\x03\x14\x00\x08\x00\x08\x00\xb5\xbeuP\xdb\xe3\xb1\x8d\xbd\x02\x00\x00W \x00\x00\n\x00 \x00\x00\x00\x00\x00\x00\x00\x00\x00\xa4\x81\x00\x00\x00\x00authz.regoUT\x05\x00\x01\x06\xa9v^PK\x05\x06\x00\x00\x00\x00\x01\x00\x01\x00A\x00\x00\x00\xfe\x02\x00\x00\x00\x00"
|
||||
data := "PK\x03\x04\x14\x00\x08\x00\x08\x00o\xa5\x94P\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\n\x00 \x00authz.regoUT\x05\x00\x01s \x9e^\xbcV\xd1n\xac6\x10}\xb6\xbfb\xe4(\x12\xa8\x944\x91Z\xa9\xa8H}\xe9\x17\xf4\x11!\xe4\xe0\xd9]'`#l\xb2\x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\x00\x1f\x84DU#D|\x10q\x06\xb7\x06\x94\xb6 \x15\xdc\xfe\xf4\xc2\x92b\x1e\x87d\xe2\xc3\x07Q\xc6.\xc57hr\xd8\xd8`\x8b\xca\xba^5\xd2\xd8h\x81\x9b\xcc\xe9\xe2\xe5\xfc\xbah'\x93\x8bv9\xb7k$\x7f\xb1\xf9wL\x02\xef\xec\xaf\x0f\xa6\x88\xd4ZY7u\x13\xe7\xbeIX:\xdd\xafw\x1e\x98y^\xf4\x06\\\x14(\xad~\xf6f\xcf\xd0\xc0\xa6\xd7-\xf0\xbaF#\xd56\xb0\x0dsn\xc6\x86MB\\\x1d\x02^yz\xbf*\x9f\xd0\xf2i\xba\xa1\xe59\x9c\xd8\x08\xc1\xb2\xb9g\xcc\x17\x83e\xe0\xff\xcf\xae\xae\x85\x7fL`\xd5\xdf\xb7\xcd\xad^\xb0\x97\x9bcD \x99\xdb\x9c8\x08B\x98\xc1\xbaG\xcb2\x98?5\x12\xef\xe0\x83K\xb7\x98,J\xc8\x99\x12O\xd5\x01d\xf9k\xbd\xce\x16\xf6\xf7\xda\x13.\xcbp\xc4\xaf}\xc1J\x8d\xdc*\x14\xd5\xd3\xdef\xf9\xc8\x1d\x95\xe7\xee<\xd1\x89\xf1f\xcb2`\x7f\xfd\xfd\xf0\xebo\xec\xbc\xaau2~,\xc9\xad\x92j\xeb$\xc4\x94\xd2u\xaf\xdcO\xe2;\xe8\x0e\x1a\x00\xb7\x0ew\x93\xb3\xd13\xfd7\x00\x00\xff\xffPK\x07\x08s\xd6\xb58\xca\x02\x00\x00\xac \x00\x00PK\x01\x02\x14\x03\x14\x00\x08\x00\x08\x00o\xa5\x94Ps\xd6\xb58\xca\x02\x00\x00\xac \x00\x00\n\x00 \x00\x00\x00\x00\x00\x00\x00\x00\x00\xa4\x81\x00\x00\x00\x00authz.regoUT\x05\x00\x01s \x9e^PK\x05\x06\x00\x00\x00\x00\x01\x00\x01\x00A\x00\x00\x00\x0b\x03\x00\x00\x00\x00"
|
||||
fs.RegisterWithNamespace("rego", data)
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue