You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the backends-for-frontend's feature, teleport should first redirect the user to any backend application dependencies defined in the required_apps spec of a frontend application resource to populate the browser with the necessary cookies before redirecting the user to the frontend application.
With cookies populated in the browser for both the backend and frontend application, any backend API calls made by the frontend are authenticated with teleport, thus avoiding a 302 which will confuse frontend code.
Current behavior
teleport only redirects the user to application resource dependencies as defined by required_apps and populates the browser with cookies for that backend dependency when using the launch button from the teleport ui, and neglects to do this when accessing the application directly (from say a bookmark, or by entering it directly into your browser bar).
Details
In the browser developer tools / network area I observed that when you access the domain / URL for a frontend application directly (not using the launch button such as by clicking a bookmark or going to the URL directly in your browser bar) the first 302 redirect in the GET response to the /x-teleport-auth URI neglects to contain a Location header with the correct GET parameters (ie. required-apps=my-backend-app. The request flow differs from that observed when you use the launch button (where the GET parameters are seemingly correctly included which redirect you to any required_apps dependencies FIRST)
This results in a lack of necessary cookies being added to the browser for the backend domain (which would have been used by the frontend, assuming the frontend makes requests using credentials: include in the fetch, and the correct CORS headers are configured)
❗ In the observation below admin is my frontend application and api-admin is my backend application. api-admin is listed in the required_apps field of the frontend admin. The teleport domain is teleport.mydomain.com, and the subdomains admin.teleport.mydomain.com and api-admin.teleport.mydomain.com are used.
Observed Behavior of first 302 response in request flow
✅ Launch Button for "admin" app
Request: GET http://teleport.mydomain.com/x-teleport-auth
Missing required-apps GET parameter value. URI scheme is different than when using the launch button altogether
Bug details
Teleport version: 17.1.4
Reproduction Steps
Define a frontend and backend application in your teleport app resources
Add a required_apps dependency for the backend application in the frontend
Clear all cookies and cache in your browser
Open developer tools + network tab in your browser
Access the application directly in your browser by entering it into your address bar in the format of app-name.teleport-domain.com
Observe the first 302 response in the request flow for GET /x-teleport-auth: The Location header in the response neglects to contain the correct required_appsGET parameter. The browser will not go through the cookie population process for the backend application and go directly to the frontend application. If your frontend code makes a request to the backend, you will get another 302 (in an attempt to get the cookie/session) rather than being piped directly to the backend application (the request is seen as unauthenticated from teleport's perspective)
The text was updated successfully, but these errors were encountered:
hrdflt
changed the title
Backends-for-frontend's feature broken when accessing application's directly in a browser (not using launch button)
Backends-for-frontend's feature broken when accessing application directly in a browser (not using launch button)
Jan 16, 2025
Expected behavior
When using the backends-for-frontend's feature,
teleport
should first redirect the user to any backend application dependencies defined in therequired_apps
spec of a frontend application resource to populate the browser with the necessary cookies before redirecting the user to the frontend application.With cookies populated in the browser for both the backend and frontend application, any backend API calls made by the frontend are authenticated with teleport, thus avoiding a
302
which will confuse frontend code.Current behavior
teleport
only redirects the user to application resource dependencies as defined byrequired_apps
and populates the browser with cookies for that backend dependency when using the launch button from the teleport ui, and neglects to do this when accessing the application directly (from say a bookmark, or by entering it directly into your browser bar).Details
In the browser developer tools / network area I observed that when you access the domain / URL for a frontend application directly (not using the launch button such as by clicking a bookmark or going to the URL directly in your browser bar) the first
302
redirect in theGET
response to the/x-teleport-auth
URI neglects to contain aLocation
header with the correctGET
parameters (ie.required-apps=my-backend-app
. The request flow differs from that observed when you use the launch button (where theGET
parameters are seemingly correctly included which redirect you to anyrequired_apps
dependencies FIRST)This results in a lack of necessary cookies being added to the browser for the backend domain (which would have been used by the frontend, assuming the frontend makes requests using
credentials: include
in thefetch
, and the correct CORS headers are configured)Observed Behavior of first
302
response in request flow✅ Launch Button for "admin" app
GET http://teleport.mydomain.com/x-teleport-auth
Location: https://teleport.mydomain.com/web/launch/api-admin.teleport.mydomain.com/teleport.mydomain.com/api-admin.teleport.mydomain.com?path=&required-apps=api-admin.teleport.mydomain.com%2Cadmin.teleport.mydomain.com
❌ Direct URL access for "admin" app
https://admin.teleport.mydomain.com
GET http://teleport.mydomain.com/x-teleport-auth?path=%2F
Location: https://teleport.mydomain.com/web/launch/admin.teleport.mydomain.com?path=%2F&required-apps=&state=33c84502f6f70848f42339982785ac62_122671e0a82d4e9627a5a99a17105480
Bug details
17.1.4
Reproduction Steps
required_apps
dependency for thebackend
application in thefrontend
app-name.teleport-domain.com
302
response in the request flow forGET /x-teleport-auth
: TheLocation
header in the response neglects to contain the correctrequired_apps
GET
parameter. The browser will not go through the cookie population process for the backend application and go directly to the frontend application. If your frontend code makes a request to the backend, you will get another302
(in an attempt to get the cookie/session) rather than being piped directly to the backend application (the request is seen as unauthenticated fromteleport
's perspective)The text was updated successfully, but these errors were encountered: