#3045 [FlyteCTL Feature] Enable attaching custom headers through flyte config script
Issue created by
cast-stripe
Describe the feature/command for FlyteCTL
At Stripe, we plan to implement custom, internally consistent authorization, without setting up Flyte's built-in authentication, by:
1. Introducing a Flyte Admin middleware that evaluates some x-stripe-* request header containing an access token;
2. Updating every Flyte client to pass this header.
A custom token as a header is therefore needed across clients.
For flytekit usages of flyte-cli, although functionality exists today to pass in custom headers via the
set_access_token method, it is cumbersome for every instance of flytekit to have this method called.
Furthermore, for usages of the newer flyteCTL there doesn't exist a way to pass a script to be run
before the request is sent to obtain an access token. The ask is for a configuration parameter to allow for the execution of a command to obtain the auth token in the same manner that
failed authorization requests do currently. To note, our current way of failing requests without the appropriate authorization is to use a proxy service in between flyteCTL and flyte admin.
Reasons for avoiding the purposeful initial request failure to trigger the script are:
• Extra requests which, at scale, may half allowed QPS
• Pollution to our logs and metrics (since half of cmd requests will always be 401)
• Generally a bad practice to allow failure path to control the main
Provide a possible output or UX example
An example config for flyteCTL would look like so:
admin:
• endpoint: dns:///corp.flyte
• authType: ExternalCommand
• insecure: true
• customHeader:
• name: bearer
• command: ../authUserAccessToken
Are you sure this issue hasn't been raised already?
☑︎ Yes
Have you read the Code of Conduct?
☑︎ Yes
flyteorg/flyte