-
Notifications
You must be signed in to change notification settings - Fork 0
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
MDTZ-1461 static resource auth #211
Conversation
* @see https://developer.atlassian.com/cloud/jira/platform/understanding-jwt-for-connect-apps/#types-of-jwt-token | ||
* @see https://community.developer.atlassian.com/t/action-required-atlassian-connect-vulnerability-allows-bypass-of-app-qsh-verification-via-context-jwts/47072 | ||
*/ | ||
export const jiraIframeSymmetricJwtAuthenticationMiddleware: RequestHandler = ( |
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.
note: Represents a replacement for the deleted jiraContextSymmetricJwtFromQueryAuthenticationMiddleware
(introduced within #208) as the correct way to authenticate requests from iframes.
The new middleware uses a different verifier (jiraIframeOrServerToServerSymmetricJwtTokenVerifier
instead of jiraContextSymmetricJwtFromQueryAuthenticationMiddleware
) and apples minor fixes to how a request is handled.
However, the middleware is not currently used and can be safely removed if the team agrees on serving static content without authentication. However, if we decide that the authentication is required, this middleware can be used to handle this.
jiraAdminOnlyAuthorizationMiddleware, | ||
); | ||
|
||
staticRouter.use( |
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.
export const staticRouter = Router(); | ||
|
||
staticRouter.use( | ||
'/admin/index.html', |
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.
note: The auth issue is not reproducible with the admin page. This happens since the admin page is served from /static/admin
but not /static/admin/index.html
(see here) therefore, and therefore, this configuration is ignored for requests from Jira.
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.
🤦🏻♂️ the confirmation bias in me testing this code
Changes
HTTP 401
error. Please, see the comments below for more detail.Notes
The issue is resolved by allowing serving static content (e.g., HTML, CSS, etc.) with no authentication/authorization. While the authentication has been recently introduced within #208, we might need to re-evaluate this decision for the following reasons:
HTTP 401
from iframes -- it looks like a generic error, so returningHTTP 401
does not bring much value to users.Please, see the comments below for more detail.