Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: added util for confirming service is not secure proxy #1654

Merged
merged 3 commits into from
Sep 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion packages/common/src/content/hostedServiceUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,28 @@ export function isAGOFeatureServiceUrl(url: string): boolean {
// TODO: we should really centralize this regex somewhere
const FEATURE_SERVICE_URL_REGEX = /(feature)server(\/|\/(\d+))?$/i;
return (
!!url && url.includes("arcgis.com") && FEATURE_SERVICE_URL_REGEX.test(url)
!!url &&
url.includes("arcgis.com") &&
FEATURE_SERVICE_URL_REGEX.test(url) &&
!isSecureProxyServiceUrl(url)
);
}

/**
* Portal secure proxy services are identified by looking for these patterns in the `url`:
abp6318 marked this conversation as resolved.
Show resolved Hide resolved
* - /sharing/servers/
* - /sharing/appservices/
* - /usrsvcs/servers/
* - /usrsvcs/appservices/
*
* This function was given to us by the JSAPI team, so we trust the regex's are correct,
* and won't be adding additional tests for it.
* @param url
*/
export function isSecureProxyServiceUrl(url: string): boolean {
abp6318 marked this conversation as resolved.
Show resolved Hide resolved
return /\/(sharing|usrsvcs)\/(appservices|servers)\//i.test(url);
}

export enum ServiceCapabilities {
EXTRACT = "Extract",
QUERY = "Query",
Expand Down
Loading