Skip to content

[AZINTS-4124] Guard against manually copying script#78

Merged
benjjs merged 4 commits into
mainfrom
benjamin.johnsonstaub/azints-4124/guard-against-manual-copy-script
Nov 4, 2025
Merged

[AZINTS-4124] Guard against manually copying script#78
benjjs merged 4 commits into
mainfrom
benjamin.johnsonstaub/azints-4124/guard-against-manual-copy-script

Conversation

@benjjs
Copy link
Copy Markdown
Collaborator

@benjjs benjjs commented Nov 4, 2025

Motivation

If the user tries to copy the commands from the UI to run the onboarding script using Ctrl+C rather than the button we provide, they will end up with commands missing the API and app keys. Previously this would show up as an azure login fail, which is very misleading.

Summary

First, fix the environment variable check so that we count empty strings as missing variables, as this is what we'll get if they copy the command incorrectly. Then, if we detect that they are specifically missing both the API and App keys, we show a special message suggesting that they may have tried to copy the command manually and to use the button instead.

I also realized that we were reporting login failures as script errors when in fact this is a user error, and moreover one that they can fix immediately in the shell without reloading the shell or the UI, unlike most user actionable errors we catch. As such, I've created a new category of "retriable" errors for things the user can fix and then re-run the command to connect without issue.

Errors of this type are reported to the status API with the new "WARN" status so as not to be counted as errors or displayed in the UI, since both of these things are undesirable. I will make a follow up PR to log these as warnings, as the name would suggest.

Testing

Try copying the wrong way, paste into local shell. I see the new warning as expected
Screenshot 2025-11-03 at 5 22 04 PM

Try logging out or uninstalling script. It now comes through with the new "WARN" status and does not show anything in the UI.
Screenshot 2025-11-04 at 11 47 42 AM

Finally try connecting normally just to make sure it still works. It does.

@benjjs benjjs requested review from gpalmz and tedkahwaji November 4, 2025 17:02
@benjjs benjjs requested a review from a team as a code owner November 4, 2025 17:02
def main():
if missing_environment_vars := REQUIRED_ENVIRONMENT_VARS - os.environ.keys():
missing_environment_vars = [
var for var in REQUIRED_ENVIRONMENT_VARS if var not in os.environ.keys() or not os.environ[var]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: could simplify to var for var in REQUIRED_ENVIRONMENT_VARS if not os.environ.get(var)?

@benjjs benjjs merged commit 612de7f into main Nov 4, 2025
2 checks passed
@benjjs benjjs deleted the benjamin.johnsonstaub/azints-4124/guard-against-manual-copy-script branch November 4, 2025 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants