diff --git a/platform/ide-core/src/ru/openide/io/WhiteListUrls.kt b/platform/ide-core/src/ru/openide/io/WhiteListUrls.kt index d1b25126cace..c677251f20fd 100644 --- a/platform/ide-core/src/ru/openide/io/WhiteListUrls.kt +++ b/platform/ide-core/src/ru/openide/io/WhiteListUrls.kt @@ -21,178 +21,178 @@ import java.net.URLConnection object WhiteListUrls { private val urls = listOf( - "https://github.com", - "https://search.maven.org", - "https://repo.jfrog.org", - "https://oss.sonatype.org", - "https://repository.jboss.org", - "https://repo.maven.apache.org", - "https://plugins.gradle.org/plugin/org.jetbrains.intellij", - "https://api.github.com/repos", - "https://pypi.python.org", - "http://localhost", - "https://services.gradle.org", - "https://plugins.openide.ru/", - "https://downloads.marketplace.openide.ru", - "https://downloads.openide.ru", - "https://repo1.maven.org/maven2/net/sourceforge/plantuml/plantuml/1.2023.10/plantuml-1.2023.10.jar", - "https://amplicode.ru", - "https://download.openide.ru", - "https://download-ide.axiomjdk.ru", - "https://schemastore.org", - "https://storage.yandexcloud.net/amplicode-marketplace/drivers/jdbc-drivers.xml", - "https://openide.ru", - "https://d5dloaaon52j82oceane.apigw.yandexcloud.net", - "https://index.docker.io", - "https://grafana.com", - "https://mcr.microsoft.com", - "https://container-registry.oracle.com", - "https://registry-1.docker.io", - "https://checksid.jmix.io", - "https://store-admin.jmix.io", - "https://jmix", - "https://sso.jmix.io", - "https://account.jmix.io", - "https://global.repo.jmix.io", - "https://nexus.jmix.io", - "https://usage-stat.cuba-platform.com", - "https://api.hsforms.com/submissions/v3/integration/submit/", - "https://store.amplicode.ru", - "https://ls.store.amplicode.ru", - "https://resources.openide.ru", - "https://api.github.com", - "https://avatars.githubusercontent.com", - "https://plugin.openbpm.ru" + "github.com", + "search.maven.org", + "repo.jfrog.org", + "oss.sonatype.org", + "repository.jboss.org", + "repo.maven.apache.org", + "plugins.gradle.org/plugin/org.jetbrains.intellij", + "api.github.com/repos", + "pypi.python.org", + "localhost", + "services.gradle.org", + "plugins.openide.ru", + "downloads.marketplace.openide.ru", + "downloads.openide.ru", + "repo1.maven.org/maven2/net/sourceforge/plantuml/plantuml/1.2023.10/plantuml-1.2023.10.jar", + "amplicode.ru", + "download.openide.ru", + "download-ide.axiomjdk.ru", + "schemastore.org", + "storage.yandexcloud.net", + "openide.ru", + "d5dloaaon52j82oceane.apigw.yandexcloud.net", + "index.docker.io", + "grafana.com", + "mcr.microsoft.com", + "container-registry.oracle.com", + "registry-1.docker.io", + "checksid.jmix.io", + "store-admin.jmix.io", + "jmix", + "sso.jmix.io", + "account.jmix.io", + "global.repo.jmix.io", + "nexus.jmix.io", + "usage-stat.cuba-platform.com", + "api.hsforms.com/submissions/v3/integration/submit/", + "store.amplicode.ru", + "ls.store.amplicode.ru", + "resources.openide.ru", + "api.github.com", + "avatars.githubusercontent.com", + "plugin.openbpm.ru", + "gitflic.ru" ) // Collect urls from KnownSchemaIdentifiers.json private val jsonSchemaUrls = listOf( - "https://raw.githubusercontent.com", - "http://json.schemastore.org", - "https://json.schemastore.org", - "https://schemastore.azurewebsites.net", - "http://json-schema.org", - "https://json-schema.org", - "https://developer.1password.com/schema/ssh-agent-config.json", - "https://appsemble.app/api.json#/components/schemas/AppDefinition", - "https://gitlab.com/appsemble/appsemble/-/raw/HEAD/packages/cli/assets/appsemblerc.schema.json", - "https://www.asyncapi.com/schema-store/all.schema-store.json", - "https://atmos.tools/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json", - "https://coderabbit.ai/integrations/schema.v2.json", - "https://github.com/cloudcannon/configuration-types/releases/latest/download/cloudcannon-config.schema.json", - "https://github.com/cmhughes/latexindent.pl/raw/main/documentation/latexindent-yaml-schema.json", - "https://chat-agents.lobehub.com/schema/lobeAgentSchema_v1.json", - "https://fasterci.com/config.schema.json", - "https://flagd.dev/schema/v0/flags.json", - "https://ide-integration.batect.dev/v1/configSchema.json", - "https://bitbucket.org/atlassianlabs/intellij-bitbucket-references-plugin/raw/master/src/main/resources/schemas/bitbucket-pipelines.schema.json", - "https://schemas.wp.org/trunk/block.json", - "https://blockprotocol.org/schemas/block-metadata.json", - "https://carafe.fm/schema/draft-02/bundle.schema.json", - "https://gitlab.com/chromaway/core-tools/chromia-cli/-/raw/dev/chromia-build-tools/src/main/resources/chromia-model-schema.json", - "https://appliedengdesign.github.io/cnccodes-json-schema/draft/2022-07/schema", - "https://deta.space/assets/spacefile.schema.json", - "https://codemagic.io/codemagic-schema.json", - "https://wixplosives.github.io/codux-config-schema/codux.config.schema.json", - "https://openapi.vercel.sh/vercel.json", - "https://unpkg.com/@changesets/config/schema.json", - "https://getcomposer.org/schema.json", - "https://on.cypress.io/cypress.schema.json", - "https://gitlab.com/sbenv/veroxis/docker-seq/-/raw/HEAD/docker-seq.schema.json", - "https://dprint.dev/schemas/v0.json", - "https://dstack-runner-downloads.s3.eu-west-1.amazonaws.com/latest/schemas/configuration.json", - "https://enterprisecontract.dev/enterprise-contract-controller/schema/policy_spec.json", - "https://cdn.jsdelivr.net/gh/tarampampam/error-pages@latest/schemas/config/1.0.schema.json", - "https://gitlab.com/sbenv/veroxis/ezd-rs/-/raw/HEAD/ezd.schema.json", - "https://gitlab.com/fdroid/fdroiddata/-/raw/master/schemas/metadata.json", - "https://ffizer.github.io/ffizer/ffizer.schema.json", - "https://gitlab.cern.ch/steam/fiqus/-/raw/master/docs/schema.json", - "https://gitlab.com/gitlab-org/gitlab/-/raw/master/app/assets/javascripts/editor/schema/ci.json", - "https://gitpod.io/schemas/gitpod-schema.json", - "https://golangci-lint.run/jsonschema", - "https://goreleaser.com/static", - "https://github.com/goss-org/goss/raw/master/docs/schema.yaml", - "https://unpkg.com/@graphql-mesh/types/esm/config-schema.json", - "https://unpkg.com/graphql-config/config-schema.json", - "https://www.graphql-code-generator.com/config.schema.json", - "https://hazelcast.com/schema/config/hazelcast-config-5.5.json", - "https://html-validate.org/schemas/config.json", - "https://hyperfoil.io/schema.json", - "https://ifstate.net/schema/1/ifstate.conf.schema.json", - "https://schema.infrahub.app/python-sdk/repository-config/latest.json", - "https://jenkins-x.io/schemas", - "https://github.com/abstracta/jmeter-java-dsl/releases/latest/download/jmdsl-config-schema.json", - "https://jsr.io/schema/config-file.v1.json", - "https://jsonapi.org/schema", - "https://www.krakend.io/schema/krakend.json", - "https://kubri.dev/schema.json", - "https://cdn.jsdelivr.net/npm/liblab@latest/liblab.config.schema.json", - "https://w3id.org/linkml/meta.schema.json", - "https://grnhse-vpc-assets.s3.amazonaws.com/jsonschemas/lotus.yaml.json", - "https://github.com/napari/npe2/releases/latest/download/schema.json", - "https://noxorg.dev/schemas/NoxConfiguration.json", - "https://spec.openapis.org/oas/3.1/schema/2022-10-07", - "https://meta.open-rpc.org/", - "https://github.com/usnistgov/OSCAL", - "https://schema.postman.com/collection/json/v2.1.0/draft-07/collection.json", - "https://www.qgoda.net/schemas/qgoda.json", - "https://docs.renovatebot.com/renovate-schema.json", - "https://cdn.jsdelivr.net/gh/roadrunner-server/roadrunner@latest/schemas/config/3.0.schema.json", - "https://cdn.sdf.com/schemas/sdf-schema-1.3.json", - "https://starship.rs/config-schema.json", - "https://schemas.wp.org/trunk/theme.json", - "https://turborepo.org/schema.json", - "https://static.trunk.io/pub/trunk-yaml-schema.json", - "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json", - "https://tstyche.org/schemas/config.json", - "https://cdn.jsdelivr.net/npm/tsup/schema.json", - "https://sap.github.io/ui5-tooling/schema", - "https://github.com/go-vela/types/releases/latest/download/schema.json", - "https://www.unpkg.com/wrangler/config-schema.json", - "https://json-stat.org/format/schema/2.0/", - "https://typedoc.org/schema.json", - "https://mise.jdx.dev/schema/mise.json", - "https://motif.land/api/motif.schema.json", - "https://github.com/helmwave/helmwave/releases/latest/download/schema.json", - "https://github.com/fbecart/zinoma/releases/latest/download/zinoma-schema.json", - "https://uniswap.org/tokenlist.schema.json", - "https://docs.gradle.com/enterprise/admin/schema/gradle-enterprise-config-schema-10.json", - "https://docs.gradle.com/build-cache-node/schema/build-cache-node-config-schema-5.json", - "https://yarnpkg.com/configuration/yarnrc.json", - "https://taskfile.dev/schema.json", - "https://render.com/schema/render.yaml.json", - "https://www.liquibase.org/json/schema/liquibase-flow-file-latest.json", - "https://github.com/mason-org/registry-schema/releases/latest/download/package.schema.json", - "https://s3.eu-central-1.amazonaws.com/files.netin.io/spider-schemas/template.schema.json", - "https://noodl.s3.us-west-1.amazonaws.com/noodl.schema.json", - "https://download.stackhawk.com/hawk/jsonschema/hawkconfig.json", - "https://www.updatecli.io/schema", - "https://geojson.org/schema/GeoJSON.json", - "https://public.dhe.ibm.com", - "https://datahubproject.io/schemas/datahub_ingestion_schema.json", - "https://upliftci.dev/static/schema.json", - "https://github.com/DannyBen/completely/blob/master/schemas/completely.json", - "https://docs.visivo.io/assets/visivo_schema.json", - "https://enduricastorage.blob.core.windows.net/public/endurica-cl-schema.json", - "https://rivet.gg/rivet.schema.json", - "https://cdn.subsquid.io/schemas/squid_manifest.json", - "https://gitlab.com/gitlab-org/cluster-integration/gitlab-agent/-/raw/master/pkg/agentcfg/agentcfg_schemas/ConfigurationFile.json", - "https://www.cardgamesimulator.com/schema/CardGameDef.json", - "https://alec016.github.io/Custom-Machinery", - "https://bioimage-io.github.io/spec-bioimage-io/bioimageio_schema_latest.json", - "https://www.json-wf.org.uk/json-wf-schema-1.0.json", - "https://download.qt.io/official_releases/qtcreator/latest/installer_source/jsonschemas/project.json", - "https://api.app-prg1.zerops.io", - "https://repo1.maven.org/maven2/com/walmartlabs/concord/runtime/v2/concord-runtime-model-v2/2.14.0/concord-runtime-model-v2-2.14.0-schema.json", - "https://deployments.allegrogroup.com/tycho/schema", - "https://www.eidolonai.com/json_schema/v1/resources/overview.json", - "https://waku.ngjx.org/static/schema.json" + "raw.githubusercontent.com", + "json.schemastore.org", + "schemastore.azurewebsites.net", + "json-schema.org", + "developer.1password.com/schema/ssh-agent-config.json", + "appsemble.app/api.json#/components/schemas/AppDefinition", + "gitlab.com/appsemble/appsemble/-/raw/HEAD/packages/cli/assets/appsemblerc.schema.json", + "www.asyncapi.com/schema-store/all.schema-store.json", + "atmos.tools/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json", + "coderabbit.ai/integrations/schema.v2.json", + "github.com/cloudcannon/configuration-types/releases/latest/download/cloudcannon-config.schema.json", + "github.com/cmhughes/latexindent.pl/raw/main/documentation/latexindent-yaml-schema.json", + "chat-agents.lobehub.com/schema/lobeAgentSchema_v1.json", + "fasterci.com/config.schema.json", + "flagd.dev/schema/v0/flags.json", + "ide-integration.batect.dev/v1/configSchema.json", + "bitbucket.org/atlassianlabs/intellij-bitbucket-references-plugin/raw/master/src/main/resources/schemas/bitbucket-pipelines.schema.json", + "schemas.wp.org/trunk/block.json", + "blockprotocol.org/schemas/block-metadata.json", + "carafe.fm/schema/draft-02/bundle.schema.json", + "gitlab.com/chromaway/core-tools/chromia-cli/-/raw/dev/chromia-build-tools/src/main/resources/chromia-model-schema.json", + "appliedengdesign.github.io/cnccodes-json-schema/draft/2022-07/schema", + "deta.space/assets/spacefile.schema.json", + "codemagic.io/codemagic-schema.json", + "wixplosives.github.io/codux-config-schema/codux.config.schema.json", + "openapi.vercel.sh/vercel.json", + "unpkg.com/@changesets/config/schema.json", + "getcomposer.org/schema.json", + "on.cypress.io/cypress.schema.json", + "gitlab.com/sbenv/veroxis/docker-seq/-/raw/HEAD/docker-seq.schema.json", + "dprint.dev/schemas/v0.json", + "dstack-runner-downloads.s3.eu-west-1.amazonaws.com/latest/schemas/configuration.json", + "enterprisecontract.dev/enterprise-contract-controller/schema/policy_spec.json", + "cdn.jsdelivr.net/gh/tarampampam/error-pages@latest/schemas/config/1.0.schema.json", + "gitlab.com/sbenv/veroxis/ezd-rs/-/raw/HEAD/ezd.schema.json", + "gitlab.com/fdroid/fdroiddata/-/raw/master/schemas/metadata.json", + "ffizer.github.io/ffizer/ffizer.schema.json", + "gitlab.cern.ch/steam/fiqus/-/raw/master/docs/schema.json", + "gitlab.com/gitlab-org/gitlab/-/raw/master/app/assets/javascripts/editor/schema/ci.json", + "gitpod.io/schemas/gitpod-schema.json", + "golangci-lint.run/jsonschema", + "goreleaser.com/static", + "github.com/goss-org/goss/raw/master/docs/schema.yaml", + "unpkg.com/@graphql-mesh/types/esm/config-schema.json", + "unpkg.com/graphql-config/config-schema.json", + "www.graphql-code-generator.com/config.schema.json", + "hazelcast.com/schema/config/hazelcast-config-5.5.json", + "html-validate.org/schemas/config.json", + "hyperfoil.io/schema.json", + "ifstate.net/schema/1/ifstate.conf.schema.json", + "schema.infrahub.app/python-sdk/repository-config/latest.json", + "jenkins-x.io/schemas", + "github.com/abstracta/jmeter-java-dsl/releases/latest/download/jmdsl-config-schema.json", + "jsr.io/schema/config-file.v1.json", + "jsonapi.org/schema", + "www.krakend.io/schema/krakend.json", + "kubri.dev/schema.json", + "cdn.jsdelivr.net/npm/liblab@latest/liblab.config.schema.json", + "w3id.org/linkml/meta.schema.json", + "grnhse-vpc-assets.s3.amazonaws.com/jsonschemas/lotus.yaml.json", + "github.com/napari/npe2/releases/latest/download/schema.json", + "noxorg.dev/schemas/NoxConfiguration.json", + "spec.openapis.org/oas/3.1/schema/2022-10-07", + "meta.open-rpc.org/", + "github.com/usnistgov/OSCAL", + "schema.postman.com/collection/json/v2.1.0/draft-07/collection.json", + "www.qgoda.net/schemas/qgoda.json", + "docs.renovatebot.com/renovate-schema.json", + "cdn.jsdelivr.net/gh/roadrunner-server/roadrunner@latest/schemas/config/3.0.schema.json", + "cdn.sdf.com/schemas/sdf-schema-1.3.json", + "starship.rs/config-schema.json", + "schemas.wp.org/trunk/theme.json", + "turborepo.org/schema.json", + "static.trunk.io/pub/trunk-yaml-schema.json", + "developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json", + "tstyche.org/schemas/config.json", + "cdn.jsdelivr.net/npm/tsup/schema.json", + "sap.github.io/ui5-tooling/schema", + "github.com/go-vela/types/releases/latest/download/schema.json", + "www.unpkg.com/wrangler/config-schema.json", + "json-stat.org/format/schema/2.0/", + "typedoc.org/schema.json", + "mise.jdx.dev/schema/mise.json", + "motif.land/api/motif.schema.json", + "github.com/helmwave/helmwave/releases/latest/download/schema.json", + "github.com/fbecart/zinoma/releases/latest/download/zinoma-schema.json", + "uniswap.org/tokenlist.schema.json", + "docs.gradle.com/enterprise/admin/schema/gradle-enterprise-config-schema-10.json", + "docs.gradle.com/build-cache-node/schema/build-cache-node-config-schema-5.json", + "yarnpkg.com/configuration/yarnrc.json", + "taskfile.dev/schema.json", + "render.com/schema/render.yaml.json", + "www.liquibase.org/json/schema/liquibase-flow-file-latest.json", + "github.com/mason-org/registry-schema/releases/latest/download/package.schema.json", + "s3.eu-central-1.amazonaws.com/files.netin.io/spider-schemas/template.schema.json", + "noodl.s3.us-west-1.amazonaws.com/noodl.schema.json", + "download.stackhawk.com/hawk/jsonschema/hawkconfig.json", + "www.updatecli.io/schema", + "geojson.org/schema/GeoJSON.json", + "public.dhe.ibm.com", + "datahubproject.io/schemas/datahub_ingestion_schema.json", + "upliftci.dev/static/schema.json", + "github.com/DannyBen/completely/blob/master/schemas/completely.json", + "docs.visivo.io/assets/visivo_schema.json", + "enduricastorage.blob.core.windows.net/public/endurica-cl-schema.json", + "rivet.gg/rivet.schema.json", + "cdn.subsquid.io/schemas/squid_manifest.json", + "gitlab.com/gitlab-org/cluster-integration/gitlab-agent/-/raw/master/pkg/agentcfg/agentcfg_schemas/ConfigurationFile.json", + "www.cardgamesimulator.com/schema/CardGameDef.json", + "alec016.github.io/Custom-Machinery", + "bioimage-io.github.io/spec-bioimage-io/bioimageio_schema_latest.json", + "www.json-wf.org.uk/json-wf-schema-1.0.json", + "download.qt.io/official_releases/qtcreator/latest/installer_source/jsonschemas/project.json", + "api.app-prg1.zerops.io", + "repo1.maven.org/maven2/com/walmartlabs/concord/runtime/v2/concord-runtime-model-v2/2.14.0/concord-runtime-model-v2-2.14.0-schema.json", + "deployments.allegrogroup.com/tycho/schema", + "www.eidolonai.com/json_schema/v1/resources/overview.json", + "waku.ngjx.org/static/schema.json" ) + private val WITHOUT_PROTOCOL_REGEX = Regex("https?://") + @JvmStatic fun isAvailableUrl(url: String): Boolean { - if (isLocalFile(url) - || urls.startWith(url) + if (urls.startWith(url) || jsonSchemaUrls.startWith(url) || OpenIdePersistentUrlStorage.getInstance().getUrls().startWith(url)) { return true @@ -218,11 +218,9 @@ object WhiteListUrls { } private fun List.startWith(url: String): Boolean { - return this.any { url.startsWith(it, true) } - } - - private fun isLocalFile(url: String): Boolean { - return url.startsWith("file") + if (url.startsWith("file")) return true + val urlWithoutProtocol = url.replaceFirst(WITHOUT_PROTOCOL_REGEX, "") + return this.any { urlWithoutProtocol.startsWith(it, true) } } }