docs: design for AWS account rename during install#25
docs: design for AWS account rename during install#25royosherove wants to merge 3 commits intomainfrom
Conversation
8ca02ee to
e2e7a14
Compare
Adds design doc for renaming AWS accounts to Loki-<original> during Lowkey installation. Incorporates Codex brainstorm feedback: - Rename after deploy confirmation (not before) - Skip in -y mode unless --rename-account flag - Validate against AWS ASCII pattern (not Unicode) - Shell-escape user input - Hybrid uninstall: SSM state + guarded prefix strip - Non-fatal on all API errors
e2e7a14 to
2c8ac48
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 84584cde17
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| | tr -d '\000-\037' \ | ||
| | sed 's/[\$`"\\&|*'\''%]//g' |
There was a problem hiding this comment.
Enforce ASCII-only sanitization for account rename inputs
The sanitizer currently removes control characters and a small blacklist, but it still allows non-ASCII bytes to pass through. In interactive Edit name flow, inputs like Loki-テスト survive _sanitize_account_name and are later sent to put-account-name, which can be rejected by AWS account-name validation; this causes rename attempts to fail unexpectedly even though the function claims to enforce a safe printable-ASCII subset.
Useful? React with 👍 / 👎.
AWS put-account-name rejects non-ASCII characters. Previous sanitizer only stripped control chars + a shell-meta blacklist, so inputs like 'Loki-テスト' would survive client-side validation and fail at the API call. Strip the 0x80-0xFF byte range too, under LC_ALL=C so tr operates byte-wise rather than multi-byte-char-wise. Addresses Codex P2 on PR #25.
|
Addressed Codex review 4206995015: P2 — ASCII-only sanitization: AGREE, fixed in 44a4e2b. Verified:
|
Add maybe_rename_account() to install.sh with: - _sanitize_account_name(): SAFE_NAME_PATTERN validation - _emit_rename_telemetry(): DRY telemetry helper - CLI flags: --auto-rename-account-enabled, --disable-account-rename - Install beacon: account_rename_enabled field - Call site in main() after run_config_and_review(), before console deploy - All AWS/SSM/telemetry calls guarded with 2>/dev/null || true Interactive mode: Rename/Edit/Skip prompt via gum Headless mode: skip by default, opt in with --auto-rename-account-enabled 47 new tests in tests/test-account-rename.sh
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 44a4e2b3eb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if ! aws account help >/dev/null 2>&1; then | ||
| info "Account rename requires AWS CLI v2.8+, skipping" | ||
| _emit_rename_telemetry false false "cli_missing" |
There was a problem hiding this comment.
Detect account CLI support without help command
Using aws account help as the feature probe can falsely disable renaming on systems where AWS CLI is installed but help rendering dependencies are missing (AWS documents the common Could not find executable named 'groff' failure). In that case this branch emits cli_missing and skips rename, even though aws account get-account-information / put-account-name would otherwise work, so interactive users never see the rename prompt and headless opt-in is silently ignored.
Useful? React with 👍 / 👎.
44a4e2b to
1829617
Compare
|
Addressed Codex review 4207036526: P2 — probe account service without requiring groff: AGREE, fixed in 6910740. Replaced with a groff-free probe: run |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 69107403ce
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| # falsely skip rename. Instead run `aws account` with no subcommand: if | ||
| # the service exists, argparse errors with "required: operation"; if it | ||
| # doesn't (old CLI), it errors with "Invalid choice: 'account'". | ||
| if aws account 2>&1 | grep -q "Invalid choice: 'account'"; then |
There was a problem hiding this comment.
Make CLI support check work with pipefail enabled
Because the script runs with set -o pipefail, the probe if aws account 2>&1 | grep -q "Invalid choice: 'account'"; then never evaluates true when aws account exits non-zero (which it does in both supported and unsupported CLI cases). Even when grep matches the unsupported-command message, the pipeline status stays non-zero due to pipefail, so the cli_missing branch is skipped and older AWS CLI installations fall through to the generic api_error path with misleading output/telemetry.
Useful? React with 👍 / 👎.
|
Addressed Codex review 4207072526: P2 \u2014 pipefail-safe probe: AGREE, fixed in 6c48bc4. local _acct_probe
_acct_probe=$(aws account 2>&1 || true)
if [[ "$_acct_probe" == *"Invalid choice: 'account'"* ]]; then
...
fiVerified on a modern CLI: probe yields |
…leted
instance_id is identifying information — removes EC2 instance ID from
telemetry events. Replaced with account_id (12-digit AWS account number)
which enables install correlation without exposing running resource IDs.
- _telem_instance_id() → _telem_account_id() with ^\d{12}$ pattern
- bootstrap_completed event: instance_id → account_id
- telemetry-schema.mdx: updated event props and example
- telemetry-v1.schema.json: no changes needed (EventName only)
6c48bc4 to
4d1e58e
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4d1e58e0e1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| local props | ||
| props="$(_telem_props \ | ||
| "$(_telem_kv instance_id "$(_telem_instance_id "${INSTANCE_ID:-}")")")" | ||
| "$(_telem_kv account_id "$(_telem_account_id "${ACCOUNT_ID:-}")")")" |
There was a problem hiding this comment.
Avoid emitting raw AWS account IDs in telemetry
Switching install.bootstrap_completed to include account_id sends a stable 12-digit AWS account identifier on every successful install, which is a significant privacy regression versus the previous instance-scoped identifier and conflicts with this repo’s stated telemetry guarantees. Because ACCOUNT_ID is sourced directly from aws sts get-caller-identity, this value is always the real account ID whenever telemetry is enabled and bootstrap completes.
Useful? React with 👍 / 👎.
|
Triage of Codex review 4208137289: P1 \u2014 "account_id in install.bootstrap_completed": DISAGREE / FALSE POSITIVE. This PR doesn't emit The relevant emitters:
Happy to reconsider if Codex can point at a specific line where |
Design Doc: AWS Account Rename During Lowkey Install
Renames AWS accounts to
Loki-<original-name>during installation so users can identify Lowkey-deployed accounts in the AWS console switcher.Key decisions
-y): Skip by default (safe for CI); opt in with--auto-rename-account-enabledinstall.account_renamedevent via/v1/ingestwithrenamed,auto_rename_enabled,skipped_reasonpropsloki-dashboardmust register the new event before installer shipsFiles
docs/design-account-rename.md— full design doc (333 lines)Review history