-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Capture ACL Token from self API call for Reverse Proxy use-case #10563
Capture ACL Token from self API call for Reverse Proxy use-case #10563
Conversation
Signed-off-by: Georges-Etienne Legendre <[email protected]>
Hey, thanks for the pull request. I’ve been thinking about it and I have qualms to varying degrees, but there’s probably a way forward.
Regardless of the implementation in the end, this is the kind of thing I’d like to see reflected in application tests, including one to test the conditional mentioned above 🤓 |
Thanks @backspace for taking a closer look.
Let me provide an alternative implementation here: we can simply adjust the UI logic to always fetch @computed('secret', 'fetchSelfToken.lastSuccessful.value')
get selfToken() {
+ return this.get('fetchSelfToken.lastSuccessful.value');
- if (this.secret) return this.get('fetchSelfToken.lastSuccessful.value');
- return undefined;
}
In fact, this is the idea here. The Reverse Proxy injecting the header into all requests (UI and API - but could be API only). With the alternative implementation described above, the UI would actually not have any apparent token (much like Consul UI does today when we use the same Reverse Proxy approach). |
Signed-off-by: Georges-Etienne Legendre <[email protected]>
@backspace I've updated the PR and added a test for this use-case. I simulated a reverse proxy by simply overriding |
@picatz and @JBhagat841 I'd like to pull you both in for discussion on this one. It's not super clear to me what the security implications are. |
Overall, I'm ok with the proposed changes from a security perspective. Allowing a reverse proxy in front of Nomad's HTTP server to inject the token header for the UI seems useful. 👍 The security implications are fairly nuanced, but I don't believe this would open up a security hole within Nomad itself. I can imagine issues with the reverse proxy implementation, but that would be outside the scope of Nomad. FWIW, the original issue hinted at using SSO like Consul does today. If that's the intended use case here, it might be worth considering if that should be natively implemented instead of requiring a reverse proxy? Maybe that deserves its own issue / discussion, and I don't think would be a reason to block this PR. |
@tgross Is there anything that blocks this patch? I'm willing to help if needs be. Thanks |
Hi @legege 👋 Sorry for the delay here, there's nothing blocking this PR from your side (the failed check is unrelated to your code change). We will review it shortly 👍 |
Signed-off-by: Georges-Etienne Legendre <[email protected]>
Signed-off-by: Georges-Etienne Legendre <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All looks good, thank you for the contribution @legege!
I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions. |
Proposed fix for issue #10561.
I looked into the source code and right now, the only places where a token secret is set are:
nomad/ui/app/services/token.js
Line 49 in 2766444
nomad/ui/app/controllers/settings/tokens.js
Line 43 in 2766444
We simply need to capture and store the secret in
TokenService
when call is made to the Tokenself
API.Here is a tentative implementation that I've tested here. I'm open for recommendations.