mozilla-iam / mozilla.oidc.accessproxy

Stand-alone OIDC Access Proxy
Mozilla Public License 2.0
12 stars 10 forks source link

X-Forwarded-Groups contains leading pipe | character #20

Closed gene1wood closed 6 years ago

gene1wood commented 6 years ago

Once #19 is fixed, you'll encounter this problem.

This line

 grps = grps and grps.."|"..v or v

is meant to test if grps is an empty string, and if so to set grps to v. Then on subsequent runs where grps is not an empty string, append the | character followed by v to grps

Unfortunately in lua, an empty string evaluates to true, not false.

The result of this is that every X-Forwarded-Groups header is preceded by a | character. For example a user in groups foo and bar would have a grps value of |foo|bar instead of foo|bar

To fix this, change this line from local grps = "" to local grps = false