Skip to content

Padded zero accounts#1367

Merged
synfinatic merged 1 commit into
mainfrom
padded-zero-accounts
May 19, 2026
Merged

Padded zero accounts#1367
synfinatic merged 1 commit into
mainfrom
padded-zero-accounts

Conversation

@synfinatic
Copy link
Copy Markdown
Owner

use Kong Mapper interface to parse AccountId as a string that converts into an int64

Fixes: #1366

Copilot AI review requested due to automatic review settings May 19, 2026 04:18
@codecov
Copy link
Copy Markdown

codecov Bot commented May 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.52%. Comparing base (6d27810) to head (226120d).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1367   +/-   ##
=======================================
  Coverage   88.52%   88.52%           
=======================================
  Files          54       54           
  Lines        3649     3649           
=======================================
  Hits         3230     3230           
  Misses        289      289           
  Partials      130      130           
Flag Coverage Δ
unittests 88.52% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6d27810...226120d. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes #1366 where AWS account IDs starting with 0 (e.g. 012345678901) were rejected because Kong parsed AccountId directly as int64. A new AccountID type implementing encoding.TextUnmarshaler is introduced; its UnmarshalText delegates to awsparse.AccountIdToInt64, which already tolerates leading zeros and scientific notation. The various subcommand structs are switched from int64 to AccountID, and call sites cast back to int64 when passing to existing helpers.

Changes:

  • Add AccountID type with UnmarshalText based on awsparse.AccountIdToInt64 in main.go.
  • Update exec, eval, console, ecs load, and tags subcommands to use AccountID and cast to int64 at the boundaries.
  • CHANGELOG entry under Unreleased.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
cmd/aws-sso/main.go Defines new AccountID int64 type and UnmarshalText delegating to awsparse.AccountIdToInt64.
cmd/aws-sso/exec_cmd.go Switches AccountId field to AccountID; casts to int64 when building SelectCliArgs.
cmd/aws-sso/eval_cmd.go Switches field type, fixes comparison to != 0, casts to int64 in assignment.
cmd/aws-sso/console_cmd.go Switches field type and casts to int64 at call site.
cmd/aws-sso/ecs_client_cmd.go Switches field type and casts to int64 at call site.
cmd/aws-sso/tags_cmd.go Switches field type and pre-converts to int64 before use.
CHANGELOG.md Documents the bug fix under Unreleased.

Note: cmd/aws-sso/process_cmd.go still declares AccountId int64 and was not updated; the leading-zero bug remains reachable through aws-sso process --account ....


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cmd/aws-sso/tags_cmd.go
type TagsCmd struct {
AccountId int64 `kong:"name='account',short='A',help='Filter results based on AWS AccountID'"`
Role string `kong:"short='R',help='Filter results based on AWS Role Name'"`
AccountId AccountID `kong:"name='account',short='A',help='Filter results based on AWS AccountID'"`
use Kong Mapper interface to parse AccountId as a string
that converts into an int64

Fixes: #1366
@synfinatic synfinatic force-pushed the padded-zero-accounts branch from 410d9f3 to 226120d Compare May 19, 2026 04:24
@synfinatic synfinatic merged commit cf7edfa into main May 19, 2026
9 checks passed
@synfinatic synfinatic deleted the padded-zero-accounts branch May 19, 2026 18:56
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.

aws-sso-cli v2 rejects a valid AWS account ID when it begins with 0.

2 participants