├── .gitattributes ├── packages ├── typings │ ├── tsconfig.json │ ├── prettier.config.js │ └── src │ │ └── index.d.ts ├── web-api │ ├── .funcignore │ ├── .vscode │ │ ├── extensions.json │ │ ├── settings.json │ │ └── launch.json │ ├── tsconfig.json │ ├── host.json │ ├── local.settings.json │ ├── src │ │ ├── test-utilities │ │ │ └── mockable-logger.ts │ │ └── web-api-types.ts │ ├── prettier.config.js │ ├── package-func.json │ ├── jest.config.js │ ├── get-scan-func │ │ └── index.ts │ ├── post-scans-func │ │ └── index.ts │ ├── get-report-func │ │ └── index.ts │ ├── get-scans-batch-func │ │ └── index.ts │ └── check-health-func │ │ └── index.ts ├── e2e-web-apis │ ├── .funcignore │ ├── tsconfig.json │ ├── host.json │ ├── local.settings.json │ ├── prettier.config.js │ ├── package-func.json │ ├── jest.config.js │ ├── scan-notification-client-func │ │ └── index.ts │ └── scan-notification-client-func-fail │ │ └── index.ts ├── web-workers │ ├── .funcignore │ ├── .vscode │ │ ├── extensions.json │ │ ├── settings.json │ │ └── launch.json │ ├── tsconfig.json │ ├── src │ │ ├── contracts │ │ │ ├── function-timer.ts │ │ │ └── activity-actions.ts │ │ ├── orchestration │ │ │ ├── orchestration-name.ts │ │ │ └── orchestration-telemetry-properties.ts │ │ ├── test-utilities │ │ │ ├── mockable-logger.ts │ │ │ └── generator-function.ts │ │ ├── controllers │ │ │ └── web-api-config.ts │ │ ├── e2e-test-group-names.ts │ │ └── e2e-test-scenarios │ │ │ ├── get-test-identifiers.ts │ │ │ └── create-scenarios.ts │ ├── prettier.config.js │ ├── package-func.json │ ├── local.settings.json │ ├── jest.config.js │ └── host.json ├── resource-deployment │ ├── templates │ │ ├── vmss-health-extension.json │ │ ├── cosmos-db.parameters.json │ │ ├── cosmos-db-rw-role.json │ │ └── batch-account-custom-role.json │ ├── runtime-config │ │ ├── runtime-config.ci.json │ │ ├── runtime-config.ppe.json │ │ ├── runtime-config.ppe-eu.json │ │ ├── runtime-config.prod.json │ │ ├── runtime-config.prod-eu.json │ │ └── runtime-config.dev.json │ ├── .vscode │ │ ├── settings.json │ │ └── launch.json │ ├── scripts │ │ ├── docker-scanner-image │ │ │ ├── .dockerignore │ │ │ ├── Dockerfile.scanner │ │ │ └── enable-virtual-display.ps1 │ │ ├── pool-startup │ │ │ └── custom-pool-post-startup.ps1 │ │ └── delete-all-private-links.sh │ └── custom-scripts │ │ └── resource-deployment │ │ └── templates │ │ ├── web-api-aad-acl-dev.json │ │ ├── web-api-aad-acl-ppe.json │ │ └── web-api-aad-acl-prod.json ├── cli │ ├── .gitignore │ ├── tsconfig.json │ ├── src │ │ ├── service-name.ts │ │ ├── report │ │ │ ├── report-formats.ts │ │ │ └── report-name-generator.ts │ │ ├── ioc-types.ts │ │ ├── runner │ │ │ └── command-runner.ts │ │ ├── scan-result-providers │ │ │ └── scan-result-reader.ts │ │ ├── axe │ │ │ ├── axe-info.ts │ │ │ └── axe-info.spec.ts │ │ ├── converter │ │ │ ├── scan-result-data.ts │ │ │ └── ai-data-converter.ts │ │ ├── setup-cli-container.spec.ts │ │ ├── setup-cli-container.ts │ │ ├── index.ts │ │ └── baseline │ │ │ └── baseline-file-formatter.ts │ ├── tsconfig.sdk.json │ ├── prettier.config.js │ └── jest.config.js ├── crawler │ ├── tsconfig.json │ ├── prettier.config.js │ ├── browser-imports.js │ ├── jest.config.js │ ├── src │ │ ├── page-operations │ │ │ └── operation.ts │ │ ├── authenticator │ │ │ ├── authentication-method.ts │ │ │ ├── authenticator.ts │ │ │ └── authenticator-factory.ts │ │ ├── crawler │ │ │ ├── crawler-engine.ts │ │ │ └── crawler-factory.ts │ │ ├── types │ │ │ ├── ioc-types.ts │ │ │ └── scan-data.ts │ │ ├── apify │ │ │ ├── discovery-patterns.ts │ │ │ └── discovery-patterns.spec.ts │ │ ├── utility │ │ │ ├── crypto.ts │ │ │ └── crypto.spec.ts │ │ ├── test-utilities │ │ │ └── promisable-mock.ts │ │ ├── common │ │ │ ├── url.ts │ │ │ ├── hash-generator.ts │ │ │ └── jump-consistent-hash.ts │ │ ├── storage │ │ │ ├── store-types.ts │ │ │ └── local-data-store.ts │ │ ├── page-scanners │ │ │ └── page-scanner.ts │ │ ├── crawler.ts │ │ ├── build-utilities │ │ │ └── monorepo-packages.ts │ │ ├── index.ts │ │ └── page-handler │ │ │ └── page-timeout-config.ts │ ├── README.md │ ├── rollup.config.mjs │ └── .vscode │ │ └── tasks.json ├── logger │ ├── tsconfig.json │ ├── prettier.config.js │ ├── jest.config.js │ ├── src │ │ ├── logger-types.ts │ │ ├── global-logger.ts │ │ ├── context-aware-logger.ts │ │ ├── console-logger-client.ts │ │ └── index.ts │ └── .vscode │ │ └── tasks.json ├── health-client │ ├── tsconfig.json │ ├── prettier.config.js │ ├── jest.config.js │ ├── .vscode │ │ └── tasks.json │ └── package-ext.json ├── axe-core-scanner │ ├── tsconfig.json │ ├── prettier.config.js │ ├── src │ │ ├── axe-core-scanner-ioc-types.ts │ │ ├── index.ts │ │ └── register-axe-core-scanner-to-container.ts │ └── jest.config.js ├── azure-services │ ├── tsconfig.json │ ├── src │ │ ├── test-utilities │ │ │ ├── mockable-logger.ts │ │ │ └── promisable-mock.ts │ │ ├── azure-cosmos │ │ │ ├── cosmos-document.ts │ │ │ └── cosmos-operation-response.ts │ │ ├── credentials │ │ │ └── service-principal-credential.ts │ │ ├── azure-queue │ │ │ ├── message.ts │ │ │ └── storage-config.ts │ │ ├── storage │ │ │ └── retry-options.ts │ │ ├── app-insights-api-client │ │ │ ├── events-query-response.ts │ │ │ ├── events-query-options.ts │ │ │ └── query-response.ts │ │ ├── key-vault │ │ │ ├── secret-names.ts │ │ │ └── secret-provider.ts │ │ └── azure-batch │ │ │ └── batch-config.ts │ ├── prettier.config.js │ └── jest.config.js ├── e2e-test-site │ └── site-content │ │ ├── img1.png │ │ ├── unlinked │ │ ├── other.html │ │ └── index.html │ │ ├── linked2 │ │ └── index.html │ │ └── linked1 │ │ ├── inner-page.html │ │ └── index.html ├── functional-tests │ ├── tsconfig.json │ ├── prettier.config.js │ ├── src │ │ ├── test-context-data.ts │ │ ├── test-groups │ │ │ └── finalizer-test-group.ts │ │ └── index.ts │ └── jest.config.js ├── privacy-scan-core │ ├── tsconfig.json │ ├── prettier.config.js │ ├── jest.config.js │ └── src │ │ ├── privacy-results.ts │ │ ├── index.ts │ │ └── test-utilities │ │ └── promisable-mock.ts ├── service-library │ ├── tsconfig.json │ ├── src │ │ ├── global.d.ts │ │ ├── web-api │ │ │ ├── api-contracts │ │ │ │ ├── scan-batch-request.ts │ │ │ │ ├── scan-run-response.ts │ │ │ │ └── health-report.ts │ │ │ ├── web-api-ioc-types.ts │ │ │ ├── web-http-response.spec.ts │ │ │ └── web-http-response.ts │ │ ├── test-utilities │ │ │ ├── mockable-logger.ts │ │ │ └── promisable-mock.ts │ │ ├── data-providers │ │ │ └── operation-result.ts │ │ ├── runner-scan-metadata.ts │ │ ├── crawler │ │ │ ├── crawler-configuration.ts │ │ │ ├── discovery-pattern-factory.ts │ │ │ └── crawler-configuration.spec.ts │ │ └── factories │ │ │ └── partition-key-factory.ts │ ├── prettier.config.js │ ├── jest.config.js │ └── .vscode │ │ └── tasks.json ├── storage-documents │ ├── tsconfig.json │ ├── prettier.config.js │ ├── src │ │ ├── on-demand-scan-request-message.ts │ │ ├── combined-scan-results.ts │ │ ├── partition-key.ts │ │ ├── on-demand-notification-request-message.ts │ │ ├── item-type.ts │ │ ├── batch-pool-load-snapshot.ts │ │ └── index.ts │ ├── jest.config.js │ └── .vscode │ │ └── tasks.json ├── web-api-client │ ├── tsconfig.json │ ├── src │ │ ├── test-utilities │ │ │ └── mockable-logger.ts │ │ ├── a11y-service-client-types.ts │ │ ├── index.ts │ │ └── request-options.ts │ ├── prettier.config.js │ └── jest.config.js ├── axe-result-converter │ ├── tsconfig.json │ ├── prettier.config.js │ ├── jest.config.js │ └── src │ │ ├── index.ts │ │ └── scan-result-data.ts ├── privacy-scan-runner │ ├── tsconfig.json │ ├── docker-image-config │ │ ├── .dockerignore │ │ ├── privacy-scan-runner.ps1 │ │ └── Dockerfile │ ├── src │ │ ├── test-utilities │ │ │ └── mockable-logger.ts │ │ ├── types │ │ │ └── privacy-scan-metadata.ts │ │ ├── setup-privacy-scan-runner-container.spec.ts │ │ ├── index.ts │ │ ├── setup-privacy-scan-runner-container.ts │ │ ├── scan-metadata-config.ts │ │ └── privacy-scan-runner-entry-point.ts │ ├── prettier.config.js │ ├── jest.config.js │ ├── run-in-terminal.ps1 │ ├── run-in-docker-container.cmd │ └── .vscode │ │ └── launch.json ├── report-generator-runner │ ├── tsconfig.json │ ├── docker-image-config │ │ ├── .dockerignore │ │ ├── report-generator-runner.ps1 │ │ └── Dockerfile │ ├── src │ │ ├── test-utilities │ │ │ └── mockable-logger.ts │ │ ├── types │ │ │ └── report-generator-metadata.ts │ │ ├── setup-report-generator-runner-container.spec.ts │ │ ├── index.ts │ │ ├── setup-report-generator-runner-container.ts │ │ └── report-generator-runner-entry-point.ts │ ├── prettier.config.js │ ├── jest.config.js │ ├── run-in-docker-container.cmd │ └── .vscode │ │ └── tasks.json ├── scanner-global-library │ ├── tsconfig.json │ ├── src │ │ ├── test-utilities │ │ │ ├── mockable-logger.ts │ │ │ └── promisable-mock.ts │ │ ├── ioc-types.ts │ │ ├── browser-error.ts │ │ ├── network │ │ │ └── page-event-handler.ts │ │ ├── privacy-scanner │ │ │ └── privacy-scan-result.ts │ │ ├── setup-scanner-container.ts │ │ └── authenticator │ │ │ └── login-page-client-factory.ts │ ├── prettier.config.js │ ├── README.md │ ├── jest.config.js │ └── blank-page.html ├── web-api-scan-runner │ ├── tsconfig.json │ ├── docker-image-config │ │ ├── .dockerignore │ │ └── Dockerfile.debug │ ├── src │ │ ├── test-utilities │ │ │ ├── mockable-logger.ts │ │ │ └── promisable-mock.ts │ │ ├── report-generator │ │ │ ├── html-report-strings.ts │ │ │ ├── axe-result-converter.ts │ │ │ ├── axe-result-snapshot-converter.ts │ │ │ └── axe-result-screenshot-converter.ts │ │ ├── ioc-types.ts │ │ ├── index.ts │ │ ├── runner-scan-metadata-config.ts │ │ └── web-api-scan-runner-entry-point.ts │ ├── prettier.config.js │ ├── jest.config.js │ └── run-in-terminal.ps1 ├── privacy-scan-job-manager │ ├── tsconfig.json │ ├── docker-image-config │ │ ├── .dockerignore │ │ ├── privacy-scan-job-manager.ps1 │ │ └── Dockerfile │ ├── src │ │ ├── test-utilities │ │ │ ├── mockable-logger.ts │ │ │ └── promisable-mock.ts │ │ ├── index.ts │ │ └── privacy-scan-job-manager-entry-point.ts │ ├── prettier.config.js │ ├── jest.config.js │ ├── run-in-docker-container.cmd │ └── .vscode │ │ └── tasks.json ├── report-generator-job-manager │ ├── tsconfig.json │ ├── docker-image-config │ │ ├── .dockerignore │ │ ├── report-generator-job-manager.ps1 │ │ └── Dockerfile │ ├── src │ │ ├── test-utilities │ │ │ ├── mockable-logger.ts │ │ │ └── promisable-mock.ts │ │ └── index.ts │ ├── prettier.config.js │ ├── jest.config.js │ ├── run-in-docker-container.cmd │ └── .vscode │ │ └── tasks.json ├── web-api-scan-job-manager │ ├── tsconfig.json │ ├── docker-image-config │ │ ├── .dockerignore │ │ ├── web-api-scan-job-manager.ps1 │ │ └── Dockerfile │ ├── src │ │ ├── test-utilities │ │ │ ├── mockable-logger.ts │ │ │ └── promisable-mock.ts │ │ ├── index.ts │ │ └── web-api-scan-job-manager-entry-point.ts │ ├── prettier.config.js │ ├── jest.config.js │ ├── run-in-docker-container.cmd │ └── .vscode │ │ └── tasks.json ├── web-api-scan-request-sender │ ├── tsconfig.json │ ├── docker-image-config │ │ ├── .dockerignore │ │ ├── web-api-scan-request-sender.ps1 │ │ └── Dockerfile │ ├── prettier.config.js │ ├── jest.config.js │ ├── run-in-docker-container.cmd │ ├── src │ │ ├── index.ts │ │ └── setup-web-api-scan-request-sender-container.ts │ └── .vscode │ │ └── tasks.json ├── web-api-send-notification-runner │ ├── tsconfig.json │ ├── docker-image-config │ │ ├── .dockerignore │ │ ├── web-api-send-notification-runner.ps1 │ │ └── Dockerfile │ ├── prettier.config.js │ ├── jest.config.js │ ├── src │ │ ├── types │ │ │ └── notification-sender-metadata.ts │ │ ├── index.ts │ │ ├── notification-sender-config.ts │ │ └── setup-web-api-notification-sender-container.ts │ ├── run-in-docker-container.cmd │ └── .vscode │ │ └── tasks.json ├── common │ ├── tsconfig.json │ ├── src │ │ ├── common-ioc-types.ts │ │ ├── web-requests │ │ │ ├── response-with-body-type.ts │ │ │ └── forever-agents.ts │ │ ├── body-parser.ts │ │ ├── test-utilities │ │ │ └── promisable-mock.ts │ │ ├── setup-runtime-config-container.ts │ │ ├── system │ │ │ ├── exponential-retry.ts │ │ │ └── environment-settings.ts │ │ └── ciphers │ │ │ └── jump-consistent-hash.ts │ ├── prettier.config.js │ ├── jest.config.js │ └── .vscode │ │ └── tasks.json ├── web-api-send-notification-job-manager │ ├── tsconfig.json │ ├── docker-image-config │ │ ├── .dockerignore │ │ ├── web-api-send-notification-job-manager.ps1 │ │ └── Dockerfile │ ├── src │ │ ├── test-utilities │ │ │ └── mockable-logger.ts │ │ └── index.ts │ ├── prettier.config.js │ ├── jest.config.js │ ├── run-in-docker-container.cmd │ └── .vscode │ │ └── tasks.json └── api-contracts │ └── README.md ├── .vscode ├── settings.json └── launch.json ├── copyright-header.txt ├── icons └── brand │ └── blue │ └── brand-blue-48px.png ├── .github ├── CODEOWNERS ├── ISSUE_TEMPLATE │ ├── general_question.md │ └── feature_request.md ├── workflows │ └── combine-dependabot-prs.yml └── pull_request_template.md ├── CodeQL.yml ├── jest.config.js ├── prettier.config.js ├── azure-pipeline ├── build-steps.yaml ├── install-dependencies-steps.yaml ├── TSAOptions.json └── test-steps.yaml ├── .shellcheckrc ├── .yarnrc.yml ├── CODE_OF_CONDUCT.md ├── patches └── inversify+6.0.1.patch ├── .syncpackrc.json ├── .gitignore ├── tsconfig.base.json ├── tools └── create-github-release-tag.sh └── .prettierignore /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf -------------------------------------------------------------------------------- /packages/typings/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json" 3 | } 4 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "azureFunctions.projectSubpath": "packages/web-api" 3 | } 4 | -------------------------------------------------------------------------------- /copyright-header.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) Microsoft Corporation. All rights reserved. 2 | Licensed under the MIT License. 3 | -------------------------------------------------------------------------------- /packages/web-api/.funcignore: -------------------------------------------------------------------------------- 1 | *.js.map 2 | *.ts 3 | .git* 4 | .vscode 5 | local.settings.json 6 | test 7 | tsconfig.json -------------------------------------------------------------------------------- /packages/e2e-web-apis/.funcignore: -------------------------------------------------------------------------------- 1 | *.js.map 2 | *.ts 3 | .git* 4 | .vscode 5 | local.settings.json 6 | test 7 | tsconfig.json -------------------------------------------------------------------------------- /packages/web-api/.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": ["ms-azuretools.vscode-azurefunctions"] 3 | } 4 | -------------------------------------------------------------------------------- /packages/web-workers/.funcignore: -------------------------------------------------------------------------------- 1 | *.js.map 2 | *.ts 3 | .git* 4 | .vscode 5 | local.settings.json 6 | test 7 | tsconfig.json -------------------------------------------------------------------------------- /packages/web-workers/.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": ["ms-azuretools.vscode-azurefunctions"] 3 | } 4 | -------------------------------------------------------------------------------- /packages/resource-deployment/templates/vmss-health-extension.json: -------------------------------------------------------------------------------- 1 | { 2 | "protocol": "tcp", 3 | "port": 135 4 | } 5 | -------------------------------------------------------------------------------- /icons/brand/blue/brand-blue-48px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/accessibility-insights-service/main/icons/brand/blue/brand-blue-48px.png -------------------------------------------------------------------------------- /packages/cli/.gitignore: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | **/*.html 5 | -------------------------------------------------------------------------------- /packages/crawler/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/logger/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/web-api/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # default owners for everything in the repository. 2 | * @microsoft/accessibility-insights-code-owners @microsoft/web-insights-code-owners 3 | -------------------------------------------------------------------------------- /packages/e2e-web-apis/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/health-client/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/web-workers/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/axe-core-scanner/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/azure-services/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/e2e-test-site/site-content/img1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/accessibility-insights-service/main/packages/e2e-test-site/site-content/img1.png -------------------------------------------------------------------------------- /packages/functional-tests/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/privacy-scan-core/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/service-library/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/storage-documents/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/web-api-client/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/axe-result-converter/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/privacy-scan-runner/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/report-generator-runner/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/resource-deployment/runtime-config/runtime-config.ci.json: -------------------------------------------------------------------------------- 1 | { 2 | "availabilityTestConfig": { 3 | "environmentDefinition": "canary" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /packages/resource-deployment/runtime-config/runtime-config.ppe.json: -------------------------------------------------------------------------------- 1 | { 2 | "availabilityTestConfig": { 3 | "environmentDefinition": "insider" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /packages/scanner-global-library/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/web-api-scan-runner/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/privacy-scan-job-manager/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/report-generator-job-manager/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/resource-deployment/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\wsl.exe", 3 | "shellcheck.useWSL": true 4 | } 5 | -------------------------------------------------------------------------------- /packages/resource-deployment/runtime-config/runtime-config.ppe-eu.json: -------------------------------------------------------------------------------- 1 | { 2 | "availabilityTestConfig": { 3 | "environmentDefinition": "insider" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /packages/resource-deployment/runtime-config/runtime-config.prod.json: -------------------------------------------------------------------------------- 1 | { 2 | "availabilityTestConfig": { 3 | "environmentDefinition": "production" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /packages/web-api-scan-job-manager/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/web-api-scan-request-sender/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/web-api-scan-runner/docker-image-config/.dockerignore: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | *.map 4 | -------------------------------------------------------------------------------- /packages/privacy-scan-job-manager/docker-image-config/.dockerignore: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | *.map 4 | -------------------------------------------------------------------------------- /packages/privacy-scan-runner/docker-image-config/.dockerignore: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | *.map 5 | -------------------------------------------------------------------------------- /packages/report-generator-job-manager/docker-image-config/.dockerignore: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | *.map 4 | -------------------------------------------------------------------------------- /packages/report-generator-runner/docker-image-config/.dockerignore: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | *.map 5 | -------------------------------------------------------------------------------- /packages/resource-deployment/runtime-config/runtime-config.prod-eu.json: -------------------------------------------------------------------------------- 1 | { 2 | "availabilityTestConfig": { 3 | "environmentDefinition": "production" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /packages/resource-deployment/scripts/docker-scanner-image/.dockerignore: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | *.map 4 | -------------------------------------------------------------------------------- /packages/web-api-scan-job-manager/docker-image-config/.dockerignore: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | *.map 4 | -------------------------------------------------------------------------------- /packages/web-api-scan-request-sender/docker-image-config/.dockerignore: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | *.map 4 | -------------------------------------------------------------------------------- /packages/web-api-send-notification-runner/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/cli/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "declaration": false, 5 | "outDir": "dist" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/common/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "target": "ES2020", 5 | "outDir": "dist" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/web-api-send-notification-job-manager/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/web-api-send-notification-runner/docker-image-config/.dockerignore: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | *.map 4 | -------------------------------------------------------------------------------- /CodeQL.yml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | path_classifiers: 5 | tests: 6 | - '.yarn/releases/*.cjs' 7 | -------------------------------------------------------------------------------- /packages/web-api-send-notification-job-manager/docker-image-config/.dockerignore: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | *.map 4 | -------------------------------------------------------------------------------- /packages/cli/src/service-name.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | export const serviceName = 'Accessibility Insights Service'; 5 | -------------------------------------------------------------------------------- /packages/web-api/host.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0", 3 | "extensionBundle": { 4 | "id": "Microsoft.Azure.Functions.ExtensionBundle", 5 | "version": "[4.*, 5.0.0)" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/e2e-web-apis/host.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0", 3 | "extensionBundle": { 4 | "id": "Microsoft.Azure.Functions.ExtensionBundle", 5 | "version": "[4.*, 5.0.0)" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/cli/src/report/report-formats.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | export declare type ReportFormats = 'html' | 'json' | 'txt' | 'log'; 5 | -------------------------------------------------------------------------------- /packages/cli/tsconfig.sdk.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "declaration": true, 5 | "outDir": "dist" 6 | }, 7 | "include": ["./src/index.ts"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/common/src/common-ioc-types.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | export const commonIocTypes = { 5 | Process: 'Process', 6 | }; 7 | -------------------------------------------------------------------------------- /packages/e2e-web-apis/local.settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "IsEncrypted": false, 3 | "Values": { 4 | "FUNCTIONS_WORKER_RUNTIME": "node", 5 | "AzureWebJobsStorage": "{AzureWebJobsStorage}" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/web-api/local.settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "IsEncrypted": false, 3 | "Values": { 4 | "FUNCTIONS_WORKER_RUNTIME": "node", 5 | "AzureWebJobsStorage__accountName": "{AccountName}" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/resource-deployment/custom-scripts/resource-deployment/templates/web-api-aad-acl-dev.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "WEBSITE_AUTH_AAD_ACL", 3 | "value": "{\"allowed_client_applications\":[\"client-id-placeholder\"]}" 4 | } 5 | -------------------------------------------------------------------------------- /packages/resource-deployment/custom-scripts/resource-deployment/templates/web-api-aad-acl-ppe.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "WEBSITE_AUTH_AAD_ACL", 3 | "value": "{\"allowed_client_applications\":[\"client-id-placeholder\"]}" 4 | } 5 | -------------------------------------------------------------------------------- /packages/resource-deployment/custom-scripts/resource-deployment/templates/web-api-aad-acl-prod.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "WEBSITE_AUTH_AAD_ACL", 3 | "value": "{\"allowed_client_applications\":[\"client-id-placeholder\"]}" 4 | } 5 | -------------------------------------------------------------------------------- /packages/web-workers/src/contracts/function-timer.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | export interface FunctionTimer { 5 | isPastDue: boolean; 6 | } 7 | -------------------------------------------------------------------------------- /packages/service-library/src/global.d.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | // eslint-disable-next-line import/no-unassigned-import 5 | import 'jest-extended'; 6 | -------------------------------------------------------------------------------- /packages/web-workers/src/orchestration/orchestration-name.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | export const orchestrationName = 'health-monitor-orchestrator'; 5 | -------------------------------------------------------------------------------- /packages/cli/src/ioc-types.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | export const iocTypes = { 5 | ReporterFactory: 'ReporterFactory', 6 | ajv: 'ajv', 7 | }; 8 | -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | module.exports = { 5 | preset: './jest.config.base.js', 6 | projects: ['/packages/*/jest.config.js'], 7 | }; 8 | -------------------------------------------------------------------------------- /packages/service-library/src/web-api/api-contracts/scan-batch-request.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | export interface ScanBatchRequest { 5 | scanId: string; 6 | } 7 | -------------------------------------------------------------------------------- /packages/web-api/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "azureFunctions.deploySubpath": ".", 3 | "azureFunctions.projectLanguage": "TypeScript", 4 | "azureFunctions.projectRuntime": "~4", 5 | "debug.internalConsoleOptions": "neverOpen" 6 | } 7 | -------------------------------------------------------------------------------- /packages/cli/prettier.config.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | const baseConfig = require('../../prettier.config'); 5 | 6 | module.exports = { 7 | ...baseConfig, 8 | }; 9 | -------------------------------------------------------------------------------- /packages/common/prettier.config.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | const baseConfig = require('../../prettier.config'); 5 | 6 | module.exports = { 7 | ...baseConfig, 8 | }; 9 | -------------------------------------------------------------------------------- /packages/logger/prettier.config.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | const baseConfig = require('../../prettier.config'); 5 | 6 | module.exports = { 7 | ...baseConfig, 8 | }; 9 | -------------------------------------------------------------------------------- /packages/typings/prettier.config.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | const baseConfig = require('../../prettier.config'); 4 | 5 | module.exports = { 6 | ...baseConfig, 7 | }; 8 | -------------------------------------------------------------------------------- /packages/web-api/src/test-utilities/mockable-logger.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { Logger } from 'logger'; 5 | 6 | export class MockableLogger extends Logger {} 7 | -------------------------------------------------------------------------------- /packages/web-workers/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "azureFunctions.deploySubpath": ".", 3 | "azureFunctions.projectLanguage": "TypeScript", 4 | "azureFunctions.projectRuntime": "~4", 5 | "debug.internalConsoleOptions": "neverOpen" 6 | } 7 | -------------------------------------------------------------------------------- /packages/azure-services/src/test-utilities/mockable-logger.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { Logger } from 'logger'; 5 | 6 | export class MockableLogger extends Logger {} 7 | -------------------------------------------------------------------------------- /packages/crawler/prettier.config.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | const baseConfig = require('../../prettier.config'); 5 | 6 | module.exports = { 7 | ...baseConfig, 8 | }; 9 | -------------------------------------------------------------------------------- /packages/service-library/src/test-utilities/mockable-logger.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { Logger } from 'logger'; 5 | 6 | export class MockableLogger extends Logger {} 7 | -------------------------------------------------------------------------------- /packages/web-api-client/src/test-utilities/mockable-logger.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { Logger } from 'logger'; 5 | 6 | export class MockableLogger extends Logger {} 7 | -------------------------------------------------------------------------------- /packages/web-api/prettier.config.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | const baseConfig = require('../../prettier.config'); 5 | 6 | module.exports = { 7 | ...baseConfig, 8 | }; 9 | -------------------------------------------------------------------------------- /packages/web-workers/prettier.config.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | const baseConfig = require('../../prettier.config'); 5 | 6 | module.exports = { 7 | ...baseConfig, 8 | }; 9 | -------------------------------------------------------------------------------- /packages/web-workers/src/test-utilities/mockable-logger.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { Logger } from 'logger'; 5 | 6 | export class MockableLogger extends Logger {} 7 | -------------------------------------------------------------------------------- /packages/axe-core-scanner/prettier.config.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | const baseConfig = require('../../prettier.config'); 5 | 6 | module.exports = { 7 | ...baseConfig, 8 | }; 9 | -------------------------------------------------------------------------------- /packages/azure-services/prettier.config.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | const baseConfig = require('../../prettier.config'); 5 | 6 | module.exports = { 7 | ...baseConfig, 8 | }; 9 | -------------------------------------------------------------------------------- /packages/e2e-web-apis/prettier.config.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | const baseConfig = require('../../prettier.config'); 5 | 6 | module.exports = { 7 | ...baseConfig, 8 | }; 9 | -------------------------------------------------------------------------------- /packages/functional-tests/prettier.config.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | const baseConfig = require('../../prettier.config'); 5 | 6 | module.exports = { 7 | ...baseConfig, 8 | }; 9 | -------------------------------------------------------------------------------- /packages/health-client/prettier.config.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | const baseConfig = require('../../prettier.config'); 5 | 6 | module.exports = { 7 | ...baseConfig, 8 | }; 9 | -------------------------------------------------------------------------------- /packages/privacy-scan-runner/src/test-utilities/mockable-logger.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { Logger } from 'logger'; 5 | 6 | export class MockableLogger extends Logger {} 7 | -------------------------------------------------------------------------------- /packages/service-library/prettier.config.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | const baseConfig = require('../../prettier.config'); 5 | 6 | module.exports = { 7 | ...baseConfig, 8 | }; 9 | -------------------------------------------------------------------------------- /packages/service-library/src/data-providers/operation-result.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | export interface OperationResult { 5 | succeeded: boolean; 6 | result?: T; 7 | } 8 | -------------------------------------------------------------------------------- /packages/web-api-client/prettier.config.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | const baseConfig = require('../../prettier.config'); 5 | 6 | module.exports = { 7 | ...baseConfig, 8 | }; 9 | -------------------------------------------------------------------------------- /packages/web-api-scan-runner/src/test-utilities/mockable-logger.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { Logger } from 'logger'; 5 | 6 | export class MockableLogger extends Logger {} 7 | -------------------------------------------------------------------------------- /packages/axe-result-converter/prettier.config.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | const baseConfig = require('../../prettier.config'); 5 | 6 | module.exports = { 7 | ...baseConfig, 8 | }; 9 | -------------------------------------------------------------------------------- /packages/privacy-scan-core/prettier.config.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | const baseConfig = require('../../prettier.config'); 5 | 6 | module.exports = { 7 | ...baseConfig, 8 | }; 9 | -------------------------------------------------------------------------------- /packages/privacy-scan-job-manager/src/test-utilities/mockable-logger.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { Logger } from 'logger'; 5 | 6 | export class MockableLogger extends Logger {} 7 | -------------------------------------------------------------------------------- /packages/privacy-scan-runner/prettier.config.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | const baseConfig = require('../../prettier.config'); 5 | 6 | module.exports = { 7 | ...baseConfig, 8 | }; 9 | -------------------------------------------------------------------------------- /packages/report-generator-runner/src/test-utilities/mockable-logger.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { Logger } from 'logger'; 5 | 6 | export class MockableLogger extends Logger {} 7 | -------------------------------------------------------------------------------- /packages/scanner-global-library/src/test-utilities/mockable-logger.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { Logger } from 'logger'; 5 | 6 | export class MockableLogger extends Logger {} 7 | -------------------------------------------------------------------------------- /packages/storage-documents/prettier.config.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | const baseConfig = require('../../prettier.config'); 5 | 6 | module.exports = { 7 | ...baseConfig, 8 | }; 9 | -------------------------------------------------------------------------------- /packages/web-api-scan-job-manager/src/test-utilities/mockable-logger.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { Logger } from 'logger'; 5 | 6 | export class MockableLogger extends Logger {} 7 | -------------------------------------------------------------------------------- /packages/web-api-scan-runner/prettier.config.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | const baseConfig = require('../../prettier.config'); 5 | 6 | module.exports = { 7 | ...baseConfig, 8 | }; 9 | -------------------------------------------------------------------------------- /packages/privacy-scan-job-manager/prettier.config.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | const baseConfig = require('../../prettier.config'); 5 | 6 | module.exports = { 7 | ...baseConfig, 8 | }; 9 | -------------------------------------------------------------------------------- /packages/report-generator-job-manager/src/test-utilities/mockable-logger.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { Logger } from 'logger'; 5 | 6 | export class MockableLogger extends Logger {} 7 | -------------------------------------------------------------------------------- /packages/report-generator-runner/prettier.config.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | const baseConfig = require('../../prettier.config'); 5 | 6 | module.exports = { 7 | ...baseConfig, 8 | }; 9 | -------------------------------------------------------------------------------- /packages/scanner-global-library/prettier.config.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | const baseConfig = require('../../prettier.config'); 5 | 6 | module.exports = { 7 | ...baseConfig, 8 | }; 9 | -------------------------------------------------------------------------------- /packages/service-library/src/runner-scan-metadata.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | export interface RunnerScanMetadata { 5 | id: string; 6 | url: string; 7 | deepScan?: boolean; 8 | } 9 | -------------------------------------------------------------------------------- /packages/web-api-scan-job-manager/prettier.config.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | const baseConfig = require('../../prettier.config'); 5 | 6 | module.exports = { 7 | ...baseConfig, 8 | }; 9 | -------------------------------------------------------------------------------- /packages/web-api/package-func.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "web-api", 3 | "version": "1.0.0", 4 | "author": "Microsoft", 5 | "license": "MIT", 6 | "main": "**/index.js", 7 | "dependencies": { 8 | "@azure/functions": "4.*" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /packages/crawler/browser-imports.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | // Exports libraries for the browser binding 5 | import { finder } from '@medv/finder'; 6 | 7 | export { finder as getCssSelector }; 8 | -------------------------------------------------------------------------------- /packages/report-generator-job-manager/prettier.config.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | const baseConfig = require('../../prettier.config'); 5 | 6 | module.exports = { 7 | ...baseConfig, 8 | }; 9 | -------------------------------------------------------------------------------- /packages/web-api-scan-request-sender/prettier.config.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | const baseConfig = require('../../prettier.config'); 5 | 6 | module.exports = { 7 | ...baseConfig, 8 | }; 9 | -------------------------------------------------------------------------------- /packages/web-api-scan-runner/src/report-generator/html-report-strings.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | export const htmlReportStrings = { 5 | serviceName: 'Accessibility Insights Service', 6 | }; 7 | -------------------------------------------------------------------------------- /packages/web-workers/package-func.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "web-workers", 3 | "version": "1.0.0", 4 | "author": "Microsoft", 5 | "license": "MIT", 6 | "main": "**/index.js", 7 | "dependencies": { 8 | "@azure/functions": "4.*" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /packages/azure-services/src/azure-cosmos/cosmos-document.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | export interface CosmosDocument { 5 | id?: string; 6 | partitionKey?: string; 7 | _etag?: string; 8 | } 9 | -------------------------------------------------------------------------------- /packages/azure-services/src/credentials/service-principal-credential.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | export interface ServicePrincipalCredential { 5 | name: string; 6 | password: string; 7 | } 8 | -------------------------------------------------------------------------------- /packages/e2e-web-apis/package-func.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "e2e-web-apis", 3 | "version": "1.0.0", 4 | "author": "Microsoft", 5 | "license": "MIT", 6 | "main": "**/index.js", 7 | "dependencies": { 8 | "@azure/functions": "4.*" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /packages/web-api-send-notification-job-manager/src/test-utilities/mockable-logger.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { Logger } from 'logger'; 5 | 6 | export class MockableLogger extends Logger {} 7 | -------------------------------------------------------------------------------- /packages/web-api-send-notification-runner/prettier.config.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | const baseConfig = require('../../prettier.config'); 5 | 6 | module.exports = { 7 | ...baseConfig, 8 | }; 9 | -------------------------------------------------------------------------------- /packages/privacy-scan-runner/src/types/privacy-scan-metadata.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | export interface PrivacyScanMetadata { 5 | id: string; 6 | url: string; 7 | deepScan: boolean; 8 | } 9 | -------------------------------------------------------------------------------- /packages/web-api-send-notification-job-manager/prettier.config.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | const baseConfig = require('../../prettier.config'); 5 | 6 | module.exports = { 7 | ...baseConfig, 8 | }; 9 | -------------------------------------------------------------------------------- /packages/azure-services/src/azure-queue/message.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | export class Message { 5 | constructor(public messageText: string, public messageId: string, public popReceipt?: string) {} 6 | } 7 | -------------------------------------------------------------------------------- /packages/functional-tests/src/test-context-data.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | export interface TestContextData { 5 | scanUrl: string; 6 | scanId?: string; 7 | expectedCrawledUrls?: string[]; 8 | } 9 | -------------------------------------------------------------------------------- /packages/scanner-global-library/README.md: -------------------------------------------------------------------------------- 1 | 5 | 6 | The `scanner-global-library` package contains the common web page scanning logic used by both service and command line packages. 7 | -------------------------------------------------------------------------------- /packages/storage-documents/src/on-demand-scan-request-message.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | export interface OnDemandScanRequestMessage { 5 | id: string; 6 | url: string; 7 | deepScan?: boolean; 8 | } 9 | -------------------------------------------------------------------------------- /packages/web-workers/local.settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "IsEncrypted": false, 3 | "Values": { 4 | "FUNCTIONS_WORKER_RUNTIME": "node", 5 | "AzureWebJobsStorage__accountName": "{AccountName}", 6 | "COSMOS_CONNECTION__accountEndpoint": "{AccountEndpoint}" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /prettier.config.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | module.exports = { 5 | endOfLine: 'lf', 6 | printWidth: 140, 7 | singleQuote: true, 8 | tabWidth: 4, 9 | trailingComma: 'all', 10 | }; 11 | -------------------------------------------------------------------------------- /packages/axe-core-scanner/src/axe-core-scanner-ioc-types.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | export const axeScannerIocTypes = { 5 | AxeConfiguration: 'AxeConfiguration', 6 | AxeRunOptions: 'AxeRunOptions', 7 | }; 8 | -------------------------------------------------------------------------------- /packages/cli/jest.config.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | const package = require('./package'); 5 | 6 | module.exports = { 7 | preset: '../../jest.config.base.js', 8 | displayName: package.name, 9 | }; 10 | -------------------------------------------------------------------------------- /packages/common/jest.config.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | const package = require('./package'); 5 | 6 | module.exports = { 7 | preset: '../../jest.config.base.js', 8 | displayName: package.name, 9 | }; 10 | -------------------------------------------------------------------------------- /packages/crawler/jest.config.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | const package = require('./package'); 5 | 6 | module.exports = { 7 | preset: '../../jest.config.base.js', 8 | displayName: package.name, 9 | }; 10 | -------------------------------------------------------------------------------- /packages/logger/jest.config.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | const package = require('./package'); 5 | 6 | module.exports = { 7 | preset: '../../jest.config.base.js', 8 | displayName: package.name, 9 | }; 10 | -------------------------------------------------------------------------------- /packages/web-api/jest.config.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | const package = require('./package'); 5 | 6 | module.exports = { 7 | preset: '../../jest.config.base.js', 8 | displayName: package.name, 9 | }; 10 | -------------------------------------------------------------------------------- /packages/e2e-web-apis/jest.config.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | const package = require('./package'); 5 | 6 | module.exports = { 7 | preset: '../../jest.config.base.js', 8 | displayName: package.name, 9 | }; 10 | -------------------------------------------------------------------------------- /packages/health-client/jest.config.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | const package = require('./package'); 5 | 6 | module.exports = { 7 | preset: '../../jest.config.base.js', 8 | displayName: package.name, 9 | }; 10 | -------------------------------------------------------------------------------- /packages/web-workers/jest.config.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | const package = require('./package'); 5 | 6 | module.exports = { 7 | preset: '../../jest.config.base.js', 8 | displayName: package.name, 9 | }; 10 | -------------------------------------------------------------------------------- /packages/axe-core-scanner/jest.config.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | const package = require('./package'); 5 | 6 | module.exports = { 7 | preset: '../../jest.config.base.js', 8 | displayName: package.name, 9 | }; 10 | -------------------------------------------------------------------------------- /packages/azure-services/jest.config.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | const package = require('./package'); 5 | 6 | module.exports = { 7 | preset: '../../jest.config.base.js', 8 | displayName: package.name, 9 | }; 10 | -------------------------------------------------------------------------------- /packages/cli/src/runner/command-runner.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { ScanArguments } from '../scan-arguments'; 5 | 6 | export interface CommandRunner { 7 | runCommand(scanArguments: ScanArguments): Promise; 8 | } 9 | -------------------------------------------------------------------------------- /packages/functional-tests/jest.config.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | const package = require('./package'); 5 | 6 | module.exports = { 7 | preset: '../../jest.config.base.js', 8 | displayName: package.name, 9 | }; 10 | -------------------------------------------------------------------------------- /packages/privacy-scan-core/jest.config.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | const package = require('./package'); 5 | 6 | module.exports = { 7 | preset: '../../jest.config.base.js', 8 | displayName: package.name, 9 | }; 10 | -------------------------------------------------------------------------------- /packages/privacy-scan-core/src/privacy-results.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { PrivacyPageScanReport } from 'storage-documents'; 5 | 6 | export type PrivacyResults = Omit; 7 | -------------------------------------------------------------------------------- /packages/service-library/jest.config.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | const package = require('./package'); 5 | 6 | module.exports = { 7 | preset: '../../jest.config.base.js', 8 | displayName: package.name, 9 | }; 10 | -------------------------------------------------------------------------------- /packages/storage-documents/jest.config.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | const package = require('./package'); 5 | 6 | module.exports = { 7 | preset: '../../jest.config.base.js', 8 | displayName: package.name, 9 | }; 10 | -------------------------------------------------------------------------------- /packages/web-api-client/jest.config.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | const package = require('./package'); 5 | 6 | module.exports = { 7 | preset: '../../jest.config.base.js', 8 | displayName: package.name, 9 | }; 10 | -------------------------------------------------------------------------------- /packages/axe-result-converter/jest.config.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | const package = require('./package'); 5 | 6 | module.exports = { 7 | preset: '../../jest.config.base.js', 8 | displayName: package.name, 9 | }; 10 | -------------------------------------------------------------------------------- /packages/azure-services/src/storage/retry-options.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | export interface RetryOptions { 5 | timeoutMilliseconds: number; 6 | intervalMilliseconds: number; 7 | retryingOnStatusCodes: number[]; 8 | } 9 | -------------------------------------------------------------------------------- /packages/privacy-scan-runner/jest.config.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | const package = require('./package'); 5 | 6 | module.exports = { 7 | preset: '../../jest.config.base.js', 8 | displayName: package.name, 9 | }; 10 | -------------------------------------------------------------------------------- /packages/report-generator-runner/jest.config.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | const package = require('./package'); 5 | 6 | module.exports = { 7 | preset: '../../jest.config.base.js', 8 | displayName: package.name, 9 | }; 10 | -------------------------------------------------------------------------------- /packages/resource-deployment/scripts/pool-startup/custom-pool-post-startup.ps1: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | # Replace this file to execute custom script on pool startup. 5 | 6 | Write-Host "Executing custom pool startup placeholder script." 7 | -------------------------------------------------------------------------------- /packages/scanner-global-library/jest.config.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | const package = require('./package'); 5 | 6 | module.exports = { 7 | preset: '../../jest.config.base.js', 8 | displayName: package.name, 9 | }; 10 | -------------------------------------------------------------------------------- /packages/web-api-scan-runner/jest.config.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | const package = require('./package'); 5 | 6 | module.exports = { 7 | preset: '../../jest.config.base.js', 8 | displayName: package.name, 9 | }; 10 | -------------------------------------------------------------------------------- /packages/logger/src/logger-types.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | export const loggerTypes = { 5 | AppInsights: 'AppInsights', 6 | Process: 'Process', 7 | Console: 'Console', 8 | DotEnvConfig: 'DotEnvConfig', 9 | }; 10 | -------------------------------------------------------------------------------- /packages/privacy-scan-job-manager/jest.config.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | const package = require('./package'); 5 | 6 | module.exports = { 7 | preset: '../../jest.config.base.js', 8 | displayName: package.name, 9 | }; 10 | -------------------------------------------------------------------------------- /packages/report-generator-job-manager/jest.config.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | const package = require('./package'); 5 | 6 | module.exports = { 7 | preset: '../../jest.config.base.js', 8 | displayName: package.name, 9 | }; 10 | -------------------------------------------------------------------------------- /packages/web-api-scan-job-manager/jest.config.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | const package = require('./package'); 5 | 6 | module.exports = { 7 | preset: '../../jest.config.base.js', 8 | displayName: package.name, 9 | }; 10 | -------------------------------------------------------------------------------- /packages/web-api-scan-request-sender/jest.config.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | const package = require('./package'); 5 | 6 | module.exports = { 7 | preset: '../../jest.config.base.js', 8 | displayName: package.name, 9 | }; 10 | -------------------------------------------------------------------------------- /packages/crawler/src/page-operations/operation.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | export declare type OperationType = 'no-op' | 'click'; 5 | 6 | export interface Operation { 7 | operationType: OperationType; 8 | data: unknown; 9 | } 10 | -------------------------------------------------------------------------------- /packages/resource-deployment/templates/cosmos-db.parameters.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "tier": { 6 | "value": "Standard" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/web-api-send-notification-runner/jest.config.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | const package = require('./package'); 5 | 6 | module.exports = { 7 | preset: '../../jest.config.base.js', 8 | displayName: package.name, 9 | }; 10 | -------------------------------------------------------------------------------- /packages/web-api-send-notification-job-manager/jest.config.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | const package = require('./package'); 5 | 6 | module.exports = { 7 | preset: '../../jest.config.base.js', 8 | displayName: package.name, 9 | }; 10 | -------------------------------------------------------------------------------- /azure-pipeline/build-steps.yaml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | steps: 5 | - script: | 6 | yarn clean 7 | displayName: Clean 8 | 9 | - script: | 10 | yarn build --env version=$(Build.BuildId) 11 | displayName: Build 12 | -------------------------------------------------------------------------------- /packages/crawler/README.md: -------------------------------------------------------------------------------- 1 | 5 | 6 | The crawler package used by [AI-Scan CLI tool](https://www.npmjs.com/package/accessibility-insights-scan) 7 | 8 | This is a stand-alone package. Do NOT add dependencies to any service packages. 9 | -------------------------------------------------------------------------------- /packages/crawler/src/authenticator/authentication-method.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import * as Puppeteer from 'puppeteer'; 5 | export interface AuthenticationMethod { 6 | authenticate(page: Puppeteer.Page, attemptNumber?: number): Promise; 7 | } 8 | -------------------------------------------------------------------------------- /packages/crawler/src/crawler/crawler-engine.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { CrawlerRunOptions } from '../types/crawler-run-options'; 5 | 6 | export interface CrawlerEngine { 7 | start(crawlerRunOptions: CrawlerRunOptions): Promise; 8 | } 9 | -------------------------------------------------------------------------------- /packages/api-contracts/README.md: -------------------------------------------------------------------------------- 1 | 5 | 6 | # Accessibility Insights Service API 7 | 8 | The folder contains definition of Accessibility Insights Service REST API contracts conform to [OpenAPI specification](https://swagger.io/specification/). 9 | -------------------------------------------------------------------------------- /.shellcheckrc: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | source-path=./packages/resource-deployment/scripts/ 5 | 6 | enable=add-default-case 7 | enable=avoid-nullary-conditions 8 | enable=check-unassigned-uppercase 9 | enable=quote-safe-variables 10 | enable=require-variable-braces 11 | -------------------------------------------------------------------------------- /packages/storage-documents/src/combined-scan-results.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { AxeCoreResults, UrlCount } from 'axe-result-converter'; 5 | 6 | export interface CombinedScanResults { 7 | urlCount: UrlCount; 8 | axeResults: AxeCoreResults; 9 | } 10 | -------------------------------------------------------------------------------- /packages/azure-services/src/app-insights-api-client/events-query-response.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | export type ApplicationInsightsEventsResponse = { 5 | '@odata.context': string; 6 | // eslint-disable-next-line @typescript-eslint/no-explicit-any 7 | value: any[]; 8 | }; 9 | -------------------------------------------------------------------------------- /packages/common/src/web-requests/response-with-body-type.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { Response } from 'got'; 5 | 6 | // eslint-disable-next-line @typescript-eslint/ban-types 7 | export interface ResponseWithBodyType extends Response { 8 | body: T; 9 | } 10 | -------------------------------------------------------------------------------- /packages/storage-documents/src/partition-key.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | export enum PartitionKey { 5 | scanRunBatchRequests = 'scanRunBatchRequests', 6 | pageScanRequestDocuments = 'pageScanRequestDocuments', 7 | batchPoolLoadSnapshots = 'batchPoolLoadSnapshots', 8 | } 9 | -------------------------------------------------------------------------------- /packages/axe-result-converter/src/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | export * from './axe-result-types'; 5 | export * from './scan-result-data'; 6 | export { AxeResultsReducer } from './axe-results-reducer'; 7 | export { CombinedReportDataConverter } from './combined-report-data-converter'; 8 | -------------------------------------------------------------------------------- /packages/privacy-scan-core/src/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | export * from './privacy-results'; 5 | export { CookieCollector } from './cookie-collector'; 6 | export { PrivacyScannerCore } from './privacy-scanner-core'; 7 | export { PrivacyScenarioRunner } from './privacy-scenario-runner'; 8 | -------------------------------------------------------------------------------- /packages/report-generator-runner/src/types/report-generator-metadata.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { TargetReport } from 'storage-documents'; 5 | 6 | export interface ReportGeneratorMetadata { 7 | id: string; 8 | scanGroupId: string; 9 | targetReport: TargetReport; 10 | } 11 | -------------------------------------------------------------------------------- /packages/scanner-global-library/blank-page.html: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | blank page 10 | 11 | 12 |

blank page

13 | 14 | 15 | -------------------------------------------------------------------------------- /azure-pipeline/install-dependencies-steps.yaml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | steps: 5 | - task: NodeTool@0 6 | inputs: 7 | versionSpec: '20.x' 8 | displayName: Use node 20 9 | 10 | - script: | 11 | yarn install --immutable 12 | displayName: Install dependencies 13 | -------------------------------------------------------------------------------- /packages/logger/src/global-logger.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { Logger } from './logger'; 5 | import { LoggerClient } from './logger-client'; 6 | 7 | export class GlobalLogger extends Logger { 8 | constructor(loggerClients: LoggerClient[]) { 9 | super(loggerClients); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/service-library/src/web-api/web-api-ioc-types.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | // eslint-disable-next-line @typescript-eslint/no-explicit-any 5 | export type Newable = new (...args: any[]) => T; 6 | 7 | export const webApiIocTypes = { 8 | azureFunctionContext: 'azureFunctionContext', 9 | }; 10 | -------------------------------------------------------------------------------- /packages/web-api/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "Attach to web-api", 6 | "type": "node", 7 | "request": "attach", 8 | "preLaunchTask": "func-start", 9 | "resolveSourceMapLocations": ["${workspaceFolder}/../**/dist/**/*.js"] 10 | } 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /packages/axe-core-scanner/src/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | export * from './axe-configuration'; 5 | export { AxePuppeteerFactory } from './axe-puppeteer-factory'; 6 | export * from './axe-run-options'; 7 | export * from './axe-core-scanner-ioc-types'; 8 | export * from './register-axe-core-scanner-to-container'; 9 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/general_question.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: General Question 3 | about: Describe this issue template's purpose here. 4 | title: '[General Question]' 5 | labels: 'Question' 6 | assignees: '' 7 | 8 | --- 9 | 10 | 14 | -------------------------------------------------------------------------------- /packages/web-workers/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "Attach to web-workers", 6 | "type": "node", 7 | "request": "attach", 8 | "preLaunchTask": "func-start", 9 | "resolveSourceMapLocations": ["${workspaceFolder}/../**/dist/**/*.js"] 10 | } 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /packages/azure-services/src/azure-cosmos/cosmos-operation-response.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | /* eslint-disable @typescript-eslint/no-explicit-any */ 5 | 6 | export interface CosmosOperationResponse { 7 | item?: T; 8 | response?: any; 9 | statusCode: number; 10 | continuationToken?: string; 11 | } 12 | -------------------------------------------------------------------------------- /packages/logger/src/context-aware-logger.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { Logger } from './logger'; 5 | import { LoggerClient } from './logger-client'; 6 | 7 | export class ContextAwareLogger extends Logger { 8 | constructor(loggerClients: LoggerClient[]) { 9 | super(loggerClients); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/scanner-global-library/src/ioc-types.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | export const iocTypes = { 5 | AzureAuthClientCredentialProvider: 'azureAuthClientCredentialProvider', 6 | SecretVaultProvider: 'secretVaultProvider', 7 | }; 8 | 9 | export interface SecretVault { 10 | [key: string]: string; 11 | } 12 | -------------------------------------------------------------------------------- /packages/scanner-global-library/src/browser-error.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { ScanErrorTypes } from 'storage-documents'; 5 | 6 | export interface BrowserError { 7 | errorType: ScanErrorTypes; 8 | statusCode?: number; 9 | statusText?: string; 10 | message: string; 11 | stack?: string; 12 | } 13 | -------------------------------------------------------------------------------- /.yarnrc.yml: -------------------------------------------------------------------------------- 1 | afterInstall: npx patch-package 2 | 3 | compressionLevel: mixed 4 | 5 | enableGlobalCache: false 6 | 7 | nodeLinker: node-modules 8 | 9 | plugins: 10 | - path: .yarn/plugins/@yarnpkg/plugin-after-install.cjs 11 | spec: 'https://raw.githubusercontent.com/mhassan1/yarn-plugin-after-install/v0.3.1/bundles/@yarnpkg/plugin-after-install.js' 12 | 13 | yarnPath: .yarn/releases/yarn-4.11.0.cjs 14 | -------------------------------------------------------------------------------- /packages/web-api-scan-runner/docker-image-config/Dockerfile.debug: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | # The image is available in the local registry only. 5 | FROM mcr.microsoft.com/windows/web-api-scan-runner:prescanner 6 | 7 | # Use "-nodeargs --inspect-brk=0.0.0.0" to enable debugging in the container. 8 | CMD ["powershell.exe", "./web-api-scan-runner.ps1"] 9 | -------------------------------------------------------------------------------- /packages/web-api-client/src/a11y-service-client-types.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { A11yServiceClient } from './a11y-service-client'; 5 | 6 | export const a11yServiceClientTypeNames = { 7 | A11yServiceClientProvider: 'A11yServiceClientProvider', 8 | }; 9 | 10 | export type A11yServiceClientProvider = () => Promise; 11 | -------------------------------------------------------------------------------- /packages/e2e-test-site/site-content/unlinked/other.html: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | Other page 8 | 9 | 10 |
11 |

Other page

12 | Back to unlinked page 13 |
14 | 15 | 16 | -------------------------------------------------------------------------------- /packages/resource-deployment/runtime-config/runtime-config.dev.json: -------------------------------------------------------------------------------- 1 | { 2 | "availabilityTestConfig": { 3 | "environmentDefinition": "dev" 4 | }, 5 | "scanConfig": { 6 | "maxFailedScanRetryCount": 0 7 | }, 8 | "taskConfig": { 9 | "taskTimeoutInMinutes": 15 10 | }, 11 | "crawlConfig": { 12 | "deepScanDiscoveryLimit": 10, 13 | "deepScanUpperLimit": 50 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/web-api/src/web-api-types.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { ApplicationInsightsClient } from 'azure-services'; 5 | 6 | export const webApiTypeNames = { 7 | ApplicationInsightsClientProvider: 'ApplicationInsightsClientProvider', 8 | }; 9 | 10 | export type ApplicationInsightsClientProvider = () => Promise; 11 | -------------------------------------------------------------------------------- /packages/cli/src/scan-result-providers/scan-result-reader.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { ScanResult, ScanMetadata } from 'accessibility-insights-crawler'; 5 | 6 | export interface ScanResultReader extends AsyncIterable { 7 | getScanMetadata(baseUrl: string): Promise; 8 | next(): Promise>; 9 | } 10 | -------------------------------------------------------------------------------- /packages/e2e-test-site/site-content/linked2/index.html: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | Linked page 2 8 | 9 | 10 |
11 |

Linked page without inner page

12 | Back to home 13 |
14 | 15 | 16 | -------------------------------------------------------------------------------- /packages/web-api-client/src/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | export { A11yServiceClient } from './a11y-service-client'; 5 | export { A11yServiceCredential } from './a11y-service-credential'; 6 | export { A11yServiceClientProvider, a11yServiceClientTypeNames } from './a11y-service-client-types'; 7 | export { PostScanRequestOptions, DeepScanOptions } from './request-options'; 8 | -------------------------------------------------------------------------------- /packages/web-api-scan-runner/src/ioc-types.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | export const iocTypeNames = { 5 | ReporterFactory: 'ReporterFactory', 6 | ConvertAxeToSarifFunc: 'ConvertAxeToSarifFunc', 7 | AxeResultConverters: 'AxeResultConverters', 8 | AgentResultConverters: 'AgentResultConverters', 9 | SecretVaultProvider: 'secretVaultProvider', 10 | }; 11 | -------------------------------------------------------------------------------- /packages/crawler/src/types/ioc-types.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | export const crawlerIocTypes = { 5 | ApifyRequestQueueFactory: 'ApifyRequestQueueFactory', 6 | CrawlerEngine: 'CrawlerEngine', 7 | CrawlerFactory: 'CrawlerFactory', 8 | LevelUp: 'LevelUp', 9 | PageProcessorFactory: 'PageProcessorFactory', 10 | ReporterFactory: 'ReporterFactory', 11 | }; 12 | -------------------------------------------------------------------------------- /packages/web-api-send-notification-runner/src/types/notification-sender-metadata.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { OnDemandPageScanRunState, ScanState } from 'storage-documents'; 5 | 6 | export interface NotificationSenderMetadata { 7 | scanId: string; 8 | scanNotifyUrl: string; 9 | runStatus: OnDemandPageScanRunState; 10 | scanStatus?: ScanState; 11 | } 12 | -------------------------------------------------------------------------------- /packages/report-generator-runner/docker-image-config/report-generator-runner.ps1: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | Write-Host "Adding network route for Azure Instance Metadata Service endpoint..." 5 | $gateway = (Get-NetRoute '0.0.0.0/0').NextHop 6 | $arguments = 'add', '169.254.169.0', 'mask', '255.255.255.0', $gateway 7 | route $arguments | Out-Null 8 | 9 | node ./report-generator-runner.js 10 | -------------------------------------------------------------------------------- /packages/service-library/src/web-api/api-contracts/scan-run-response.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { WebApiError } from '../web-api-error-codes'; 5 | 6 | /** 7 | * Defines the REST API response contract that is returned on HTTP POST scan request 8 | */ 9 | export interface ScanRunResponse { 10 | scanId?: string; 11 | url: string; 12 | error?: WebApiError; 13 | } 14 | -------------------------------------------------------------------------------- /packages/common/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | // See https://go.microsoft.com/fwlink/?LinkId=733558 3 | // for the documentation about the tasks.json format 4 | "version": "2.0.0", 5 | "tasks": [ 6 | { 7 | "label": "tsc", 8 | "command": "tsc", 9 | "isShellCommand": true, 10 | "showOutput": "silent", 11 | "args": [], 12 | "problemMatcher": ["$tsc"] 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /packages/logger/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | // See https://go.microsoft.com/fwlink/?LinkId=733558 3 | // for the documentation about the tasks.json format 4 | "version": "2.0.0", 5 | "tasks": [ 6 | { 7 | "label": "tsc", 8 | "command": "tsc", 9 | "isShellCommand": true, 10 | "showOutput": "silent", 11 | "args": [], 12 | "problemMatcher": ["$tsc"] 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /packages/privacy-scan-job-manager/docker-image-config/privacy-scan-job-manager.ps1: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | Write-Host "Adding network route for Azure Instance Metadata Service endpoint..." 5 | $gateway = (Get-NetRoute '0.0.0.0/0').NextHop 6 | $arguments = 'add', '169.254.169.0', 'mask', '255.255.255.0', $gateway 7 | route $arguments | Out-Null 8 | 9 | node ./privacy-scan-job-manager.js 10 | -------------------------------------------------------------------------------- /packages/service-library/src/crawler/crawler-configuration.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { injectable } from 'inversify'; 5 | 6 | @injectable() 7 | export class CrawlerConfiguration { 8 | public setApifySettings(workingDirectory: string): void { 9 | process.env.CRAWLEE_HEADLESS = '1'; 10 | process.env.CRAWLEE_STORAGE_DIR = workingDirectory; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/web-api-scan-job-manager/docker-image-config/web-api-scan-job-manager.ps1: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | Write-Host "Adding network route for Azure Instance Metadata Service endpoint..." 5 | $gateway = (Get-NetRoute '0.0.0.0/0').NextHop 6 | $arguments = 'add', '169.254.169.0', 'mask', '255.255.255.0', $gateway 7 | route $arguments | Out-Null 8 | 9 | node ./web-api-scan-job-manager.js 10 | -------------------------------------------------------------------------------- /packages/common/src/body-parser.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { Readable } from 'stream'; 5 | import getRawBody from 'raw-body'; 6 | import { injectable } from 'inversify'; 7 | 8 | @injectable() 9 | export class BodyParser { 10 | public async getRawBody(stream: Readable, options?: getRawBody.Options): Promise { 11 | return getRawBody(stream, options); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /packages/privacy-scan-runner/docker-image-config/privacy-scan-runner.ps1: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | Write-Host "Adding network route for Azure Instance Metadata Service endpoint..." 5 | $gateway = (Get-NetRoute '0.0.0.0/0').NextHop 6 | $arguments = 'add', '169.254.169.0', 'mask', '255.255.255.0', $gateway 7 | route $arguments | Out-Null 8 | 9 | node --max-old-space-size=8192 ./privacy-scan-runner.js 10 | -------------------------------------------------------------------------------- /packages/report-generator-job-manager/docker-image-config/report-generator-job-manager.ps1: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | Write-Host "Adding network route for Azure Instance Metadata Service endpoint..." 5 | $gateway = (Get-NetRoute '0.0.0.0/0').NextHop 6 | $arguments = 'add', '169.254.169.0', 'mask', '255.255.255.0', $gateway 7 | route $arguments | Out-Null 8 | 9 | node ./report-generator-job-manager.js 10 | -------------------------------------------------------------------------------- /packages/storage-documents/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | // See https://go.microsoft.com/fwlink/?LinkId=733558 3 | // for the documentation about the tasks.json format 4 | "version": "2.0.0", 5 | "tasks": [ 6 | { 7 | "label": "tsc", 8 | "command": "tsc", 9 | "isShellCommand": true, 10 | "showOutput": "silent", 11 | "args": [], 12 | "problemMatcher": ["$tsc"] 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /packages/web-api-scan-request-sender/docker-image-config/web-api-scan-request-sender.ps1: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | Write-Host "Adding network route for Azure Instance Metadata Service endpoint..." 5 | $gateway = (Get-NetRoute '0.0.0.0/0').NextHop 6 | $arguments = 'add', '169.254.169.0', 'mask', '255.255.255.0', $gateway 7 | route $arguments | Out-Null 8 | 9 | node ./web-api-scan-request-sender.js 10 | -------------------------------------------------------------------------------- /packages/azure-services/src/app-insights-api-client/events-query-options.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | export type EventsQueryOptions = { 5 | timespan?: string; 6 | $filter?: string; 7 | $search?: string; 8 | $orderby?: string; 9 | $select?: string; 10 | $skip?: string; 11 | $top?: string; 12 | $format?: string; 13 | $count?: string; 14 | $apply?: string; 15 | }; 16 | -------------------------------------------------------------------------------- /packages/crawler/rollup.config.mjs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import resolve from '@rollup/plugin-node-resolve'; 5 | import commonjs from '@rollup/plugin-commonjs'; 6 | 7 | export default { 8 | input: 'browser-imports.js', 9 | output: { 10 | file: 'dist/browser-imports.js', 11 | name: 'finder', 12 | format: 'iife', 13 | }, 14 | plugins: [resolve(), commonjs()], 15 | }; 16 | -------------------------------------------------------------------------------- /packages/crawler/src/apify/discovery-patterns.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import url from 'url'; 5 | 6 | export type DiscoveryPatternFactory = (pseudoUrl: string) => string; 7 | 8 | export const getDiscoveryPatternForUrl: DiscoveryPatternFactory = (pseudoUrl: string): string => { 9 | const urlObj = url.parse(pseudoUrl); 10 | 11 | return `http(s?)://${urlObj.host}${urlObj.pathname}(.*)`; 12 | }; 13 | -------------------------------------------------------------------------------- /packages/azure-services/src/app-insights-api-client/query-response.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | export type Column = { 5 | name: string; 6 | type: string; 7 | }; 8 | 9 | export type Row = string[]; 10 | 11 | export type Table = { 12 | name: string; 13 | columns: Column[]; 14 | rows: Row[]; 15 | }; 16 | 17 | export type ApplicationInsightsQueryResponse = { 18 | tables: Table[]; 19 | }; 20 | -------------------------------------------------------------------------------- /packages/storage-documents/src/on-demand-notification-request-message.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { OnDemandPageScanRunState, ScanState } from './on-demand-page-scan-result'; 5 | 6 | export interface OnDemandNotificationRequestMessage { 7 | scanId: string; 8 | scanNotifyUrl: string; 9 | runStatus: OnDemandPageScanRunState; 10 | scanStatus: ScanState; 11 | deepScanId?: string; 12 | } 13 | -------------------------------------------------------------------------------- /packages/web-api-send-notification-runner/docker-image-config/web-api-send-notification-runner.ps1: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | Write-Host "Adding network route for Azure Instance Metadata Service endpoint..." 5 | $gateway = (Get-NetRoute '0.0.0.0/0').NextHop 6 | $arguments = 'add', '169.254.169.0', 'mask', '255.255.255.0', $gateway 7 | route $arguments | Out-Null 8 | 9 | node ./web-api-send-notification-runner.js 10 | -------------------------------------------------------------------------------- /packages/storage-documents/src/item-type.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | export enum ItemType { 5 | batchPoolLoadSnapshot = 'batchPoolLoadSnapshot', 6 | scanRunBatchRequest = 'scanRunBatchRequest', 7 | onDemandPageScanRequest = 'pageScanRequest', 8 | onDemandPageScanRunResult = 'pageScanRunResult', 9 | websiteScanData = 'websiteScanData', 10 | reportGeneratorRequest = 'reportGeneratorRequest', 11 | } 12 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | 5 | 6 | ## Code of Conduct 7 | 8 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). 9 | 10 | For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or 11 | contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. 12 | -------------------------------------------------------------------------------- /packages/web-api-send-notification-job-manager/docker-image-config/web-api-send-notification-job-manager.ps1: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | Write-Host "Adding network route for Azure Instance Metadata Service endpoint..." 5 | $gateway = (Get-NetRoute '0.0.0.0/0').NextHop 6 | $arguments = 'add', '169.254.169.0', 'mask', '255.255.255.0', $gateway 7 | route $arguments | Out-Null 8 | 9 | node ./web-api-send-notification-job-manager.js 10 | -------------------------------------------------------------------------------- /packages/cli/src/axe/axe-info.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import 'reflect-metadata'; 5 | 6 | import * as Axe from 'axe-core'; 7 | import { inject, injectable, optional } from 'inversify'; 8 | 9 | @injectable() 10 | export class AxeInfo { 11 | constructor(@optional() @inject('Axe') private readonly axe: typeof Axe = Axe) {} 12 | 13 | public get version(): string { 14 | return this.axe.version; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/e2e-test-site/site-content/linked1/inner-page.html: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | Inner page 8 | 9 | 10 |
11 |

Inner page with issues

12 | Back to home 13 |

14 | 15 |
16 | 17 | 18 | -------------------------------------------------------------------------------- /packages/web-api-scan-runner/src/report-generator/axe-result-converter.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { ReportFormat, ReportSource } from 'storage-documents'; 5 | import { ReportResult } from 'scanner-global-library'; 6 | 7 | export interface AxeResultConverter { 8 | readonly targetReportFormat: ReportFormat; 9 | readonly targetReportSource: ReportSource[]; 10 | convert(reportResult: ReportResult): string; 11 | } 12 | -------------------------------------------------------------------------------- /patches/inversify+6.0.1.patch: -------------------------------------------------------------------------------- 1 | diff --git a/node_modules/inversify/lib/annotation/injectable.d.ts b/node_modules/inversify/lib/annotation/injectable.d.ts 2 | index bf2d4be..d679438 100644 3 | --- a/node_modules/inversify/lib/annotation/injectable.d.ts 4 | +++ b/node_modules/inversify/lib/annotation/injectable.d.ts 5 | @@ -1,2 +1,2 @@ 6 | -declare function injectable(): unknown>(target: T) => T; 7 | +declare function injectable(): (target: any) => any; 8 | export { injectable }; 9 | -------------------------------------------------------------------------------- /azure-pipeline/TSAOptions.json: -------------------------------------------------------------------------------- 1 | { 2 | "codebaseName": "accessibility-insights-service_main-2", 3 | "notificationAliases": ["a11y-services-dev@microsoft.com"], 4 | "codebaseAdmins": ["REDMOND\\a11y-services-dev"], 5 | "tsaEnvironment": "Prod", 6 | "instanceUrl": "https://mseng.visualstudio.com/", 7 | "template": "TFSPowerBI", 8 | "projectName": "1ES", 9 | "areaPath": "1ES\\Accessibility Insights", 10 | "iterationPath": "1ES", 11 | "tools": ["ARMory", "CredScan", "PoliCheck"] 12 | } 13 | -------------------------------------------------------------------------------- /packages/crawler/src/utility/crypto.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import SHA from 'sha.js'; 5 | 6 | export function generateHash(...values: string[]): string { 7 | const hashSeed: string = values.join('|').toLowerCase(); 8 | const sha: typeof SHA = SHA; 9 | 10 | return sha('sha256') 11 | .update(hashSeed) 12 | .digest('base64') 13 | .replace(/(\+|\/|=)/g, '') 14 | .substring(0, 15); 15 | } 16 | -------------------------------------------------------------------------------- /packages/e2e-test-site/site-content/linked1/index.html: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | Linked page 1 8 | 9 | 10 |
11 |

Linked page with inner page

12 |

Back to home

13 |

To inner page

14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /packages/logger/src/console-logger-client.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { injectable } from 'inversify'; 5 | import { BaseConsoleLoggerClient } from './base-console-logger-client'; 6 | import { LoggerProperties } from './logger-client'; 7 | 8 | @injectable() 9 | export class ConsoleLoggerClient extends BaseConsoleLoggerClient { 10 | protected getPropertiesToAddToEvent(): LoggerProperties { 11 | return {}; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /packages/privacy-scan-job-manager/run-in-docker-container.cmd: -------------------------------------------------------------------------------- 1 | rem Copyright (c) Microsoft Corporation. All rights reserved. 2 | rem Licensed under the MIT License. 3 | 4 | echo off 5 | 6 | rem The script builds and runs the docker image 7 | 8 | copy ..\resource-deployment\runtime-config\runtime-config.dev.json .\dist\runtime-config.json &&^ 9 | yarn build &&^ 10 | cd .\dist &&^ 11 | docker build --tag privacy-scan-job-manager . &&^ 12 | docker run --init --ipc=host --env-file .env privacy-scan-job-manager &&^ 13 | cd .. 14 | -------------------------------------------------------------------------------- /packages/report-generator-runner/run-in-docker-container.cmd: -------------------------------------------------------------------------------- 1 | rem Copyright (c) Microsoft Corporation. All rights reserved. 2 | rem Licensed under the MIT License. 3 | 4 | echo off 5 | 6 | rem The script builds and runs the docker image 7 | 8 | copy ..\resource-deployment\runtime-config\runtime-config.dev.json .\dist\runtime-config.json &&^ 9 | yarn build &&^ 10 | cd .\dist &&^ 11 | docker build --tag report-generator-runner . &&^ 12 | docker run --init --ipc=host --env-file .env report-generator-runner &&^ 13 | cd .. 14 | -------------------------------------------------------------------------------- /packages/web-api-client/src/request-options.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | export type PostScanRequestOptions = { 5 | priority?: number; 6 | scanNotificationUrl?: string; 7 | consolidatedId?: string; 8 | deepScan?: boolean; 9 | deepScanOptions?: DeepScanOptions; 10 | privacyScan?: boolean; 11 | }; 12 | 13 | export type DeepScanOptions = { 14 | knownPages?: string[]; 15 | discoveryPatterns?: string[]; 16 | }; 17 | -------------------------------------------------------------------------------- /packages/web-api-scan-job-manager/run-in-docker-container.cmd: -------------------------------------------------------------------------------- 1 | rem Copyright (c) Microsoft Corporation. All rights reserved. 2 | rem Licensed under the MIT License. 3 | 4 | echo off 5 | 6 | rem The script builds and runs the docker image 7 | 8 | copy ..\resource-deployment\runtime-config\runtime-config.dev.json .\dist\runtime-config.json &&^ 9 | yarn build &&^ 10 | cd .\dist &&^ 11 | docker build --tag web-api-scan-job-manager . &&^ 12 | docker run --init --ipc=host --env-file .env web-api-scan-job-manager &&^ 13 | cd .. 14 | -------------------------------------------------------------------------------- /packages/common/src/test-utilities/promisable-mock.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { IMock } from 'typemoq'; 5 | 6 | export function getPromisableDynamicMock(mock: IMock): IMock { 7 | // workaround for issue https://github.com/florinn/typemoq/issues/70 8 | 9 | // eslint-disable-next-line @typescript-eslint/no-explicit-any 10 | mock.setup((x: any) => x.then).returns(() => undefined); 11 | 12 | return mock; 13 | } 14 | -------------------------------------------------------------------------------- /packages/crawler/src/test-utilities/promisable-mock.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { IMock } from 'typemoq'; 5 | 6 | export function getPromisableDynamicMock(mock: IMock): IMock { 7 | // workaround for issue https://github.com/florinn/typemoq/issues/70 8 | 9 | // eslint-disable-next-line @typescript-eslint/no-explicit-any 10 | mock.setup((x: any) => x.then).returns(() => undefined); 11 | 12 | return mock; 13 | } 14 | -------------------------------------------------------------------------------- /packages/azure-services/src/test-utilities/promisable-mock.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { IMock } from 'typemoq'; 5 | 6 | export function getPromisableDynamicMock(mock: IMock): IMock { 7 | // workaround for issue https://github.com/florinn/typemoq/issues/70 8 | 9 | // eslint-disable-next-line @typescript-eslint/no-explicit-any 10 | mock.setup((x: any) => x.then).returns(() => undefined); 11 | 12 | return mock; 13 | } 14 | -------------------------------------------------------------------------------- /packages/e2e-test-site/site-content/unlinked/index.html: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | Test site 2 10 | 11 | 12 | 13 |

Unlinked page

14 | 15 |

This page is not connected to the home page by any link.

16 |

To other page

17 | 18 | 19 | -------------------------------------------------------------------------------- /packages/service-library/src/test-utilities/promisable-mock.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { IMock } from 'typemoq'; 5 | 6 | export function getPromisableDynamicMock(mock: IMock): IMock { 7 | // workaround for issue https://github.com/florinn/typemoq/issues/70 8 | 9 | // eslint-disable-next-line @typescript-eslint/no-explicit-any 10 | mock.setup((x: any) => x.then).returns(() => undefined); 11 | 12 | return mock; 13 | } 14 | -------------------------------------------------------------------------------- /packages/web-api-scan-request-sender/run-in-docker-container.cmd: -------------------------------------------------------------------------------- 1 | rem Copyright (c) Microsoft Corporation. All rights reserved. 2 | rem Licensed under the MIT License. 3 | 4 | echo off 5 | 6 | rem The script builds and runs the docker image 7 | 8 | copy ..\resource-deployment\runtime-config\runtime-config.dev.json .\dist\runtime-config.json &&^ 9 | yarn build &&^ 10 | cd .\dist &&^ 11 | docker build --tag web-api-scan-request-sender . &&^ 12 | docker run --init --ipc=host --env-file .env web-api-scan-request-sender &&^ 13 | cd .. 14 | -------------------------------------------------------------------------------- /packages/privacy-scan-core/src/test-utilities/promisable-mock.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { IMock } from 'typemoq'; 5 | 6 | export function getPromisableDynamicMock(mock: IMock): IMock { 7 | // workaround for issue https://github.com/florinn/typemoq/issues/70 8 | 9 | // eslint-disable-next-line @typescript-eslint/no-explicit-any 10 | mock.setup((x: any) => x.then).returns(() => undefined); 11 | 12 | return mock; 13 | } 14 | -------------------------------------------------------------------------------- /packages/report-generator-job-manager/run-in-docker-container.cmd: -------------------------------------------------------------------------------- 1 | rem Copyright (c) Microsoft Corporation. All rights reserved. 2 | rem Licensed under the MIT License. 3 | 4 | echo off 5 | 6 | rem The script builds and runs the docker image 7 | 8 | copy ..\resource-deployment\runtime-config\runtime-config.dev.json .\dist\runtime-config.json &&^ 9 | yarn build &&^ 10 | cd .\dist &&^ 11 | docker build --tag report-generator-job-manager . &&^ 12 | docker run --init --ipc=host --env-file .env report-generator-job-manager &&^ 13 | cd .. 14 | -------------------------------------------------------------------------------- /packages/web-api-scan-runner/src/test-utilities/promisable-mock.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { IMock } from 'typemoq'; 5 | 6 | export function getPromisableDynamicMock(mock: IMock): IMock { 7 | // workaround for issue https://github.com/florinn/typemoq/issues/70 8 | 9 | // eslint-disable-next-line @typescript-eslint/no-explicit-any 10 | mock.setup((x: any) => x.then).returns(() => undefined); 11 | 12 | return mock; 13 | } 14 | -------------------------------------------------------------------------------- /packages/web-workers/host.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0", 3 | "functionTimeout": "00:10:00", 4 | "extensionBundle": { 5 | "id": "Microsoft.Azure.Functions.ExtensionBundle", 6 | "version": "[4.*, 5.0.0)" 7 | }, 8 | "logging": { 9 | "applicationInsights": { 10 | "samplingSettings": { 11 | "isEnabled": true, 12 | "maxTelemetryItemsPerSecond": 20, 13 | "excludedTypes": "Request;Exception" 14 | } 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /packages/common/src/web-requests/forever-agents.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import * as http from 'http'; 5 | import * as https from 'https'; 6 | import { Agents } from 'got'; 7 | 8 | export function getForeverAgents(HttpAgent: typeof http.Agent = http.Agent, HttpsAgent: typeof https.Agent = https.Agent): Agents { 9 | return { 10 | http: new HttpAgent({ keepAlive: true }), 11 | https: new HttpsAgent({ keepAlive: true }), 12 | }; 13 | } 14 | -------------------------------------------------------------------------------- /packages/privacy-scan-job-manager/src/test-utilities/promisable-mock.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { IMock } from 'typemoq'; 5 | 6 | export function getPromisableDynamicMock(mock: IMock): IMock { 7 | // workaround for issue https://github.com/florinn/typemoq/issues/70 8 | 9 | // eslint-disable-next-line @typescript-eslint/no-explicit-any 10 | mock.setup((x: any) => x.then).returns(() => undefined); 11 | 12 | return mock; 13 | } 14 | -------------------------------------------------------------------------------- /packages/resource-deployment/templates/cosmos-db-rw-role.json: -------------------------------------------------------------------------------- 1 | { 2 | "RoleName": "CosmosDocumentRW", 3 | "Type": "CustomRole", 4 | "AssignableScopes": ["/"], 5 | "Permissions": [ 6 | { 7 | "DataActions": [ 8 | "Microsoft.DocumentDB/databaseAccounts/readMetadata", 9 | "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/*", 10 | "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/items/*" 11 | ] 12 | } 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /packages/scanner-global-library/src/test-utilities/promisable-mock.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { IMock } from 'typemoq'; 5 | 6 | export function getPromisableDynamicMock(mock: IMock): IMock { 7 | // workaround for issue https://github.com/florinn/typemoq/issues/70 8 | 9 | // eslint-disable-next-line @typescript-eslint/no-explicit-any 10 | mock.setup((x: any) => x.then).returns(() => undefined); 11 | 12 | return mock; 13 | } 14 | -------------------------------------------------------------------------------- /packages/web-api-scan-job-manager/src/test-utilities/promisable-mock.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { IMock } from 'typemoq'; 5 | 6 | export function getPromisableDynamicMock(mock: IMock): IMock { 7 | // workaround for issue https://github.com/florinn/typemoq/issues/70 8 | 9 | // eslint-disable-next-line @typescript-eslint/no-explicit-any 10 | mock.setup((x: any) => x.then).returns(() => undefined); 11 | 12 | return mock; 13 | } 14 | -------------------------------------------------------------------------------- /packages/azure-services/src/azure-queue/storage-config.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { injectable } from 'inversify'; 5 | 6 | @injectable() 7 | export class StorageConfig { 8 | public readonly scanQueue: string = process.env.AI_STORAGE_SCAN_QUEUE; 9 | 10 | public readonly privacyScanQueue: string = process.env.AI_STORAGE_PRIVACY_SCAN_QUEUE; 11 | 12 | public readonly notificationQueue: string = process.env.AI_STORAGE_NOTIFICATION_QUEUE; 13 | } 14 | -------------------------------------------------------------------------------- /packages/report-generator-job-manager/src/test-utilities/promisable-mock.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { IMock } from 'typemoq'; 5 | 6 | export function getPromisableDynamicMock(mock: IMock): IMock { 7 | // workaround for issue https://github.com/florinn/typemoq/issues/70 8 | 9 | // eslint-disable-next-line @typescript-eslint/no-explicit-any 10 | mock.setup((x: any) => x.then).returns(() => undefined); 11 | 12 | return mock; 13 | } 14 | -------------------------------------------------------------------------------- /packages/web-api-send-notification-runner/run-in-docker-container.cmd: -------------------------------------------------------------------------------- 1 | rem Copyright (c) Microsoft Corporation. All rights reserved. 2 | rem Licensed under the MIT License. 3 | 4 | echo off 5 | 6 | rem The script builds and runs the docker image 7 | 8 | copy ..\resource-deployment\runtime-config\runtime-config.dev.json .\dist\runtime-config.json &&^ 9 | yarn build &&^ 10 | cd .\dist &&^ 11 | docker build --tag web-api-send-notification-runner . &&^ 12 | docker run --init --ipc=host --env-file .env web-api-send-notification-runner &&^ 13 | cd .. 14 | -------------------------------------------------------------------------------- /.syncpackrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "dev": true, 3 | "filter": ".", 4 | "indent": " ", 5 | "overrides": true, 6 | "peer": true, 7 | "prod": true, 8 | "resolutions": true, 9 | "workspace": false, 10 | "semverGroups": [], 11 | "semverRange": "", 12 | "sortAz": ["contributors", "dependencies", "devDependencies", "keywords", "peerDependencies", "scripts"], 13 | "sortFirst": ["name", "description", "version", "author"], 14 | "source": ["package.json", "packages/*/package.json"], 15 | "versionGroups": [] 16 | } 17 | -------------------------------------------------------------------------------- /packages/web-workers/src/controllers/web-api-config.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | /* 5 | Contains config values which are set through environment variables. 6 | This should only be constructed in HealthMonitorControllerFunc 7 | so orchestration results are deterministic on retry. 8 | */ 9 | export class WebApiConfig { 10 | public readonly baseUrl: string = process.env.WEB_API_BASE_URL; 11 | 12 | public readonly releaseId: string = process.env.RELEASE_VERSION; 13 | } 14 | -------------------------------------------------------------------------------- /packages/crawler/src/types/scan-data.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | export interface ScanData { 5 | id: string; 6 | url: string; 7 | issueCount: number; 8 | succeeded: boolean; 9 | activatedElement?: { 10 | html: string; 11 | selector: string; 12 | hash: string; 13 | clickAction: string; 14 | navigationUrl?: string; 15 | }; 16 | context?: unknown; 17 | error?: string; 18 | requestErrors?: string[]; 19 | } 20 | -------------------------------------------------------------------------------- /packages/web-api-send-notification-job-manager/run-in-docker-container.cmd: -------------------------------------------------------------------------------- 1 | rem Copyright (c) Microsoft Corporation. All rights reserved. 2 | rem Licensed under the MIT License. 3 | 4 | echo off 5 | 6 | rem The script builds and runs the docker image 7 | 8 | copy ..\resource-deployment\runtime-config\runtime-config.dev.json .\dist\runtime-config.json &&^ 9 | yarn build &&^ 10 | cd .\dist &&^ 11 | docker build --tag web-api-send-notification-job-manager . &&^ 12 | docker run --init --ipc=host --env-file .env web-api-send-notification-job-manager &&^ 13 | cd .. 14 | -------------------------------------------------------------------------------- /packages/web-workers/src/orchestration/orchestration-telemetry-properties.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | export interface OrchestrationTelemetryProperties { 5 | requestResponse?: string; 6 | instanceId?: string; 7 | isReplaying?: string; 8 | currentUtcDateTime?: string; 9 | totalWaitTimeInSeconds?: string; 10 | activityName?: string; 11 | failureMessage?: string; 12 | waitEndTime?: string; 13 | waitStartTime?: string; 14 | scanId?: string; 15 | } 16 | -------------------------------------------------------------------------------- /packages/azure-services/src/key-vault/secret-names.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | export const secretNames = { 5 | cosmosDbUrl: 'cosmosDbUrl', 6 | storageAccountName: 'storageAccountName', 7 | webApiIdentityClientId: 'webApiIdentityClientId', 8 | azureAuthClientName: 'azureAuthClientName', 9 | azureAuthClientPassword: 'azureAuthClientPassword', 10 | webScannerBypassKey: 'webScannerBypassKey', 11 | appInsightsConnectionString: 'appInsightsConnectionString', 12 | }; 13 | -------------------------------------------------------------------------------- /packages/cli/src/converter/scan-result-data.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | export interface UrlCount { 5 | total: number; 6 | failed: number; 7 | passed: number; 8 | } 9 | 10 | export interface ScanResultData { 11 | baseUrl: string; 12 | basePageTitle: string; 13 | scanEngineName: string; 14 | axeCoreVersion: string; 15 | browserUserAgent: string; 16 | urlCount: UrlCount; 17 | scanStarted: Date; 18 | scanEnded: Date; 19 | browserResolution: string; 20 | } 21 | -------------------------------------------------------------------------------- /packages/axe-result-converter/src/scan-result-data.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | export interface UrlCount { 5 | total: number; 6 | failed: number; 7 | passed: number; 8 | } 9 | 10 | export interface ScanResultData { 11 | baseUrl: string; 12 | basePageTitle: string; 13 | scanEngineName: string; 14 | axeCoreVersion: string; 15 | browserUserAgent: string; 16 | urlCount: UrlCount; 17 | scanStarted: Date; 18 | scanEnded: Date; 19 | browserResolution: string; 20 | } 21 | -------------------------------------------------------------------------------- /packages/cli/src/setup-cli-container.spec.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import 'reflect-metadata'; 5 | 6 | import { Crawler } from 'accessibility-insights-crawler'; 7 | import { setupCliContainer } from './setup-cli-container'; 8 | 9 | describe(setupCliContainer, () => { 10 | it('resolves dependencies', () => { 11 | const container = setupCliContainer(); 12 | expect(container.get('ReporterFactory')).toBeDefined(); 13 | expect(container.get(Crawler)).toBeDefined(); 14 | }); 15 | }); 16 | -------------------------------------------------------------------------------- /packages/privacy-scan-runner/run-in-terminal.ps1: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | $variables = Select-String -Path './.env' -Pattern '^\s*[^\s=#]+=[^\s]+$' | Select-Object -ExpandProperty Line 5 | 6 | foreach($var in $variables) { 7 | $keyVal = $var -split '=', 2 8 | $key = $keyVal[0].Trim() 9 | $val = $keyVal[1] 10 | [Environment]::SetEnvironmentVariable($key, $val) 11 | Write-Host "$key=$([Environment]::GetEnvironmentVariable($key))" 12 | } 13 | 14 | node --max-old-space-size=8192 ./privacy-scan-runner.js 15 | -------------------------------------------------------------------------------- /packages/web-api-scan-runner/run-in-terminal.ps1: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | $variables = Select-String -Path './.env' -Pattern '^\s*[^\s=#]+=[^\s]+$' | Select-Object -ExpandProperty Line 5 | 6 | foreach ($var in $variables) { 7 | $keyVal = $var -split '=', 2 8 | $key = $keyVal[0].Trim() 9 | $val = $keyVal[1] 10 | [Environment]::SetEnvironmentVariable($key, $val) 11 | Write-Host "$key=$([Environment]::GetEnvironmentVariable($key))" 12 | } 13 | 14 | node --max-old-space-size=8192 ./web-api-scan-runner.js 15 | -------------------------------------------------------------------------------- /packages/web-workers/src/e2e-test-group-names.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { TestGroupName } from 'functional-tests'; 5 | 6 | export type E2ETestGroupNames = { 7 | [key in 8 | | 'postScanSubmissionTests' 9 | | 'postScanCompletionTests' 10 | | 'scanReportTests' 11 | | 'postScanCompletionNotificationTests' 12 | | 'postDeepScanCompletionTests' 13 | | 'finalizerTests']: TestGroupName[]; 14 | }; 15 | 16 | export const finalizerTestGroupName: TestGroupName = 'Finalizer'; 17 | -------------------------------------------------------------------------------- /packages/common/src/setup-runtime-config-container.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { Container } from 'inversify'; 5 | import { ServiceConfiguration } from './configuration/service-configuration'; 6 | import { GuidGenerator } from './system/guid-generator'; 7 | 8 | export function setupRuntimeConfigContainer(container: Container): void { 9 | container.bind(ServiceConfiguration).toSelf().inSingletonScope(); 10 | 11 | container.bind(GuidGenerator).toSelf().inSingletonScope(); 12 | } 13 | -------------------------------------------------------------------------------- /packages/privacy-scan-runner/src/setup-privacy-scan-runner-container.spec.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import 'reflect-metadata'; 5 | 6 | import { Runner } from './runner/runner'; 7 | import { setupPrivacyScanRunnerContainer } from './setup-privacy-scan-runner-container'; 8 | 9 | describe(setupPrivacyScanRunnerContainer, () => { 10 | it('resolves runner dependencies', () => { 11 | const container = setupPrivacyScanRunnerContainer(); 12 | 13 | expect(container.get(Runner)).toBeDefined(); 14 | }); 15 | }); 16 | -------------------------------------------------------------------------------- /packages/crawler/src/utility/crypto.spec.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { generateHash } from './crypto'; 5 | 6 | describe(generateHash, () => { 7 | it('ensure hash generation consistency', () => { 8 | const actualHash1 = generateHash('key1', 'key2', 'key3'); 9 | const actualHash2 = generateHash('Key1', 'Key2', 'Key3'); 10 | 11 | const expectedHash = '0ZuOUfdmWxzU08K'; 12 | 13 | expect(expectedHash).toEqual(actualHash1); 14 | expect(expectedHash).toEqual(actualHash2); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /packages/scanner-global-library/src/network/page-event-handler.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import * as Puppeteer from 'puppeteer'; 5 | 6 | /* eslint-disable @typescript-eslint/no-explicit-any */ 7 | 8 | export declare type PageEventHandler = (interceptedRequest: InterceptedRequest) => Promise; 9 | 10 | export interface InterceptedRequest { 11 | url: string; 12 | request: Puppeteer.HTTPRequest; 13 | response?: Puppeteer.HTTPResponse; 14 | interceptionId?: string; 15 | error?: string; 16 | data?: any; 17 | } 18 | -------------------------------------------------------------------------------- /packages/web-workers/src/contracts/activity-actions.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | export enum ActivityAction { 5 | createScanRequest = 'createScanRequest', 6 | getScanResult = 'getScanResult', 7 | getScanResultBatch = 'getScanResultBatch', 8 | getScanReport = 'getScanReport', 9 | getHealthStatus = 'getHealthStatus', 10 | trackAvailability = 'trackAvailability', 11 | runFunctionalTestGroup = 'runFunctionalTestGroup', 12 | logTestRunStart = 'logTestRunStart', 13 | getWebApiConfig = 'getWebApiConfig', 14 | } 15 | -------------------------------------------------------------------------------- /packages/crawler/src/authenticator/authenticator.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import * as Puppeteer from 'puppeteer'; 5 | import { AuthenticationMethod } from './authentication-method'; 6 | 7 | export class Authenticator { 8 | public constructor(protected authenticationMethod: AuthenticationMethod) {} 9 | 10 | public async run(browser: Puppeteer.Browser): Promise { 11 | const page = await browser.newPage(); 12 | await this.authenticationMethod.authenticate(page); 13 | await page.close(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/privacy-scan-runner/src/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import 'reflect-metadata'; 5 | 6 | import { System } from 'common'; 7 | import { setupPrivacyScanRunnerContainer } from './setup-privacy-scan-runner-container'; 8 | import { PrivacyScanRunnerEntryPoint } from './privacy-scan-runner-entry-point'; 9 | 10 | (async () => { 11 | await new PrivacyScanRunnerEntryPoint(setupPrivacyScanRunnerContainer()).start(); 12 | })().catch((error) => { 13 | console.log(System.serializeError(error)); 14 | process.exitCode = 1; 15 | }); 16 | -------------------------------------------------------------------------------- /packages/resource-deployment/scripts/docker-scanner-image/Dockerfile.scanner: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | # The image is available in the local registry only. 5 | FROM mcr.microsoft.com/windows/prescanner 6 | 7 | ARG BUILD_KEY= 8 | ARG INSTALLATION_TYPE= 9 | 10 | ENV USER_KEY=$BUILD_KEY 11 | 12 | COPY install-font-packages.ps1 . 13 | COPY add-font-resources.ps1 . 14 | COPY enable-virtual-display.ps1 . 15 | 16 | RUN powershell .\install-font-packages.ps1 17 | RUN powershell .\add-font-resources.ps1 18 | RUN powershell .\enable-virtual-display.ps1 19 | -------------------------------------------------------------------------------- /packages/e2e-web-apis/scan-notification-client-func/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { app, HttpRequest, HttpResponseInit, InvocationContext } from '@azure/functions'; 5 | 6 | export async function requestHandler(request: HttpRequest, context: InvocationContext): Promise { 7 | return { 8 | status: 200, 9 | }; 10 | } 11 | 12 | app.http('scan-notification-pass', { 13 | methods: ['POST'], 14 | authLevel: 'anonymous', 15 | handler: requestHandler, 16 | route: 'scan-notification-pass', 17 | }); 18 | -------------------------------------------------------------------------------- /packages/logger/src/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | export { Logger, LogLevel } from './logger'; 5 | export { GlobalLogger } from './global-logger'; 6 | export { ContextAwareLogger } from './context-aware-logger'; 7 | export { loggerTypes } from './logger-types'; 8 | export { registerLoggerToContainer } from './register-logger-to-container'; 9 | export * from './logger-event-measurements'; 10 | export { ConsoleLoggerClient } from './console-logger-client'; 11 | export { LoggerEvent } from './logger-event'; 12 | export * from './logger-client'; 13 | -------------------------------------------------------------------------------- /.github/workflows/combine-dependabot-prs.yml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | name: "Combine Dependabot PRs" 5 | on: 6 | workflow_dispatch: 7 | 8 | jobs: 9 | combine-prs: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/checkout@v2.3.3 13 | - uses: maadhattah/combine-dependabot-prs@main 14 | with: 15 | branchPrefix: "dependabot" 16 | mustBeGreen: true 17 | combineBranchName: "combined-prs" 18 | ignoreLabel: "nocombine" 19 | baseBranch: "main" 20 | openPR: true 21 | -------------------------------------------------------------------------------- /packages/e2e-web-apis/scan-notification-client-func-fail/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { app, HttpRequest, HttpResponseInit, InvocationContext } from '@azure/functions'; 5 | 6 | export async function requestHandler(request: HttpRequest, context: InvocationContext): Promise { 7 | return { 8 | status: 500, 9 | }; 10 | } 11 | 12 | app.http('scan-notification-fail', { 13 | methods: ['POST'], 14 | authLevel: 'anonymous', 15 | handler: requestHandler, 16 | route: 'scan-notification-fail', 17 | }); 18 | -------------------------------------------------------------------------------- /packages/report-generator-runner/src/setup-report-generator-runner-container.spec.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import 'reflect-metadata'; 5 | 6 | import { Runner } from './runner/runner'; 7 | import { setupReportGeneratorRunnerContainer } from './setup-report-generator-runner-container'; 8 | 9 | describe(setupReportGeneratorRunnerContainer, () => { 10 | it('resolves runner dependencies', () => { 11 | const container = setupReportGeneratorRunnerContainer(); 12 | 13 | expect(container.get(Runner)).toBeDefined(); 14 | }); 15 | }); 16 | -------------------------------------------------------------------------------- /packages/resource-deployment/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "type": "bashdb", 9 | "request": "launch", 10 | "name": "Bash-Debug (current script)", 11 | "cwd": "${workspaceFolder}", 12 | "program": "${file}", 13 | "terminalKind": "integrated", 14 | "args": [] 15 | } 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /packages/crawler/src/crawler/crawler-factory.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import * as Crawlee from '@crawlee/puppeteer'; 5 | import { injectable } from 'inversify'; 6 | 7 | @injectable() 8 | export class CrawlerFactory { 9 | public createPuppeteerCrawler(options: Crawlee.PuppeteerCrawlerOptions): Crawlee.PuppeteerCrawler { 10 | return new Crawlee.PuppeteerCrawler(options); 11 | } 12 | 13 | public createBasicCrawler(options: Crawlee.BasicCrawlerOptions): Crawlee.BasicCrawler { 14 | return new Crawlee.BasicCrawler(options); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/typings/src/index.d.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | // This is a temporary workaround to fix a missing type definition for 5 | // fingerprint-generator, which is a transitive dependency through 6 | // Apify. The release of fingerprint-generator v2 will include its own 7 | // typings, so this package can be removed once Apify updates its 8 | // dependency. 9 | declare module 'fingerprint-generator' { 10 | // eslint-disable-next-line @typescript-eslint/no-extraneous-class 11 | class FingerprintGenerator {} 12 | 13 | export = FingerprintGenerator; 14 | } 15 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | node_modules/ 5 | node_modules* 6 | .yarn/* 7 | !.yarn/patches 8 | !.yarn/plugins 9 | !.yarn/releases 10 | !.yarn/sdks 11 | !.yarn/versions 12 | 13 | chrome-user-data/ 14 | dist/ 15 | dist* 16 | drop/ 17 | test-results/ 18 | out/ 19 | a11y_agent/ 20 | crawler_storage* 21 | undefined* 22 | /data* 23 | ai_scan_cli_output* 24 | codecov 25 | codecov.* 26 | 27 | **/.secrets 28 | **/dev.DockerFile 29 | **/.env 30 | **/.prod 31 | **/*.generated.template.json 32 | **/*.DS_Store 33 | **/bin 34 | **/obj 35 | **/coverage 36 | 37 | yarn-error.log 38 | -------------------------------------------------------------------------------- /packages/cli/src/axe/axe-info.spec.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { AxeInfo } from './axe-info'; 5 | 6 | const VERSION = 'axe.core.version'; 7 | 8 | describe(AxeInfo, () => { 9 | const axe = { version: VERSION }; 10 | // eslint-disable-next-line @typescript-eslint/no-explicit-any 11 | const axeInfo = new AxeInfo(axe as any); 12 | 13 | it('has a default', () => { 14 | expect(axeInfo).not.toBe(undefined); 15 | }); 16 | 17 | it('returns correct version', () => { 18 | expect(axeInfo.version).toBe(VERSION); 19 | }); 20 | }); 21 | -------------------------------------------------------------------------------- /packages/report-generator-runner/src/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import 'reflect-metadata'; 5 | 6 | import { System } from 'common'; 7 | import { setupReportGeneratorRunnerContainer } from './setup-report-generator-runner-container'; 8 | import { ReportGeneratorRunnerEntryPoint } from './report-generator-runner-entry-point'; 9 | 10 | (async () => { 11 | await new ReportGeneratorRunnerEntryPoint(setupReportGeneratorRunnerContainer()).start(); 12 | })().catch((error) => { 13 | console.log(System.serializeError(error)); 14 | process.exitCode = 1; 15 | }); 16 | -------------------------------------------------------------------------------- /packages/web-workers/src/test-utilities/generator-function.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | export function* generatorStub( 5 | callback: () => void = () => null, 6 | returnValue?: ReturnType, 7 | ): Generator { 8 | yield undefined; 9 | callback(); 10 | 11 | return returnValue; 12 | } 13 | 14 | export function* errorGeneratorStub(error: Error): Generator { 15 | yield undefined; 16 | throw error; 17 | } 18 | -------------------------------------------------------------------------------- /packages/scanner-global-library/src/privacy-scanner/privacy-scan-result.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { PrivacyPageScanReport } from 'storage-documents'; 5 | import { BrowserError } from '../browser-error'; 6 | 7 | export interface PrivacyScanResult { 8 | results?: PrivacyPageScanReport; 9 | error?: Error | BrowserError; 10 | pageResponseCode?: number; 11 | /** 12 | * Redirected URL if a page was redirected. 13 | */ 14 | scannedUrl?: string; 15 | pageSnapshot?: string; 16 | pageScreenshot?: string; 17 | unscannable?: boolean; 18 | } 19 | -------------------------------------------------------------------------------- /packages/scanner-global-library/src/setup-scanner-container.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import * as inversify from 'inversify'; 5 | import { registerAxeCoreScannerToContainer } from 'axe-core-scanner'; 6 | import { PuppeteerTimeoutConfig } from './page-timeout-config'; 7 | 8 | export function setupScannerContainer(container: inversify.Container): inversify.Container { 9 | container.options.skipBaseClassChecks = true; 10 | container.bind(PuppeteerTimeoutConfig).toSelf().inSingletonScope(); 11 | registerAxeCoreScannerToContainer(container); 12 | 13 | return container; 14 | } 15 | -------------------------------------------------------------------------------- /packages/web-api-scan-request-sender/src/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import 'reflect-metadata'; 5 | 6 | import { System } from 'common'; 7 | import { setupWebApiScanRequestSenderContainer } from './setup-web-api-scan-request-sender-container'; 8 | import { WebApiScanRequestSenderEntryPoint } from './web-api-scan-request-sender-entry-point'; 9 | 10 | (async () => { 11 | await new WebApiScanRequestSenderEntryPoint(setupWebApiScanRequestSenderContainer()).start(); 12 | })().catch((error) => { 13 | console.log(System.serializeError(error)); 14 | process.exitCode = 1; 15 | }); 16 | -------------------------------------------------------------------------------- /packages/crawler/src/common/url.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import * as normalizeUrlExt from 'normalize-url'; 5 | 6 | export namespace Url { 7 | export function normalizeUrl(url: string, keepUrlFragment?: boolean): string { 8 | const stripHash = keepUrlFragment !== null && keepUrlFragment !== undefined ? !keepUrlFragment : true; 9 | 10 | return normalizeUrlExt.default(url, { stripHash: stripHash, removeQueryParameters: false }); 11 | } 12 | 13 | export function hasQueryParameters(url: string): boolean { 14 | return url.indexOf('?') !== -1; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/service-library/src/crawler/discovery-pattern-factory.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import url from 'url'; 5 | import { isEmpty } from 'lodash'; 6 | 7 | /** 8 | * Returns RegEx string that is used to find new links on a page. 9 | */ 10 | export function createDiscoveryPattern(pseudoUrl: string, includePath: boolean = true): string { 11 | if (isEmpty(pseudoUrl)) { 12 | return undefined; 13 | } 14 | 15 | const urlObj = url.parse(pseudoUrl); 16 | 17 | return includePath ? `^http(s?)://${urlObj.host}${urlObj.pathname}(.*)` : `^http(s?)://${urlObj.host}(.*)`; 18 | } 19 | -------------------------------------------------------------------------------- /packages/web-api-send-notification-runner/src/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import 'reflect-metadata'; 5 | 6 | import { System } from 'common'; 7 | import { setupWebApiNotificationSenderContainer } from './setup-web-api-notification-sender-container'; 8 | import { WebApiNotificationSenderEntryPoint } from './web-api-notification-sender-entry-point'; 9 | 10 | (async () => { 11 | await new WebApiNotificationSenderEntryPoint(setupWebApiNotificationSenderContainer()).start(); 12 | })().catch((error) => { 13 | console.log(System.serializeError(error)); 14 | process.exitCode = 1; 15 | }); 16 | -------------------------------------------------------------------------------- /packages/service-library/src/web-api/web-http-response.spec.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { WebHttpResponse } from './web-http-response'; 5 | import { WebApiErrorCodes } from './web-api-error-codes'; 6 | 7 | describe(WebHttpResponse, () => { 8 | it('create HTTP error response from web API code', () => { 9 | const webApiCode = WebApiErrorCodes.invalidResourceId; 10 | const response = WebHttpResponse.getErrorResponse(webApiCode); 11 | expect(response.status).toEqual(webApiCode.statusCode); 12 | expect(response.jsonBody.error).toEqual(webApiCode.error); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /packages/service-library/src/web-api/web-http-response.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { WebApiErrorCode } from './web-api-error-codes'; 5 | 6 | /* eslint-disable @typescript-eslint/no-explicit-any */ 7 | 8 | export class WebHttpResponse { 9 | public static getErrorResponse(webApiErrorCode: WebApiErrorCode): WebHttpResponse { 10 | return { 11 | status: webApiErrorCode.statusCode, 12 | jsonBody: { 13 | error: webApiErrorCode.error, 14 | }, 15 | }; 16 | } 17 | 18 | public status: number; 19 | 20 | public jsonBody: any; 21 | } 22 | -------------------------------------------------------------------------------- /azure-pipeline/test-steps.yaml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | steps: 5 | - script: | 6 | export NODE_OPTIONS=--max_old_space_size=8192 7 | yarn test --coverage 8 | displayName: Run unit tests 9 | 10 | - task: PublishTestResults@2 11 | inputs: 12 | testResultsFiles: $(System.DefaultWorkingDirectory)/test-results/unit/junit.xml 13 | testRunTitle: $(Agent.JobName) 14 | condition: always() 15 | displayName: Publish test results 16 | 17 | # - script: yarn publish-code-coverage -t $(CODECOV_TOKEN) 18 | # displayName: Publish code coverage to codecov 19 | -------------------------------------------------------------------------------- /packages/functional-tests/src/test-groups/finalizer-test-group.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { TestEnvironment } from '../common-types'; 5 | import { test } from '../test-decorator'; 6 | import { FunctionalTestGroup } from './functional-test-group'; 7 | 8 | /* eslint-disable @typescript-eslint/no-unused-expressions */ 9 | 10 | export class FinalizerTestGroup extends FunctionalTestGroup { 11 | @test(TestEnvironment.all) 12 | public async functionalTestsFinalizer(): Promise { 13 | // The last test in a functional test suite to indicated a suite run completion 14 | return; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/resource-deployment/scripts/delete-all-private-links.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright (c) Microsoft Corporation. All rights reserved. 4 | # Licensed under the MIT License. 5 | 6 | # shellcheck disable=SC1090 7 | set -eo pipefail 8 | 9 | "${0%/*}"/delete-private-link.sh -r maxl-a11y-eu-2 -g blob 10 | "${0%/*}"/delete-private-link.sh -r maxl-a11y-eu-2 -g queue 11 | "${0%/*}"/delete-private-link.sh -r maxl-a11y-eu-2 -g table 12 | "${0%/*}"/delete-private-link.sh -r maxl-a11y-eu-2 -g file 13 | "${0%/*}"/delete-private-link.sh -r maxl-a11y-eu-2 -g vault 14 | "${0%/*}"/delete-private-link.sh -r maxl-a11y-eu-2 -g sql 15 | 16 | echo "[delete-all-private-link] Completed deletion of all private links" 17 | -------------------------------------------------------------------------------- /packages/crawler/src/storage/store-types.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | export const scanResultStorageName = 'scan-results'; 5 | 6 | export interface DataStore { 7 | pushData(data: unknown): Promise; 8 | } 9 | 10 | /* eslint-disable @typescript-eslint/ban-types */ 11 | export interface BlobStore { 12 | setValue( 13 | key: string, 14 | value: string | Object, 15 | options?: 16 | | { 17 | contentType?: string; 18 | } 19 | | undefined, 20 | ): Promise; 21 | 22 | getValue(key: string): Promise; 23 | } 24 | -------------------------------------------------------------------------------- /packages/web-api-scan-runner/src/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import 'reflect-metadata'; 5 | // eslint-disable-next-line import/no-unassigned-import 6 | import './module-name-mapper'; 7 | 8 | import { System } from 'common'; 9 | import { setupWebApiScanRunnerContainer } from './setup-web-api-scan-runner-container'; 10 | import { WebApiScanRunnerEntryPoint } from './web-api-scan-runner-entry-point'; 11 | 12 | (async () => { 13 | await new WebApiScanRunnerEntryPoint(setupWebApiScanRunnerContainer()).start(); 14 | })().catch((error) => { 15 | console.log(System.serializeError(error)); 16 | process.exitCode = 1; 17 | }); 18 | -------------------------------------------------------------------------------- /packages/storage-documents/src/batch-pool-load-snapshot.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { StorageDocument } from './storage-document'; 5 | 6 | export interface BatchPoolLoadSnapshot extends StorageDocument { 7 | batchAccountName: string; 8 | poolId: string; 9 | activeTasks: number; 10 | runningTasks: number; 11 | tasksProcessingSpeedPerInterval: number; 12 | tasksProcessingSpeedPerMinute: number; 13 | tasksIncrementCountPerInterval: number; 14 | targetActiveToRunningTasksRatio: number; 15 | configuredMaxTasksPerPool: number; 16 | samplingIntervalInSeconds: number; 17 | timestamp: Date; 18 | } 19 | -------------------------------------------------------------------------------- /packages/web-api-scan-job-manager/src/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import 'reflect-metadata'; 5 | 6 | import { System } from 'common'; 7 | import { setupWebApiScanJobManagerContainer } from './setup-web-api-scan-job-manager-container'; 8 | import { WebApiScanJobManagerEntryPoint } from './web-api-scan-job-manager-entry-point'; 9 | 10 | (async () => { 11 | const webApiJobManagerEntryPoint = new WebApiScanJobManagerEntryPoint(setupWebApiScanJobManagerContainer()); 12 | await webApiJobManagerEntryPoint.start(); 13 | })().catch((error) => { 14 | console.log(System.serializeError(error)); 15 | process.exitCode = 1; 16 | }); 17 | -------------------------------------------------------------------------------- /packages/privacy-scan-job-manager/src/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import 'reflect-metadata'; 5 | 6 | import { System } from 'common'; 7 | import { PrivacyScanJobManagerEntryPoint } from './privacy-scan-job-manager-entry-point'; 8 | import { setupPrivacyScanJobManagerContainer } from './setup-privacy-scan-job-manager-container'; 9 | 10 | (async () => { 11 | const webApiJobManagerEntryPoint = new PrivacyScanJobManagerEntryPoint(setupPrivacyScanJobManagerContainer()); 12 | await webApiJobManagerEntryPoint.start(); 13 | })().catch((error) => { 14 | console.log(System.serializeError(error)); 15 | process.exitCode = 1; 16 | }); 17 | -------------------------------------------------------------------------------- /packages/crawler/src/common/hash-generator.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { inject, injectable, optional } from 'inversify'; 5 | 6 | /* eslint-disable @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires */ 7 | const shaJS = require('sha.js'); 8 | 9 | @injectable() 10 | export class HashGenerator { 11 | public constructor(@optional() @inject('sha') private readonly shaObj = shaJS) {} 12 | 13 | public generateBase64Hash(...values: string[]): string { 14 | const hashSeed: string = values.join('|').toLowerCase(); 15 | 16 | return this.shaObj('sha256').update(hashSeed).digest('hex'); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/web-api-send-notification-runner/src/notification-sender-config.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { injectable } from 'inversify'; 5 | import yargs, { Arguments, Argv } from 'yargs'; 6 | import { NotificationSenderMetadata } from './types/notification-sender-metadata'; 7 | 8 | @injectable() 9 | export class NotificationSenderConfig { 10 | constructor(private readonly argvObj: Argv = yargs) {} 11 | 12 | public getConfig(): NotificationSenderMetadata { 13 | this.argvObj.env().demandOption(['scanId', 'scanNotifyUrl', 'runStatus']); 14 | 15 | return this.argvObj.argv as Arguments; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /packages/cli/src/setup-cli-container.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { Crawler, setupCrawlerContainer } from 'accessibility-insights-crawler'; 5 | import Ajv from 'ajv'; 6 | import * as inversify from 'inversify'; 7 | import { iocTypes } from './ioc-types'; 8 | 9 | export function setupCliContainer( 10 | container: inversify.Container = new inversify.Container({ autoBindInjectable: true }), 11 | ): inversify.Container { 12 | setupCrawlerContainer(container); 13 | container.bind(Crawler).toConstantValue(new Crawler(container)); 14 | container.bind(iocTypes.ajv).toConstantValue(new Ajv({ allErrors: true })); 15 | 16 | return container; 17 | } 18 | -------------------------------------------------------------------------------- /packages/axe-core-scanner/src/register-axe-core-scanner-to-container.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import * as inversify from 'inversify'; 5 | import { axeScannerIocTypes } from './axe-core-scanner-ioc-types'; 6 | import { webAxeRunOptions } from './axe-run-options'; 7 | import { localAxeConfiguration } from './axe-configuration'; 8 | 9 | export function registerAxeCoreScannerToContainer(container: inversify.Container): inversify.Container { 10 | container.bind(axeScannerIocTypes.AxeConfiguration).toConstantValue(localAxeConfiguration); 11 | container.bind(axeScannerIocTypes.AxeRunOptions).toConstantValue(webAxeRunOptions); 12 | 13 | return container; 14 | } 15 | -------------------------------------------------------------------------------- /packages/functional-tests/src/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | export { TestEnvironment } from './common-types'; 5 | export { ScanStatusTestGroup } from './test-groups/scan-status-test-group'; 6 | export { FunctionalTestGroup } from './test-groups/functional-test-group'; 7 | export { FinalizerTestGroup } from './test-groups/finalizer-test-group'; 8 | export { TestContextData } from './test-context-data'; 9 | export { TestGroupName, TestGroupConstructor, functionalTestGroupTypes } from './functional-test-group-types'; 10 | export { TestRunner, TestRunMetadata } from './runner/test-runner'; 11 | export { test } from './test-decorator'; 12 | export * from './common-types'; 13 | -------------------------------------------------------------------------------- /packages/cli/src/report/report-name-generator.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { inject, injectable } from 'inversify'; 5 | import { ReportNameGeneratorBuilder } from './report-name-generator-builder'; 6 | 7 | @injectable() 8 | export class ReportNameGenerator { 9 | constructor(@inject(ReportNameGeneratorBuilder) private readonly reportNameGeneratorBuilder: ReportNameGeneratorBuilder) {} 10 | 11 | public generateName(baseName: string, scanDate: Date): string { 12 | return `${baseName}-${this.reportNameGeneratorBuilder.getDateSegment(scanDate)}-${this.reportNameGeneratorBuilder.getTimeSegment( 13 | scanDate, 14 | )}`; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/report-generator-job-manager/src/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import 'reflect-metadata'; 5 | 6 | import { System } from 'common'; 7 | import { ReportGeneratorJobManagerEntryPoint } from './report-generator-job-manager-entry-point'; 8 | import { setupReportGeneratorJobManagerContainer } from './setup-report-generator-job-manager-container'; 9 | 10 | (async () => { 11 | const webApiJobManagerEntryPoint = new ReportGeneratorJobManagerEntryPoint(setupReportGeneratorJobManagerContainer()); 12 | await webApiJobManagerEntryPoint.start(); 13 | })().catch((error) => { 14 | console.log(System.serializeError(error)); 15 | process.exitCode = 1; 16 | }); 17 | -------------------------------------------------------------------------------- /packages/azure-services/src/azure-batch/batch-config.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { injectable } from 'inversify'; 5 | import * as _ from 'lodash'; 6 | 7 | @injectable() 8 | export class BatchConfig { 9 | public readonly accountName: string = process.env.AZ_BATCH_ACCOUNT_NAME; 10 | 11 | public readonly accountUrl: string = process.env.AZ_BATCH_ACCOUNT_URL; 12 | 13 | public readonly poolId: string = process.env.AZ_BATCH_POOL_ID; 14 | 15 | public readonly jobId: string = process.env.AZ_BATCH_JOB_ID; 16 | 17 | public readonly taskWorkingDir: string = process.env.AZ_BATCH_TASK_WORKING_DIR; 18 | } 19 | 20 | export const batchConfig = new BatchConfig(); 21 | -------------------------------------------------------------------------------- /packages/web-workers/src/e2e-test-scenarios/get-test-identifiers.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { TestGroupName } from 'functional-tests'; 5 | import { TestIdentifier } from '../controllers/activity-request-data'; 6 | import { E2EScanScenarioDefinition } from './e2e-scan-scenario-definitions'; 7 | 8 | export const getTestIdentifiersForScenario = (scenarioDef: E2EScanScenarioDefinition): TestIdentifier[] => { 9 | const testGroupNames: TestGroupName[] = [].concat(...Object.values(scenarioDef.testGroups)); 10 | 11 | return testGroupNames.map((testGroupName) => { 12 | return { scenarioName: scenarioDef.readableName, testGroupName: testGroupName }; 13 | }); 14 | }; 15 | -------------------------------------------------------------------------------- /tsconfig.base.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2022", 4 | "module": "commonjs", 5 | "lib": ["ES2023", "DOM", "DOM.Iterable"], 6 | "moduleResolution": "node", 7 | "emitDecoratorMetadata": true, 8 | "esModuleInterop": true, 9 | "experimentalDecorators": true, 10 | "noImplicitAny": true, 11 | "noUnusedLocals": true, 12 | "noImplicitReturns": true, 13 | "resolveJsonModule": true, 14 | "sourceMap": true, 15 | "declaration": true, 16 | "types": ["reflect-metadata", "@types/jest", "@types/node"] 17 | }, 18 | "awesomeTypescriptLoaderOptions": { 19 | "usePrecompiledFiles": true, 20 | "useWebpackText": true 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /packages/web-api-scan-request-sender/src/setup-web-api-scan-request-sender-container.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { registerAzureServicesToContainer } from 'azure-services'; 5 | import { setupRuntimeConfigContainer } from 'common'; 6 | import * as inversify from 'inversify'; 7 | import { registerLoggerToContainer } from 'logger'; 8 | 9 | export function setupWebApiScanRequestSenderContainer(): inversify.Container { 10 | const container = new inversify.Container({ autoBindInjectable: true }); 11 | setupRuntimeConfigContainer(container); 12 | registerLoggerToContainer(container); 13 | registerAzureServicesToContainer(container); 14 | 15 | return container; 16 | } 17 | -------------------------------------------------------------------------------- /packages/cli/src/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | export { AICrawler } from './crawler/ai-crawler'; 5 | export { CrawlerParametersBuilder } from './crawler/crawler-parameters-builder'; 6 | export { setupCliContainer } from './setup-cli-container'; 7 | export { AICombinedReportDataConverter } from './converter/ai-data-converter'; 8 | export { ScanArguments } from './scan-arguments'; 9 | export { validateScanArguments } from './validate-scan-arguments'; 10 | export { BaselineOptions, BaselineEvaluation } from './baseline/baseline-types'; 11 | export { BaselineOptionsBuilder } from './baseline/baseline-options-builder'; 12 | export { BaselineFileUpdater } from './baseline/baseline-file-updater'; 13 | -------------------------------------------------------------------------------- /packages/privacy-scan-runner/src/setup-privacy-scan-runner-container.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { registerAzureServicesToContainer } from 'azure-services'; 5 | import { setupRuntimeConfigContainer } from 'common'; 6 | import * as inversify from 'inversify'; 7 | import { registerLoggerToContainer } from 'logger'; 8 | 9 | export function setupPrivacyScanRunnerContainer(): inversify.Container { 10 | const container = new inversify.Container({ autoBindInjectable: true, skipBaseClassChecks: true }); 11 | setupRuntimeConfigContainer(container); 12 | registerLoggerToContainer(container); 13 | registerAzureServicesToContainer(container); 14 | 15 | return container; 16 | } 17 | -------------------------------------------------------------------------------- /packages/web-api-send-notification-runner/src/setup-web-api-notification-sender-container.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { registerAzureServicesToContainer } from 'azure-services'; 5 | import { setupRuntimeConfigContainer } from 'common'; 6 | import * as inversify from 'inversify'; 7 | import { registerLoggerToContainer } from 'logger'; 8 | 9 | export function setupWebApiNotificationSenderContainer(): inversify.Container { 10 | const container = new inversify.Container({ autoBindInjectable: true }); 11 | setupRuntimeConfigContainer(container); 12 | registerLoggerToContainer(container); 13 | registerAzureServicesToContainer(container); 14 | 15 | return container; 16 | } 17 | -------------------------------------------------------------------------------- /tools/create-github-release-tag.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright (c) Microsoft Corporation. All rights reserved. 4 | # Licensed under the MIT License. 5 | 6 | set -eo pipefail 7 | 8 | exitWithUsageInfo() { 9 | echo "Usage: ${BASH_SOURCE} -h " 10 | exit 1 11 | } 12 | 13 | while getopts ":h:" option; do 14 | case $option in 15 | h) commitHash=${OPTARG} ;; 16 | *) exitWithUsageInfo ;; 17 | esac 18 | done 19 | 20 | if [[ -z $commitHash ]]; then 21 | exitWithUsageInfo 22 | fi 23 | 24 | timestamp=$(date '+%Y-%m-%d') 25 | tag="service@$timestamp" 26 | 27 | echo "Creating release tag $tag for commit hash $commitHash" 28 | 29 | git tag $tag $commitHash 30 | git push origin $tag 31 | 32 | echo "Release tag has been created successfully" 33 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | .gitattributes 5 | .github 6 | .prettierignore 7 | LICENSE 8 | yarn.lock 9 | .dockerignore 10 | .shellcheckrc 11 | 12 | **/*.code-workspace 13 | **/Dockerfile 14 | **/Dockerfile.* 15 | **/*.Dockerfile 16 | **/.gitignore 17 | test-results/ 18 | **/obj/ 19 | **/bin/ 20 | **/*.dat 21 | **/*.png 22 | **/*.sh 23 | **/*.pbix 24 | dist/ 25 | **/*.code-workspace 26 | **/*.env 27 | **/.env.* 28 | **/yarn-*.log 29 | **/*.ts.snap 30 | **/*.txt 31 | **/.DS_Store 32 | **/.funcignore 33 | **/extensions.csproj 34 | **/crawler_storage/ 35 | **/ai_scan_cli_output/ 36 | **/*.ps1 37 | **/*.cmd 38 | .yarn/ 39 | **/*.patch 40 | **/.gdnsuppress 41 | **/chrome-user-data 42 | .config/1espt 43 | -------------------------------------------------------------------------------- /packages/common/src/system/exponential-retry.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { backOff, IBackOffOptions } from 'exponential-backoff'; 5 | 6 | export declare type ExponentialRetryOptions = Partial; 7 | 8 | export const exponentialRetryOptions: ExponentialRetryOptions = { 9 | jitter: 'full', 10 | delayFirstAttempt: false, 11 | numOfAttempts: 5, 12 | maxDelay: 6000, 13 | startingDelay: 200, 14 | retry: () => true, 15 | }; 16 | 17 | export async function executeWithExponentialRetry( 18 | fn: () => Promise, 19 | options: ExponentialRetryOptions = exponentialRetryOptions, 20 | ): Promise { 21 | return backOff(async () => fn(), options); 22 | } 23 | -------------------------------------------------------------------------------- /packages/report-generator-runner/src/setup-report-generator-runner-container.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { registerAzureServicesToContainer } from 'azure-services'; 5 | import { setupRuntimeConfigContainer } from 'common'; 6 | import * as inversify from 'inversify'; 7 | import { registerLoggerToContainer } from 'logger'; 8 | 9 | export function setupReportGeneratorRunnerContainer(): inversify.Container { 10 | const container = new inversify.Container({ autoBindInjectable: true, skipBaseClassChecks: true }); 11 | setupRuntimeConfigContainer(container); 12 | registerLoggerToContainer(container); 13 | registerAzureServicesToContainer(container); 14 | 15 | return container; 16 | } 17 | -------------------------------------------------------------------------------- /packages/web-api-send-notification-job-manager/src/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import 'reflect-metadata'; 5 | 6 | import { System } from 'common'; 7 | import { SendNotificationJobManagerEntryPoint } from './send-notification-job-manager-entry-point'; 8 | import { setupSendNotificationJobManagerContainer } from './setup-send-notification-job-manager-container'; 9 | 10 | (async () => { 11 | const sendNotificationJobManagerEntryPoint = new SendNotificationJobManagerEntryPoint(setupSendNotificationJobManagerContainer()); 12 | await sendNotificationJobManagerEntryPoint.start(); 13 | })().catch((error) => { 14 | console.log(System.serializeError(error)); 15 | process.exitCode = 1; 16 | }); 17 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '[Feature Request]' 5 | labels: 'feature request' 6 | assignees: '' 7 | 8 | --- 9 | 10 | ## Is your feature request related to a problem? Please describe. 11 | 12 | 13 | 14 | ## Describe the solution you'd like 15 | 16 | 17 | 18 | ## Describe alternatives you've considered 19 | 20 | 21 | 22 | ## Additional context 23 | 24 | 25 | -------------------------------------------------------------------------------- /packages/web-api/get-scan-func/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import 'reflect-metadata'; 5 | 6 | import { app, InvocationContext, HttpRequest, HttpResponseInit } from '@azure/functions'; 7 | import { ScanResultController } from '../src/controllers/scan-result-controller'; 8 | import { processWebRequest } from '../src/process-web-request'; 9 | 10 | export async function requestHandler(request: HttpRequest, context: InvocationContext): Promise { 11 | return processWebRequest({ request, context }, ScanResultController); 12 | } 13 | 14 | app.http('get-scan', { 15 | methods: ['GET'], 16 | authLevel: 'anonymous', 17 | handler: requestHandler, 18 | route: 'scans/{scanId}', 19 | }); 20 | -------------------------------------------------------------------------------- /packages/web-api/post-scans-func/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import 'reflect-metadata'; 5 | 6 | import { app, InvocationContext, HttpRequest, HttpResponseInit } from '@azure/functions'; 7 | import { ScanRequestController } from '../src/controllers/scan-request-controller'; 8 | import { processWebRequest } from '../src/process-web-request'; 9 | 10 | export async function requestHandler(request: HttpRequest, context: InvocationContext): Promise { 11 | return processWebRequest({ request, context }, ScanRequestController); 12 | } 13 | 14 | app.http('post-scans', { 15 | methods: ['POST'], 16 | authLevel: 'anonymous', 17 | handler: requestHandler, 18 | route: 'scans', 19 | }); 20 | -------------------------------------------------------------------------------- /packages/azure-services/src/key-vault/secret-provider.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { SecretClient } from '@azure/keyvault-secrets'; 5 | import { inject, injectable } from 'inversify'; 6 | import { AzureKeyVaultClientProvider, iocTypeNames } from '../ioc-types'; 7 | 8 | @injectable() 9 | export class SecretProvider { 10 | constructor(@inject(iocTypeNames.AzureKeyVaultClientProvider) private readonly keyVaultClientProvider: AzureKeyVaultClientProvider) {} 11 | 12 | public async getSecret(name: string): Promise { 13 | const client: SecretClient = await this.keyVaultClientProvider(); 14 | const result = await client.getSecret(name); 15 | 16 | return result.value; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/web-api-scan-runner/src/report-generator/axe-result-snapshot-converter.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { injectable } from 'inversify'; 5 | import { ReportFormat, ReportSource } from 'storage-documents'; 6 | import { ReportResult } from 'scanner-global-library'; 7 | import { AxeResultConverter } from './axe-result-converter'; 8 | 9 | @injectable() 10 | export class AxeResultSnapshotConverter implements AxeResultConverter { 11 | public readonly targetReportFormat: ReportFormat = 'page.mhtml'; 12 | 13 | public readonly targetReportSource: ReportSource[] = ['accessibility-scan']; 14 | 15 | public convert(reportResult: ReportResult): string { 16 | return reportResult.pageSnapshot; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/web-api-scan-runner/src/report-generator/axe-result-screenshot-converter.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { injectable } from 'inversify'; 5 | import { ReportFormat, ReportSource } from 'storage-documents'; 6 | import { ReportResult } from 'scanner-global-library'; 7 | import { AxeResultConverter } from './axe-result-converter'; 8 | 9 | @injectable() 10 | export class AxeResultScreenshotConverter implements AxeResultConverter { 11 | public readonly targetReportFormat: ReportFormat = 'page.png'; 12 | 13 | public readonly targetReportSource: ReportSource[] = ['accessibility-scan']; 14 | 15 | public convert(reportResult: ReportResult): string { 16 | return reportResult.pageScreenshot; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/service-library/src/crawler/crawler-configuration.spec.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import 'reflect-metadata'; 5 | 6 | import { CrawlerConfiguration } from './crawler-configuration'; 7 | 8 | let crawlerConfiguration: CrawlerConfiguration; 9 | 10 | describe(CrawlerConfiguration, () => { 11 | beforeEach(() => { 12 | crawlerConfiguration = new CrawlerConfiguration(); 13 | }); 14 | 15 | it('set crawler settings', () => { 16 | const workingDirectory = 'workingDirectory'; 17 | crawlerConfiguration.setApifySettings(workingDirectory); 18 | expect(process.env.CRAWLEE_HEADLESS).toEqual('1'); 19 | expect(process.env.CRAWLEE_STORAGE_DIR).toEqual(workingDirectory); 20 | }); 21 | }); 22 | -------------------------------------------------------------------------------- /packages/service-library/src/web-api/api-contracts/health-report.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | export declare type TestEnvironment = 'dev' | 'canary' | 'insider' | 'production'; 5 | export declare type TestRunResult = 'pass' | 'fail' | 'warn'; 6 | 7 | export interface TestRun { 8 | testContainer: string; 9 | testName: string; 10 | scenarioName: string; 11 | scanId?: string; 12 | result: TestRunResult; 13 | error?: string; 14 | timestamp: Date; 15 | } 16 | 17 | export interface HealthReport { 18 | healthStatus: TestRunResult; 19 | environment: TestEnvironment; 20 | releaseId: string; 21 | runId: string; 22 | testRuns: TestRun[]; 23 | testsPassed: number; 24 | testsFailed: number; 25 | } 26 | -------------------------------------------------------------------------------- /packages/web-api/get-report-func/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import 'reflect-metadata'; 5 | 6 | import { app, InvocationContext, HttpRequest, HttpResponseInit } from '@azure/functions'; 7 | import { ScanReportController } from '../src/controllers/scan-report-controller'; 8 | import { processWebRequest } from '../src/process-web-request'; 9 | 10 | export async function requestHandler(request: HttpRequest, context: InvocationContext): Promise { 11 | return processWebRequest({ request, context }, ScanReportController); 12 | } 13 | 14 | app.http('get-report', { 15 | methods: ['GET'], 16 | authLevel: 'anonymous', 17 | handler: requestHandler, 18 | route: 'scans/{scanId}/reports/{reportId}', 19 | }); 20 | -------------------------------------------------------------------------------- /packages/crawler/src/apify/discovery-patterns.spec.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import 'reflect-metadata'; 5 | import { getDiscoveryPatternForUrl } from './discovery-patterns'; 6 | 7 | describe(getDiscoveryPatternForUrl, () => { 8 | const host = 'hostname.com'; 9 | const pathname = '/path/to/page'; 10 | const path = `${pathname}?q=1`; 11 | let url: string; 12 | 13 | beforeEach(() => { 14 | url = `https://${host}${path}`; 15 | }); 16 | 17 | it('Creates discovery pattern for url', () => { 18 | const expectedPattern = `http(s?)://${host}${pathname}(.*)`; 19 | const actualPattern = getDiscoveryPatternForUrl(url); 20 | expect(actualPattern).toEqual(expectedPattern); 21 | }); 22 | }); 23 | -------------------------------------------------------------------------------- /packages/web-api/get-scans-batch-func/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import 'reflect-metadata'; 5 | 6 | import { app, InvocationContext, HttpRequest, HttpResponseInit } from '@azure/functions'; 7 | import { processWebRequest } from '../src/process-web-request'; 8 | import { BatchScanResultController } from './../src/controllers/batch-scan-result-controller'; 9 | 10 | export async function requestHandler(request: HttpRequest, context: InvocationContext): Promise { 11 | return processWebRequest({ request, context }, BatchScanResultController); 12 | } 13 | 14 | app.http('get-scans', { 15 | methods: ['POST'], 16 | authLevel: 'anonymous', 17 | handler: requestHandler, 18 | route: 'scans/$batch', 19 | }); 20 | -------------------------------------------------------------------------------- /packages/resource-deployment/scripts/docker-scanner-image/enable-virtual-display.ps1: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | # Modify registry to enable a virtual display 5 | Write-Host "Forcing Windows to create a virtual display" 6 | reg add "HKLM\System\CurrentControlSet\Control\GraphicsDrivers" /v EnableFakeDisplay /t REG_DWORD /d 1 /f 7 | reg add "HKLM\SYSTEM\CurrentControlSet\Control\GraphicsDrivers" /v DisableHardwareAcceleration /t REG_DWORD /d 0 /f 8 | reg add "HKLM\SYSTEM\CurrentControlSet\Control\GraphicsDrivers" /v HwSchMode /t REG_DWORD /d 1 /f 9 | 10 | $name = "ContainerUser" 11 | $key = ConvertTo-SecureString $env:USER_KEY -AsPlainText -Force 12 | New-LocalUser -Name $name -Password $key -FullName "Container User" -Description "Automated GUI Session" 13 | -------------------------------------------------------------------------------- /packages/web-api/check-health-func/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import 'reflect-metadata'; 5 | 6 | import { app, HttpRequest, HttpResponseInit, InvocationContext } from '@azure/functions'; 7 | import { HealthCheckController } from '../src/controllers/health-check-controller'; 8 | import { processWebRequest } from '../src/process-web-request'; 9 | 10 | export async function requestHandler(request: HttpRequest, context: InvocationContext): Promise { 11 | return processWebRequest({ request, context }, HealthCheckController); 12 | } 13 | 14 | app.http('check-health', { 15 | methods: ['GET'], 16 | authLevel: 'anonymous', 17 | handler: requestHandler, 18 | route: 'health/{target:alpha?}/{targetId?}', 19 | }); 20 | -------------------------------------------------------------------------------- /packages/web-api-scan-runner/src/runner-scan-metadata-config.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { injectable } from 'inversify'; 5 | import yargs, { Arguments, Argv } from 'yargs'; 6 | import { RunnerScanMetadata } from 'service-library'; 7 | 8 | @injectable() 9 | export class RunnerScanMetadataConfig { 10 | constructor(private readonly argvObj: Argv = yargs) { 11 | argvObj.options({ 12 | deepScan: { 13 | type: 'boolean', 14 | alias: 'deepscan', 15 | }, 16 | }); 17 | } 18 | 19 | public getConfig(): RunnerScanMetadata { 20 | this.argvObj.env().demandOption(['id', 'url']); 21 | 22 | return this.argvObj.argv as Arguments; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /packages/privacy-scan-runner/src/scan-metadata-config.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { injectable } from 'inversify'; 5 | import yargs, { Arguments, Argv } from 'yargs'; 6 | import { PrivacyScanMetadata } from './types/privacy-scan-metadata'; 7 | 8 | @injectable() 9 | export class ScanMetadataConfig { 10 | constructor(private readonly argvObj: Argv = yargs) { 11 | argvObj.options({ 12 | deepScan: { 13 | type: 'boolean', 14 | alias: 'deepscan', 15 | }, 16 | }); 17 | } 18 | 19 | public getConfig(): PrivacyScanMetadata { 20 | this.argvObj.env().demandOption(['id', 'url']); 21 | 22 | return this.argvObj.argv as Arguments; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /packages/service-library/src/factories/partition-key-factory.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { GuidGenerator, HashGenerator } from 'common'; 5 | import { inject, injectable } from 'inversify'; 6 | import { ItemType } from 'storage-documents'; 7 | 8 | @injectable() 9 | export class PartitionKeyFactory { 10 | constructor( 11 | @inject(HashGenerator) private readonly hashGenerator: HashGenerator, 12 | @inject(GuidGenerator) private readonly guidGenerator: GuidGenerator, 13 | ) {} 14 | 15 | public createPartitionKeyForDocument(documentType: ItemType, documentId: string): string { 16 | const node = this.guidGenerator.getGuidNode(documentId); 17 | 18 | return this.hashGenerator.getDbHashBucket(documentType, node); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /packages/web-workers/src/e2e-test-scenarios/create-scenarios.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { AvailabilityTestConfig } from 'common'; 5 | import { OrchestrationSteps } from '../orchestration/orchestration-steps'; 6 | import { E2EScanFactories } from './e2e-scan-scenario-definitions'; 7 | import { ScanScenarioDriver } from './scan-scenario-driver'; 8 | 9 | export function createScenarioDrivers( 10 | orchestrationSteps: OrchestrationSteps, 11 | availabilityTestConfig: AvailabilityTestConfig, 12 | ): ScanScenarioDriver[] { 13 | return E2EScanFactories.map((makeDefinition) => makeDefinition(availabilityTestConfig, orchestrationSteps.getWebApiConfig())).map( 14 | (definition) => new ScanScenarioDriver(orchestrationSteps, definition), 15 | ); 16 | } 17 | -------------------------------------------------------------------------------- /packages/crawler/src/page-scanners/page-scanner.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { AxePuppeteer } from '@axe-core/puppeteer'; 5 | import { inject, injectable } from 'inversify'; 6 | import * as Puppeteer from 'puppeteer'; 7 | import { AxeResults } from 'axe-core'; 8 | import { AxePuppeteerFactory } from 'axe-core-scanner'; 9 | 10 | @injectable() 11 | export class PageScanner { 12 | public constructor(@inject(AxePuppeteerFactory) private readonly axePuppeteerFactory: AxePuppeteerFactory) {} 13 | 14 | public async scan(page: Puppeteer.Page, axeSourcePath?: string): Promise { 15 | const axePuppeteer: AxePuppeteer = await this.axePuppeteerFactory.createAxePuppeteer(page, axeSourcePath); 16 | 17 | return axePuppeteer.analyze(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /packages/privacy-scan-runner/run-in-docker-container.cmd: -------------------------------------------------------------------------------- 1 | rem Copyright (c) Microsoft Corporation. All rights reserved. 2 | rem Licensed under the MIT License. 3 | 4 | echo off 5 | 6 | rem The script builds and runs the docker image 7 | 8 | SET DOCKER_CLI_HINTS=false 9 | 10 | copy ..\resource-deployment\runtime-config\runtime-config.dev.json .\dist\runtime-config.json &&^ 11 | cd ..\scanner-global-library &&^ 12 | yarn build &&^ 13 | cd ..\privacy-scan-runner &&^ 14 | yarn build &&^ 15 | cd .\dist &&^ 16 | docker build --tag mcr.microsoft.com/windows/privacy-scan-runner:prescanner . &&^ 17 | cd ..\..\resource-deployment\scripts\docker-scanner-image &&^ 18 | powershell .\build-scanner-image.ps1 -InstallHostFonts &&^ 19 | cd ..\..\..\privacy-scan-runner &&^ 20 | docker run --init --shm-size=2gb --ipc=host --env-file .env mcr.microsoft.com/windows/privacy-scan-runner 21 | -------------------------------------------------------------------------------- /packages/resource-deployment/templates/batch-account-custom-role.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "%NAME_TOKEN%", 3 | "type": "CustomRole", 4 | "description": "Allows a user to submit jobs to Azure Batch but not manage pools", 5 | "assignableScopes": ["/subscriptions/%SUBSCRIPTION_TOKEN%"], 6 | "permissions": [ 7 | { 8 | "actions": [ 9 | "Microsoft.Batch/*/read", 10 | "Microsoft.Authorization/*/read", 11 | "Microsoft.Resources/subscriptions/resourceGroups/read", 12 | "Microsoft.Support/*", 13 | "Microsoft.Insights/alertRules/*" 14 | ], 15 | "notActions": [], 16 | "dataActions": ["Microsoft.Batch/batchAccounts/jobs/*", "Microsoft.Batch/batchAccounts/jobSchedules/*"], 17 | "notDataActions": [] 18 | } 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /packages/crawler/src/storage/local-data-store.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { injectable } from 'inversify'; 5 | import * as Crawlee from '@crawlee/puppeteer'; 6 | import { DataStore, scanResultStorageName } from './store-types'; 7 | 8 | @injectable() 9 | export class LocalDataStore implements DataStore { 10 | private dataset: Crawlee.Dataset; 11 | 12 | // eslint-disable-next-line @typescript-eslint/ban-types 13 | public async pushData(data: object | object[]): Promise { 14 | await this.open(); 15 | await this.dataset.pushData(data); 16 | } 17 | 18 | private async open(): Promise { 19 | if (this.dataset === undefined) { 20 | this.dataset = await Crawlee.Dataset.open(scanResultStorageName); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/crawler/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | // See https://go.microsoft.com/fwlink/?LinkId=733558 3 | // for the documentation about the tasks.json format 4 | "version": "2.0.0", 5 | "tasks": [ 6 | { 7 | "type": "shell", 8 | "label": "run", 9 | "dependsOn": "imports" 10 | }, 11 | { 12 | "type": "shell", 13 | "label": "imports", 14 | "dependsOn": "tsc", 15 | "command": "npx rollup -c" 16 | }, 17 | { 18 | "type": "shell", 19 | "label": "tsc", 20 | "dependsOn": "clean", 21 | "command": "tsc", 22 | "problemMatcher": ["$tsc"] 23 | }, 24 | { 25 | "type": "shell", 26 | "label": "clean", 27 | "command": "npx rimraf dist" 28 | } 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /packages/crawler/src/authenticator/authenticator-factory.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { injectable } from 'inversify'; 5 | import { Authenticator } from './authenticator'; 6 | import { AzureActiveDirectoryAuthentication } from './azure-active-directory-authenticator'; 7 | 8 | @injectable() 9 | export class AuthenticatorFactory { 10 | public createAuthenticator(accountName: string, accountPassword: string, authType: string): Authenticator { 11 | switch (authType?.toUpperCase()) { 12 | case 'AAD': 13 | return new Authenticator(new AzureActiveDirectoryAuthentication(accountName, accountPassword)); 14 | default: 15 | throw new Error(`Unknown auth type: ${authType}, please provide a valid authType input.`); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/privacy-scan-runner/docker-image-config/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | FROM mcr.microsoft.com/windows/servercore:ltsc2022-amd64 5 | 6 | ENV NODE_VERSION 20.15.0 7 | 8 | WORKDIR /app 9 | 10 | # Install Node.js 11 | RUN powershell Set-ExecutionPolicy RemoteSigned 12 | RUN powershell -Command \ 13 | Invoke-WebRequest $('https://nodejs.org/dist/v{0}/node-v{0}-win-x64.zip' -f $env:NODE_VERSION) -OutFile 'node.zip' -UseBasicParsing ; \ 14 | Expand-Archive node.zip -DestinationPath / ; \ 15 | Rename-Item -Path $('C:\node-v{0}-win-x64' -f $env:NODE_VERSION) -NewName 'C:\nodejs' 16 | RUN setx /m PATH "%PATH%;C:\nodejs" 17 | 18 | # Bundle app package 19 | COPY . . 20 | 21 | # Install app dependencies 22 | RUN npm install 23 | 24 | ENTRYPOINT ["powershell.exe", "./privacy-scan-runner.ps1"] 25 | -------------------------------------------------------------------------------- /packages/web-api-scan-runner/src/web-api-scan-runner-entry-point.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { Container } from 'inversify'; 5 | import { BaseTelemetryProperties, GlobalLogger } from 'logger'; 6 | import { ProcessEntryPointBase } from 'service-library'; 7 | import { Runner } from './runner/runner'; 8 | 9 | export class WebApiScanRunnerEntryPoint extends ProcessEntryPointBase { 10 | protected getTelemetryBaseProperties(): BaseTelemetryProperties { 11 | return { source: 'webApiScanRunner' }; 12 | } 13 | 14 | protected async runCustomAction(container: Container): Promise { 15 | const logger = container.get(GlobalLogger); 16 | await logger.setup(); 17 | 18 | const runner = container.get(Runner); 19 | await runner.run(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /packages/common/src/system/environment-settings.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { inject, injectable } from 'inversify'; 5 | import { commonIocTypes } from '../common-ioc-types'; 6 | import { System } from './system'; 7 | 8 | @injectable() 9 | export class EnvironmentSettings { 10 | constructor(@inject(commonIocTypes.Process) private readonly currentProcess: typeof process) {} 11 | 12 | public tryGetValue(key: string): string { 13 | return this.currentProcess.env[key]; 14 | } 15 | 16 | public getValue(key: string): string { 17 | const value = this.tryGetValue(key); 18 | 19 | if (System.isNullOrEmptyString(value)) { 20 | throw new Error(`Unable to get environment property value for ${key}`); 21 | } 22 | 23 | return value; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /packages/privacy-scan-runner/src/privacy-scan-runner-entry-point.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { Container } from 'inversify'; 5 | import { BaseTelemetryProperties, GlobalLogger } from 'logger'; 6 | import { ProcessEntryPointBase } from 'service-library'; 7 | import { Runner } from './runner/runner'; 8 | 9 | export class PrivacyScanRunnerEntryPoint extends ProcessEntryPointBase { 10 | protected getTelemetryBaseProperties(): BaseTelemetryProperties { 11 | return { source: 'privacyScanRunner' }; 12 | } 13 | 14 | protected async runCustomAction(container: Container): Promise { 15 | const logger = container.get(GlobalLogger); 16 | await logger.setup(); 17 | 18 | const runner = container.get(Runner); 19 | await runner.run(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /packages/privacy-scan-job-manager/docker-image-config/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | FROM mcr.microsoft.com/windows/servercore:ltsc2022-amd64 5 | 6 | ENV NODE_VERSION 20.15.0 7 | 8 | WORKDIR /app 9 | 10 | # Install Node.js 11 | RUN powershell Set-ExecutionPolicy RemoteSigned 12 | RUN powershell -Command \ 13 | Invoke-WebRequest $('https://nodejs.org/dist/v{0}/node-v{0}-win-x64.zip' -f $env:NODE_VERSION) -OutFile 'node.zip' -UseBasicParsing ; \ 14 | Expand-Archive node.zip -DestinationPath / ; \ 15 | Rename-Item -Path $('C:\node-v{0}-win-x64' -f $env:NODE_VERSION) -NewName 'C:\nodejs' 16 | RUN setx /m PATH "%PATH%;C:\nodejs" 17 | 18 | # Bundle app package 19 | COPY . . 20 | 21 | # Install app dependencies 22 | RUN npm install 23 | 24 | ENTRYPOINT ["powershell.exe", "./privacy-scan-job-manager.ps1"] 25 | -------------------------------------------------------------------------------- /packages/report-generator-runner/docker-image-config/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | FROM mcr.microsoft.com/windows/servercore:ltsc2022-amd64 5 | 6 | ENV NODE_VERSION 20.15.0 7 | 8 | WORKDIR /app 9 | 10 | # Install Node.js 11 | RUN powershell Set-ExecutionPolicy RemoteSigned 12 | RUN powershell -Command \ 13 | Invoke-WebRequest $('https://nodejs.org/dist/v{0}/node-v{0}-win-x64.zip' -f $env:NODE_VERSION) -OutFile 'node.zip' -UseBasicParsing ; \ 14 | Expand-Archive node.zip -DestinationPath / ; \ 15 | Rename-Item -Path $('C:\node-v{0}-win-x64' -f $env:NODE_VERSION) -NewName 'C:\nodejs' 16 | RUN setx /m PATH "%PATH%;C:\nodejs" 17 | 18 | # Bundle app package 19 | COPY . . 20 | 21 | # Install app dependencies 22 | RUN npm install 23 | 24 | ENTRYPOINT ["powershell.exe", "./report-generator-runner.ps1"] 25 | -------------------------------------------------------------------------------- /packages/web-api-scan-job-manager/docker-image-config/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | FROM mcr.microsoft.com/windows/servercore:ltsc2022-amd64 5 | 6 | ENV NODE_VERSION 20.15.0 7 | 8 | WORKDIR /app 9 | 10 | # Install Node.js 11 | RUN powershell Set-ExecutionPolicy RemoteSigned 12 | RUN powershell -Command \ 13 | Invoke-WebRequest $('https://nodejs.org/dist/v{0}/node-v{0}-win-x64.zip' -f $env:NODE_VERSION) -OutFile 'node.zip' -UseBasicParsing ; \ 14 | Expand-Archive node.zip -DestinationPath / ; \ 15 | Rename-Item -Path $('C:\node-v{0}-win-x64' -f $env:NODE_VERSION) -NewName 'C:\nodejs' 16 | RUN setx /m PATH "%PATH%;C:\nodejs" 17 | 18 | # Bundle app package 19 | COPY . . 20 | 21 | # Install app dependencies 22 | RUN npm install 23 | 24 | ENTRYPOINT ["powershell.exe", "./web-api-scan-job-manager.ps1"] 25 | -------------------------------------------------------------------------------- /packages/web-api-scan-request-sender/docker-image-config/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | FROM mcr.microsoft.com/windows/servercore:ltsc2022-amd64 5 | 6 | ENV NODE_VERSION 20.15.0 7 | 8 | WORKDIR /app 9 | 10 | # Install Node.js 11 | RUN powershell Set-ExecutionPolicy RemoteSigned 12 | RUN powershell -Command \ 13 | Invoke-WebRequest $('https://nodejs.org/dist/v{0}/node-v{0}-win-x64.zip' -f $env:NODE_VERSION) -OutFile 'node.zip' -UseBasicParsing ; \ 14 | Expand-Archive node.zip -DestinationPath / ; \ 15 | Rename-Item -Path $('C:\node-v{0}-win-x64' -f $env:NODE_VERSION) -NewName 'C:\nodejs' 16 | RUN setx /m PATH "%PATH%;C:\nodejs" 17 | 18 | # Bundle app package 19 | COPY . . 20 | 21 | # Install app dependencies 22 | RUN npm install 23 | 24 | ENTRYPOINT ["powershell.exe", "./web-api-scan-request-sender.ps1"] 25 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "type": "node", 9 | "request": "launch", 10 | "name": "Debug current unit test file", 11 | "program": "${workspaceFolder:root}/node_modules/jest/bin/jest", 12 | // ${relativeFile} returns path with back slash. jest can't find the file if we use back slash. So, just passing file name instead 13 | "args": ["${fileBasename}", "--runInBand", "--coverage=false"], 14 | "console": "integratedTerminal", 15 | "internalConsoleOptions": "neverOpen", 16 | "cwd": "${fileDirname}" 17 | } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /packages/health-client/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | // See https://go.microsoft.com/fwlink/?LinkId=733558 3 | // for the documentation about the tasks.json format 4 | "version": "2.0.0", 5 | "tasks": [ 6 | { 7 | "type": "shell", 8 | "label": "run", 9 | "dependsOn": "tsc", 10 | "windows": { 11 | "command": "xcopy .env .\\dist /y" 12 | }, 13 | "osx": { 14 | "command": "cp .env ./dist" 15 | } 16 | }, 17 | { 18 | "type": "shell", 19 | "label": "tsc", 20 | "dependsOn": "clean", 21 | "command": "tsc", 22 | "problemMatcher": ["$tsc"] 23 | }, 24 | { 25 | "type": "shell", 26 | "label": "clean", 27 | "command": "npx rimraf dist" 28 | } 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /packages/report-generator-job-manager/docker-image-config/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | FROM mcr.microsoft.com/windows/servercore:ltsc2022-amd64 5 | 6 | ENV NODE_VERSION 20.15.0 7 | 8 | WORKDIR /app 9 | 10 | # Install Node.js 11 | RUN powershell Set-ExecutionPolicy RemoteSigned 12 | RUN powershell -Command \ 13 | Invoke-WebRequest $('https://nodejs.org/dist/v{0}/node-v{0}-win-x64.zip' -f $env:NODE_VERSION) -OutFile 'node.zip' -UseBasicParsing ; \ 14 | Expand-Archive node.zip -DestinationPath / ; \ 15 | Rename-Item -Path $('C:\node-v{0}-win-x64' -f $env:NODE_VERSION) -NewName 'C:\nodejs' 16 | RUN setx /m PATH "%PATH%;C:\nodejs" 17 | 18 | # Bundle app package 19 | COPY . . 20 | 21 | # Install app dependencies 22 | RUN npm install 23 | 24 | ENTRYPOINT ["powershell.exe", "./report-generator-job-manager.ps1"] 25 | -------------------------------------------------------------------------------- /packages/report-generator-runner/src/report-generator-runner-entry-point.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { Container } from 'inversify'; 5 | import { BaseTelemetryProperties, GlobalLogger } from 'logger'; 6 | import { ProcessEntryPointBase } from 'service-library'; 7 | import { Runner } from './runner/runner'; 8 | 9 | export class ReportGeneratorRunnerEntryPoint extends ProcessEntryPointBase { 10 | protected getTelemetryBaseProperties(): BaseTelemetryProperties { 11 | return { source: 'reportGeneratorRunner' }; 12 | } 13 | 14 | protected async runCustomAction(container: Container): Promise { 15 | const logger = container.get(GlobalLogger); 16 | await logger.setup(); 17 | 18 | const runner = container.get(Runner); 19 | await runner.run(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /packages/scanner-global-library/src/authenticator/login-page-client-factory.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { injectable, inject } from 'inversify'; 5 | import { AuthenticationType } from 'storage-documents'; 6 | import { AzureLoginPageClient, LoginPageClient } from './azure-login-page-client'; 7 | 8 | @injectable() 9 | export class LoginPageClientFactory { 10 | constructor(@inject(AzureLoginPageClient) private readonly azureLoginPageClient: AzureLoginPageClient) {} 11 | 12 | public getPageClient(authenticationType: AuthenticationType): LoginPageClient { 13 | switch (authenticationType) { 14 | case 'entraId': 15 | return this.azureLoginPageClient; 16 | case 'undetermined': 17 | default: 18 | return undefined; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | #### Details 2 | 3 | 4 | 5 | ##### Motivation 6 | 7 | 8 | 9 | ##### Context 10 | 11 | 12 | 13 | 14 | 15 | #### Pull request checklist 16 | 17 | 18 | - [ ] Addresses an existing issue: Fixes #0000 19 | - [ ] Added relevant unit test for your changes. (`yarn test`) 20 | - [ ] Verified code coverage for the changes made. Check coverage report at: `/test-results/unit/coverage` 21 | - [ ] Ran precheckin (`yarn precheckin`) 22 | - [ ] Validated in an Azure resource group 23 | -------------------------------------------------------------------------------- /packages/crawler/src/crawler.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { interfaces } from 'inversify'; 5 | import { CrawlerConfiguration } from './crawler/crawler-configuration'; 6 | import { CrawlerEngine } from './crawler/crawler-engine'; 7 | import { CrawlerRunOptions } from './types/crawler-run-options'; 8 | import { crawlerIocTypes } from './types/ioc-types'; 9 | 10 | export class Crawler { 11 | constructor(private readonly container: interfaces.Container) {} 12 | 13 | public async crawl(crawlerRunOptions: CrawlerRunOptions): Promise { 14 | const crawlerConfig = this.container.get(CrawlerConfiguration); 15 | crawlerConfig.setCrawlerRunOptions(crawlerRunOptions); 16 | 17 | return (this.container.get(crawlerIocTypes.CrawlerEngine) as CrawlerEngine).start(crawlerRunOptions); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /packages/web-api-send-notification-runner/docker-image-config/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | FROM mcr.microsoft.com/windows/servercore:ltsc2022-amd64 5 | 6 | ENV NODE_VERSION 20.15.0 7 | 8 | WORKDIR /app 9 | 10 | # Install Node.js 11 | RUN powershell Set-ExecutionPolicy RemoteSigned 12 | RUN powershell -Command \ 13 | Invoke-WebRequest $('https://nodejs.org/dist/v{0}/node-v{0}-win-x64.zip' -f $env:NODE_VERSION) -OutFile 'node.zip' -UseBasicParsing ; \ 14 | Expand-Archive node.zip -DestinationPath / ; \ 15 | Rename-Item -Path $('C:\node-v{0}-win-x64' -f $env:NODE_VERSION) -NewName 'C:\nodejs' 16 | RUN setx /m PATH "%PATH%;C:\nodejs" 17 | 18 | # Bundle app package 19 | COPY . . 20 | 21 | # Install app dependencies 22 | RUN npm install 23 | 24 | ENTRYPOINT ["powershell.exe", "./web-api-send-notification-runner.ps1"] 25 | -------------------------------------------------------------------------------- /packages/crawler/src/build-utilities/monorepo-packages.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import * as fs from 'fs'; 5 | import * as path from 'path'; 6 | 7 | /* eslint-disable security/detect-non-literal-fs-filename */ 8 | 9 | export function listMonorepoPackageNames(): string[] { 10 | const packagesDir = path.join(__dirname, '../../../'); 11 | const packageDirNames = fs.readdirSync(packagesDir); 12 | 13 | return packageDirNames 14 | .map((dirName) => { 15 | const packageJsonPath = path.join(packagesDir, dirName, 'package.json'); 16 | if (!fs.existsSync(packageJsonPath)) { 17 | return null; 18 | } 19 | 20 | return JSON.parse(fs.readFileSync(packageJsonPath).toString()).name; 21 | }) 22 | .filter((name): name is string => name != null); 23 | } 24 | -------------------------------------------------------------------------------- /packages/privacy-scan-job-manager/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | // See https://go.microsoft.com/fwlink/?LinkId=733558 3 | // for the documentation about the tasks.json format 4 | "version": "2.0.0", 5 | "tasks": [ 6 | { 7 | "type": "shell", 8 | "label": "run", 9 | "dependsOn": "tsc", 10 | "windows": { 11 | "command": "xcopy .env .\\dist /y" 12 | }, 13 | "osx": { 14 | "command": "cp .env ./dist" 15 | } 16 | }, 17 | { 18 | "type": "shell", 19 | "label": "tsc", 20 | "dependsOn": "clean", 21 | "command": "tsc", 22 | "problemMatcher": ["$tsc"] 23 | }, 24 | { 25 | "type": "shell", 26 | "label": "clean", 27 | "command": "npx rimraf dist" 28 | } 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /packages/report-generator-runner/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | // See https://go.microsoft.com/fwlink/?LinkId=733558 3 | // for the documentation about the tasks.json format 4 | "version": "2.0.0", 5 | "tasks": [ 6 | { 7 | "type": "shell", 8 | "label": "run", 9 | "dependsOn": "tsc", 10 | "windows": { 11 | "command": "xcopy .env .\\dist /y" 12 | }, 13 | "osx": { 14 | "command": "cp .env ./dist" 15 | } 16 | }, 17 | { 18 | "type": "shell", 19 | "label": "tsc", 20 | "dependsOn": "clean", 21 | "command": "tsc", 22 | "problemMatcher": ["$tsc"] 23 | }, 24 | { 25 | "type": "shell", 26 | "label": "clean", 27 | "command": "npx rimraf dist" 28 | } 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /packages/web-api-scan-job-manager/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | // See https://go.microsoft.com/fwlink/?LinkId=733558 3 | // for the documentation about the tasks.json format 4 | "version": "2.0.0", 5 | "tasks": [ 6 | { 7 | "type": "shell", 8 | "label": "run", 9 | "dependsOn": "tsc", 10 | "windows": { 11 | "command": "xcopy .env .\\dist /y" 12 | }, 13 | "osx": { 14 | "command": "cp .env ./dist" 15 | } 16 | }, 17 | { 18 | "type": "shell", 19 | "label": "tsc", 20 | "dependsOn": "clean", 21 | "command": "tsc", 22 | "problemMatcher": ["$tsc"] 23 | }, 24 | { 25 | "type": "shell", 26 | "label": "clean", 27 | "command": "npx rimraf dist" 28 | } 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /packages/common/src/ciphers/jump-consistent-hash.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | /* eslint-disable @typescript-eslint/restrict-plus-operands, no-bitwise */ 5 | 6 | /** 7 | * Based on whitepaper 'A Fast, Minimal Memory, Consistent Hash Algorithm' https://arxiv.org/abs/1406.2294 8 | */ 9 | export class JumpConsistentHash { 10 | public getBucket(key: number | string | bigint, buckets: number): number { 11 | let keyBigInt = BigInt(key); 12 | let b = -1n; 13 | let j = 0n; 14 | const div = 2n ** 64n; 15 | while (j < buckets) { 16 | b = j; 17 | keyBigInt = ((keyBigInt * 2862933555777941757n) % div) + 1n; 18 | j = BigInt(Math.floor(((Number(b) + 1) * Number(1n << 31n)) / Number((keyBigInt >> 33n) + 1n))); 19 | } 20 | 21 | return Number(b); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/crawler/src/common/jump-consistent-hash.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | /* eslint-disable @typescript-eslint/restrict-plus-operands, no-bitwise */ 5 | 6 | /** 7 | * Based on whitepaper 'A Fast, Minimal Memory, Consistent Hash Algorithm' https://arxiv.org/abs/1406.2294 8 | */ 9 | export class JumpConsistentHash { 10 | public getBucket(key: number | string | bigint, buckets: number): number { 11 | let keyBigInt = BigInt(key); 12 | let b = -1n; 13 | let j = 0n; 14 | const div = 2n ** 64n; 15 | while (j < buckets) { 16 | b = j; 17 | keyBigInt = ((keyBigInt * 2862933555777941757n) % div) + 1n; 18 | j = BigInt(Math.floor(((Number(b) + 1) * Number(1n << 31n)) / Number((keyBigInt >> 33n) + 1n))); 19 | } 20 | 21 | return Number(b); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/crawler/src/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | export { CrawlerRunOptions } from './types/crawler-run-options'; 5 | export * from './types/ioc-types'; 6 | export { Crawler } from './crawler'; 7 | export { setupCrawlerContainer } from './setup-crawler-container'; 8 | export * from './level-storage/storage-documents'; 9 | export { DbScanResultReader } from './scan-result-providers/db-scan-result-reader'; 10 | export { getDiscoveryPatternForUrl, DiscoveryPatternFactory } from './apify/discovery-patterns'; 11 | export * from './common/system'; 12 | export * from './common/url'; 13 | export { ensureDirectory } from './common/ensure-directory'; 14 | export { listMonorepoPackageNames } from './build-utilities/monorepo-packages'; 15 | export { HashGenerator } from './common/hash-generator'; 16 | export { HashSet } from './common/hash-set'; 17 | -------------------------------------------------------------------------------- /packages/report-generator-job-manager/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | // See https://go.microsoft.com/fwlink/?LinkId=733558 3 | // for the documentation about the tasks.json format 4 | "version": "2.0.0", 5 | "tasks": [ 6 | { 7 | "type": "shell", 8 | "label": "run", 9 | "dependsOn": "tsc", 10 | "windows": { 11 | "command": "xcopy .env .\\dist /y" 12 | }, 13 | "osx": { 14 | "command": "cp .env ./dist" 15 | } 16 | }, 17 | { 18 | "type": "shell", 19 | "label": "tsc", 20 | "dependsOn": "clean", 21 | "command": "tsc", 22 | "problemMatcher": ["$tsc"] 23 | }, 24 | { 25 | "type": "shell", 26 | "label": "clean", 27 | "command": "npx rimraf dist" 28 | } 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /packages/web-api-scan-request-sender/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | // See https://go.microsoft.com/fwlink/?LinkId=733558 3 | // for the documentation about the tasks.json format 4 | "version": "2.0.0", 5 | "tasks": [ 6 | { 7 | "type": "shell", 8 | "label": "run", 9 | "dependsOn": "tsc", 10 | "windows": { 11 | "command": "xcopy .env .\\dist /y" 12 | }, 13 | "osx": { 14 | "command": "cp .env ./dist" 15 | } 16 | }, 17 | { 18 | "type": "shell", 19 | "label": "tsc", 20 | "dependsOn": "clean", 21 | "command": "tsc", 22 | "problemMatcher": ["$tsc"] 23 | }, 24 | { 25 | "type": "shell", 26 | "label": "clean", 27 | "command": "npx rimraf dist" 28 | } 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /packages/web-api-send-notification-job-manager/docker-image-config/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | FROM mcr.microsoft.com/windows/servercore:ltsc2022-amd64 5 | 6 | ENV NODE_VERSION 20.15.0 7 | 8 | WORKDIR /app 9 | 10 | # Install Node.js 11 | RUN powershell Set-ExecutionPolicy RemoteSigned 12 | RUN powershell -Command \ 13 | Invoke-WebRequest $('https://nodejs.org/dist/v{0}/node-v{0}-win-x64.zip' -f $env:NODE_VERSION) -OutFile 'node.zip' -UseBasicParsing ; \ 14 | Expand-Archive node.zip -DestinationPath / ; \ 15 | Rename-Item -Path $('C:\node-v{0}-win-x64' -f $env:NODE_VERSION) -NewName 'C:\nodejs' 16 | RUN setx /m PATH "%PATH%;C:\nodejs" 17 | 18 | # Bundle app package 19 | COPY . . 20 | 21 | # Install app dependencies 22 | RUN npm install 23 | 24 | ENTRYPOINT ["powershell.exe", "./web-api-send-notification-job-manager.ps1"] 25 | -------------------------------------------------------------------------------- /packages/health-client/package-ext.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "health-client", 3 | "version": "1.0.0", 4 | "description": "This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.", 5 | "repository": { 6 | "type": "git", 7 | "url": "git+https://github.com/Microsoft/accessibility-insights-service.git" 8 | }, 9 | "main": "dist/index.js", 10 | "author": "Microsoft", 11 | "license": "MIT", 12 | "bugs": { 13 | "url": "https://github.com/Microsoft/accessibility-insights-service/issues" 14 | }, 15 | "homepage": "https://github.com/Microsoft/accessibility-insights-service#readme", 16 | "dependencies": { 17 | "yargs": "^17.7.2" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /packages/web-api-send-notification-runner/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | // See https://go.microsoft.com/fwlink/?LinkId=733558 3 | // for the documentation about the tasks.json format 4 | "version": "2.0.0", 5 | "tasks": [ 6 | { 7 | "type": "shell", 8 | "label": "run", 9 | "dependsOn": "tsc", 10 | "windows": { 11 | "command": "xcopy .env .\\dist /y" 12 | }, 13 | "osx": { 14 | "command": "cp .env ./dist" 15 | } 16 | }, 17 | { 18 | "type": "shell", 19 | "label": "tsc", 20 | "dependsOn": "clean", 21 | "command": "tsc", 22 | "problemMatcher": ["$tsc"] 23 | }, 24 | { 25 | "type": "shell", 26 | "label": "clean", 27 | "command": "npx rimraf dist" 28 | } 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /packages/cli/src/converter/ai-data-converter.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { inject, injectable } from 'inversify'; 5 | import { CombinedReportParameters } from 'accessibility-insights-report'; 6 | import { CombinedReportDataConverter } from './combined-report-data-converter'; 7 | import { AxeCoreResults } from './axe-result-types'; 8 | import { ScanResultData } from './scan-result-data'; 9 | 10 | @injectable() 11 | export class AICombinedReportDataConverter { 12 | constructor(@inject(CombinedReportDataConverter) private readonly combinedReportDataConverter: CombinedReportDataConverter) {} 13 | 14 | public convertCrawlingResults(combinedAxeResults: AxeCoreResults, scanResultData: ScanResultData): CombinedReportParameters { 15 | return this.combinedReportDataConverter.convert(combinedAxeResults, scanResultData); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /packages/web-api-send-notification-job-manager/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | // See https://go.microsoft.com/fwlink/?LinkId=733558 3 | // for the documentation about the tasks.json format 4 | "version": "2.0.0", 5 | "tasks": [ 6 | { 7 | "type": "shell", 8 | "label": "run", 9 | "dependsOn": "tsc", 10 | "windows": { 11 | "command": "xcopy .env .\\dist /y" 12 | }, 13 | "osx": { 14 | "command": "cp .env ./dist" 15 | } 16 | }, 17 | { 18 | "type": "shell", 19 | "label": "tsc", 20 | "dependsOn": "clean", 21 | "command": "tsc", 22 | "problemMatcher": ["$tsc"] 23 | }, 24 | { 25 | "type": "shell", 26 | "label": "clean", 27 | "command": "npx rimraf dist" 28 | } 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /packages/service-library/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | // See https://go.microsoft.com/fwlink/?LinkId=733558 3 | // for the documentation about the tasks.json format 4 | "version": "2.0.0", 5 | "tasks": [ 6 | { 7 | "type": "shell", 8 | "label": "run", 9 | "dependsOn": "tsc", 10 | "windows": { 11 | "command": "xcopy .env .\\dist\\dev-utilities /y" 12 | }, 13 | "osx": { 14 | "command": "cp .env ./dist/dev-utilities" 15 | } 16 | }, 17 | { 18 | "type": "shell", 19 | "label": "tsc", 20 | "dependsOn": "clean", 21 | "command": "tsc", 22 | "problemMatcher": ["$tsc"] 23 | }, 24 | { 25 | "type": "shell", 26 | "label": "clean", 27 | "command": "npx rimraf dist" 28 | } 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /packages/storage-documents/src/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | export * from './item-type'; 5 | export * from './on-demand-page-scan-result'; 6 | export * from './report-generator-request'; 7 | export * from './storage-document'; 8 | export * from './on-demand-page-scan-batch-request'; 9 | export * from './partition-key'; 10 | export * from './on-demand-page-scan-request'; 11 | export * from './on-demand-scan-request-message'; 12 | export * from './on-demand-notification-request-message'; 13 | export * from './batch-pool-load-snapshot'; 14 | export * from './website-scan-data'; 15 | export * from './combined-scan-results'; 16 | export * from './privacy-scan-types/privacy-page-scan-report'; 17 | export * from './privacy-scan-types/privacy-scan-combined-report'; 18 | export * from './known-page-type-converter'; 19 | export * from './request-type-converter'; 20 | -------------------------------------------------------------------------------- /packages/privacy-scan-job-manager/src/privacy-scan-job-manager-entry-point.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { Container } from 'inversify'; 5 | import { BaseTelemetryProperties, GlobalLogger } from 'logger'; 6 | import { ProcessEntryPointBase } from 'service-library'; 7 | import { Worker } from './worker/worker'; 8 | 9 | export class PrivacyScanJobManagerEntryPoint extends ProcessEntryPointBase { 10 | protected getTelemetryBaseProperties(): BaseTelemetryProperties { 11 | return { source: 'privacyScanJobManager' }; 12 | } 13 | 14 | protected async runCustomAction(container: Container): Promise { 15 | const logger = container.get(GlobalLogger); 16 | await logger.setup(); 17 | 18 | const worker = container.get(Worker); 19 | await worker.init(); 20 | await worker.run(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /packages/web-api-scan-job-manager/src/web-api-scan-job-manager-entry-point.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { Container } from 'inversify'; 5 | import { BaseTelemetryProperties, GlobalLogger } from 'logger'; 6 | import { ProcessEntryPointBase } from 'service-library'; 7 | import { Worker } from './worker/worker'; 8 | 9 | export class WebApiScanJobManagerEntryPoint extends ProcessEntryPointBase { 10 | protected getTelemetryBaseProperties(): BaseTelemetryProperties { 11 | return { source: 'webApiScanJobManager' }; 12 | } 13 | 14 | protected async runCustomAction(container: Container): Promise { 15 | const logger = container.get(GlobalLogger); 16 | await logger.setup(); 17 | 18 | const worker = container.get(Worker); 19 | await worker.init(); 20 | await worker.run(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /packages/cli/src/baseline/baseline-file-formatter.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { inject, injectable } from 'inversify'; 5 | import json5 from 'json5'; 6 | import { BaselineSchemaValidator } from './baseline-schema'; 7 | import { BaselineFileContent } from './baseline-types'; 8 | 9 | @injectable() 10 | export class BaselineFileFormatter { 11 | constructor(@inject(BaselineSchemaValidator) private readonly baselineSchemaValidator: BaselineSchemaValidator) {} 12 | 13 | public parse(rawBaselineContent: string): BaselineFileContent { 14 | const unvalidatedContent = json5.parse(rawBaselineContent); 15 | 16 | return this.baselineSchemaValidator.validate(unvalidatedContent); 17 | } 18 | 19 | public format(baselineContent: BaselineFileContent): string { 20 | return json5.stringify(baselineContent, null, 2); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /packages/crawler/src/page-handler/page-timeout-config.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | export const puppeteerTimeoutConfig = { 5 | /** 6 | * Maximum wait time, in milliseconds, to complete page navigation. 7 | */ 8 | navigationTimeoutMsec: 30000, 9 | 10 | /** 11 | * Maximum wait time, in milliseconds, to wait when network is idle. 12 | */ 13 | networkIdleTimeoutMsec: 25000, 14 | 15 | /** 16 | * Maximum wait time, in milliseconds, to complete async page rendering. 17 | */ 18 | pageRenderingTimeoutMsec: 15000, 19 | 20 | /** 21 | * The minimum time the HTML DOM should be stable to accept page rendering. 22 | */ 23 | pageDomStableTimeMsec: 1000, 24 | 25 | /** 26 | * Maximum wait time, in milliseconds, to scroll to the bottom of the page. 27 | */ 28 | scrollTimeoutMsec: 30000, 29 | }; 30 | -------------------------------------------------------------------------------- /packages/privacy-scan-runner/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "name": "Debug [*] privacy-scan-runner", 9 | "type": "node", 10 | "request": "launch", 11 | "outFiles": ["${workspaceFolder}/dist/**/*.js"], 12 | "cwd": "${workspaceFolder}", 13 | "program": "${workspaceFolder}/src/index.ts", 14 | "preLaunchTask": "run", 15 | "console": "integratedTerminal", 16 | "internalConsoleOptions": "neverOpen", 17 | "smartStep": true, 18 | "resolveSourceMapLocations": ["${workspaceFolder}/dist/**/*.js", "${workspaceFolder}/../**/dist/**/*.js"] 19 | } 20 | ] 21 | } 22 | --------------------------------------------------------------------------------