feat: adds limited package support for authorization cmds @W-23970417@ - #916
Conversation
| private readonly subscriberPackageId?: string; | ||
|
|
||
| public constructor(options: PackageAuthorizationOptions) { | ||
| if (options.connection.getApiVersion() < MINIMUM_API_VERSION) { |
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
Will update.
| } | ||
| if ( | ||
| options.subscriberPackageId && | ||
| (!options.subscriberPackageId.startsWith('033') || !validateSalesforceId(options.subscriberPackageId)) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
I'd rather rely on the core library validation instead of adding our own so the behavior is consistent.
| private readonly subscriberPackageId?: string; | ||
|
|
||
| public constructor(options: PackageAuthorizationOptions) { | ||
| if (options.connection.getApiVersion() < MINIMUM_API_VERSION) { |
There was a problem hiding this comment.
Just curious why do we want to do app version check? if app version is less then entity won't be visible.
There was a problem hiding this comment.
To provide a friendlier error message, it isn't necessary.
9484468 to
dc665ac
Compare
1ed2841
into
packaging-distribution/spi
No description provided.