Skip to content

feat: adds limited package support for authorization cmds @W-23970417@ - #916

Merged
tshopshireSalesforce merged 1 commit into
packaging-distribution/spifrom
t/packaging-distribution/authsupport
Aug 26, 2026
Merged

feat: adds limited package support for authorization cmds @W-23970417@#916
tshopshireSalesforce merged 1 commit into
packaging-distribution/spifrom
t/packaging-distribution/authsupport

Conversation

@tshopshireSalesforce

Copy link
Copy Markdown
Collaborator

No description provided.

Comment thread src/package/packageAuthorization.ts Outdated
private readonly subscriberPackageId?: string;

public constructor(options: PackageAuthorizationOptions) {
if (options.connection.getApiVersion() < MINIMUM_API_VERSION) {

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.

getApiVersion() returns a string, so this is a lexicographic comparison. Once the API reaches 100.0, "100.0" < "68.0" evaluates to true and blocks all authorization operations. Please compare numerically, e.g. Number(options.connection.getApiVersion()) < Number(MINIMUM_API_VERSION).

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Will update.

}
if (
options.subscriberPackageId &&
(!options.subscriberPackageId.startsWith('033') || !validateSalesforceId(options.subscriberPackageId))

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.

validateSalesforceId in the pinned @salesforce/core@9.0.0 is not anchored: /[a-zA-Z0-9]{18}|[a-zA-Z0-9]{15}/. It accepts malformed 18-character inputs such as 033000000000001!@@, which are then interpolated into Tooling SOQL. Please add an anchored validation here, such as /^(?:[A-Za-z0-9]{15}|[A-Za-z0-9]{18})$/, before storing or querying with the value.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I'd rather rely on the core library validation instead of adding our own so the behavior is consistent.

Comment thread src/package/packageAuthorization.ts Outdated
private readonly subscriberPackageId?: string;

public constructor(options: PackageAuthorizationOptions) {
if (options.connection.getApiVersion() < MINIMUM_API_VERSION) {

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.

Just curious why do we want to do app version check? if app version is less then entity won't be visible.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

To provide a friendlier error message, it isn't necessary.

@tshopshireSalesforce
tshopshireSalesforce force-pushed the t/packaging-distribution/authsupport branch from 9484468 to dc665ac Compare August 26, 2026 15:34
@tshopshireSalesforce
tshopshireSalesforce merged commit 1ed2841 into packaging-distribution/spi Aug 26, 2026
3 checks passed
@tshopshireSalesforce
tshopshireSalesforce deleted the t/packaging-distribution/authsupport branch August 26, 2026 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants