Skip to content

(Ready to merge) fix(aviator): 2527025 handle leading zeros in application id; treat leading-zero values as names - #1157

Open
anishkumarnagaraj-design wants to merge 5 commits into
fortify:feat/v3.x/aviator/27.1from
anishkumarnagaraj-design:fix/v3.x/aviator/2527025-app-id-leading-zeros
Open

anishkumarnagaraj-design wants to merge 5 commits into
fortify:feat/v3.x/aviator/27.1from
anishkumarnagaraj-design:fix/v3.x/aviator/2527025-app-id-leading-zeros

Conversation

@anishkumarnagaraj-design

@anishkumarnagaraj-design anishkumarnagaraj-design commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Story

ValueEdge defect 2527025: Incorrect "Permission Denied" error is displayed when application ID contains leading zeros
https://almoctane-ams.saas.microfocus.com/ui/?&p=206015/2001#/entity-navigation?entityType=work_item&id=2527025

Why

fcli aviator app update 001564 --name x failed with Permission Denied for application update ... Message part 2 mismatch, while 1564 succeeded. All-digit values were forwarded unchanged as ids, so the id was signed and sent as 001564 and the server did not match it against the canonical id 1564. The error pointed at permissions although the cause was the id format.

Review feedback: SSC applications can have numeric names such as 000144. Normalizing such a value to id 144 would select the wrong application, or make the named application unreachable.

What changed

  • AviatorAppHelper (fcli-aviator): only values in canonical numeric form (0 or digits without a leading zero, max 18 digits) are treated as an application id and returned unchanged. Every other value, including all-digit values with a leading zero such as 000144, is treated as an application name and passed to GetApplicationByName exactly as typed. No Long.parseLong normalization is applied anywhere.
  • isNumeric replaced by isCanonicalId. It was only used inside the helper.
  • Applies to all admin app commands taking <app-name-or-id> (update, get, delete, add-entitlement, reduce-entitlement) as they resolve through this helper.
  • No change to commands, options, output, action YAML or .proto.

Behaviour

Input Treated as Sent to server
1564, 2024 id unchanged
001564, 000144 name as typed
0 id 0
999999999999999999 (18 digits) id unchanged
19 digits or more name as typed
my-app name as typed

Ids that previously worked (canonical form) behave exactly as before. A leading-zero value never worked as an id (server rejected it), so nothing that worked is broken. If it matches no application, the user now gets the normal "application not found" result for that name.

Tests

  • AviatorAppHelperTest: canonical id detection, canonical ids passed through without server contact, leading-zero values take the name-lookup path.
  • Run: ./gradlew :fcli-core:fcli-aviator:test --tests "*AviatorAppHelperTest". Result: passed.
  • Not covered: no end-to-end run against a live Aviator server.

Out of scope / decisions

  • The "Permission Denied" wording for genuine server-side mismatches is unchanged.
  • Canonical numeric values (for example 144) remain ids with no fallback to name; an application whose name is a canonical number is addressable only by id (existing behaviour).
  • 0 is treated as a canonical id; the server rejects it if no such application exists.

Numeric values passed to aviator app commands were forwarded to the server unchanged. An id such as 001564 was signed and sent as-is, the server did not match it against the canonical id 1564, and the user saw a misleading "Permission Denied ... Message part 2 mismatch" error. Numeric ids are now normalized (leading zeros removed) before they are signed and sent, so 001564 behaves exactly like 1564.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@kireetivar

Copy link
Copy Markdown
Contributor

SSC Applications can have numeric names such as 0000144. Could we treat leading-zero values such as 000144 as application names rather than normalize them to IDs?, and this command accepts either a name or an ID. In this scenario, normalization selects ID 144 instead of the intended application named 000144

Only canonical numeric values are used as ids; values such as 000144 are passed unchanged to the name lookup.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@anishkumarnagaraj-design anishkumarnagaraj-design changed the title fix(aviator): 2527025 normalize leading zeros in numeric application id fix(aviator): 2527025 handle leading zeros in application id; treat leading-zero values as names Nov 3, 2026
@anishkumarnagaraj-design

Copy link
Copy Markdown
Contributor Author

Thanks for the feedback. Confirmed and fixed in 0c70cd9: ids are no longer normalized. Only canonical numeric values (0 or digits without a leading zero) are treated as an application id and passed through unchanged. Any other value, including leading-zero values such as 000144, is treated as an application name and sent to the name lookup exactly as typed. Canonical ids behave as before; a leading-zero value never worked as an id because the server rejects it. Tests and the PR description are updated.

@kireetivar

Copy link
Copy Markdown
Contributor

Could we also update the shared help text as well?

Anishkumar N and others added 2 commits November 3, 2026 14:38
… values

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@anishkumarnagaraj-design

Copy link
Copy Markdown
Contributor Author

Help text updated in the latest commit: numeric values without leading zeros are ids; everything else, including values like 000144, is a name. The help assertion in AviatorAppResolverMixinTest is updated as well (7 + 6 tests pass).

@kireetivar

Copy link
Copy Markdown
Contributor

one very minor comment AviatorAppResolverMixin Javadoc still says numeric values are always IDs. Update it to match the new leading-zero rule.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

@umadevis1 umadevis1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@anishkumarnagaraj-design anishkumarnagaraj-design changed the title fix(aviator): 2527025 handle leading zeros in application id; treat leading-zero values as names (Ready to merge) fix(aviator): 2527025 handle leading zeros in application id; treat leading-zero values as names Nov 4, 2026
@anishkumarnagaraj-design

Copy link
Copy Markdown
Contributor Author

Tested,
Screenshot 2026-11-04 145624

This branch has not been deployed

No deployments
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.

3 participants