Padded zero accounts#1367
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1367 +/- ##
=======================================
Coverage 88.52% 88.52%
=======================================
Files 54 54
Lines 3649 3649
=======================================
Hits 3230 3230
Misses 289 289
Partials 130 130
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
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
AccountIDtype withUnmarshalTextbased onawsparse.AccountIdToInt64inmain.go. - Update
exec,eval,console,ecs load, andtagssubcommands to useAccountIDand cast toint64at 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.
| 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
410d9f3 to
226120d
Compare
use Kong Mapper interface to parse AccountId as a string that converts into an int64
Fixes: #1366