-
Notifications
You must be signed in to change notification settings - Fork 31
refactor: Update User-Agent #103
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
base: main
Are you sure you want to change the base?
Conversation
fix: semantic pr
chore: Introduce release workflowc
… commit SHA Co-authored-by: ayeshurun <98805507+ayeshurun@users.noreply.github.com>
Co-authored-by: ayeshurun <98805507+ayeshurun@users.noreply.github.com>
…workflow feat(ci): enhance create-release workflow with commit targeting and rich error feedback
… commit SHA Co-authored-by: ayeshurun <98805507+ayeshurun@users.noreply.github.com>
Co-authored-by: ayeshurun <98805507+ayeshurun@users.noreply.github.com>
…ost-app-user-agent
| def _get_host_app() -> str: | ||
| """Get the HostApp suffix for the User-Agent header based on environment variables. | ||
| Returns an empty string if the environment variable is not set or has an invalid value. |
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.
Do we want to print warning in those cases?
More broadly, what is the purpose of the host_app value in the request headers?
|
|
||
| host_app = f" host-app/{host_app_name.lower()}" | ||
|
|
||
| # Check for optional version |
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.
nit - remove "what" comment
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.
@copilot please address the comment
📥 Pull Request
Adding a
HostAppidentifier to theUser-Agentstring for all API requests.✨ Description of new changes
User-Agentstring now includes ahost-appsuffix (e.g.,host-app/vscode-extension) if theFAB_HOST_APPenvironment variable is set to a valid, whitelisted value.FAB_HOST_APP_VERSIONenvironment variable is set to a valid version format, the host-app value in User-Agent header will be resulted in 'host-app//'User-Agentis now in a dedicated_build_user_agentfunction insrc/fabric_cli/client/fab_api_client.py.ALLOWED_FAB_HOST_APP_VALUES, has been added tosrc/fabric_cli/core/fab_constant.pyto maintain a list of approvedHostAppvalues.tests/test_core/test_fab_api_client.pyto validate the new functionality, including case-insensitivity and handling of invalid values.🛡️ Security
To ensure that only approved applications can be identified, the value of the environment variable is checked against the
ALLOWED_FAB_HOST_APP_VALUESlist.