qa360 2.3.0 → 2.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +155 -262
- package/{cli/dist → dist}/commands/ai.js +1 -1
- package/{cli/dist → dist}/commands/ask.js +49 -22
- package/{cli/dist → dist}/commands/coverage.js +17 -4
- package/{cli/dist → dist}/commands/crawl.js +2 -2
- package/{cli/dist → dist}/commands/doctor.js +2 -2
- package/{cli/dist → dist}/commands/explain.js +2 -2
- package/{cli/dist → dist}/commands/flakiness.js +1 -1
- package/{cli/dist → dist}/commands/generate.js +12 -5
- package/{cli/dist → dist}/commands/history.js +1 -1
- package/{cli/dist → dist}/commands/monitor.js +3 -3
- package/{cli/dist → dist}/commands/ollama.js +14 -6
- package/{cli/dist → dist}/commands/pack.js +2 -2
- package/{cli/dist → dist}/commands/regression.js +1 -1
- package/{cli/dist → dist}/commands/repair.js +1 -1
- package/{cli/dist → dist}/commands/retry.js +1 -1
- package/{cli/dist → dist}/commands/run.d.ts +5 -1
- package/{cli/dist → dist}/commands/run.js +87 -1
- package/{cli/dist → dist}/commands/secrets.js +1 -1
- package/{cli/dist → dist}/commands/serve.js +1 -1
- package/{cli/dist → dist}/commands/slo.js +1 -1
- package/{cli/dist → dist}/commands/verify.js +1 -1
- package/{cli/dist → dist}/core/adapters/playwright-native-api.d.ts +2 -0
- package/{cli/dist → dist}/core/adapters/playwright-native-api.js +20 -1
- package/{cli/dist → dist}/core/adapters/playwright-ui.d.ts +21 -0
- package/dist/core/adapters/playwright-ui.js +2050 -0
- package/{cli/dist → dist}/core/ai/ollama-provider.d.ts +4 -0
- package/{cli/dist → dist}/core/ai/ollama-provider.js +41 -8
- package/{cli/dist → dist}/core/artifacts/ui-artifacts.js +24 -4
- package/dist/core/auth/backup-codes-provider.d.ts +91 -0
- package/dist/core/auth/backup-codes-provider.js +215 -0
- package/{cli/dist → dist}/core/auth/basic-auth-provider.d.ts +6 -0
- package/{cli/dist → dist}/core/auth/basic-auth-provider.js +24 -6
- package/dist/core/auth/digest-auth-provider.d.ts +116 -0
- package/dist/core/auth/digest-auth-provider.js +244 -0
- package/dist/core/auth/hcaptcha-handler.d.ts +103 -0
- package/dist/core/auth/hcaptcha-handler.js +288 -0
- package/{cli/dist → dist}/core/auth/index.d.ts +81 -4
- package/{cli/dist → dist}/core/auth/index.js +15 -1
- package/dist/core/auth/oauth-handler.d.ts +408 -0
- package/dist/core/auth/oauth-handler.js +636 -0
- package/{cli/dist → dist}/core/auth/oauth2-provider.d.ts +9 -0
- package/dist/core/auth/oauth2-provider.js +227 -0
- package/dist/core/auth/otp-provider.d.ts +93 -0
- package/dist/core/auth/otp-provider.js +288 -0
- package/dist/core/auth/recaptcha-handler.d.ts +119 -0
- package/dist/core/auth/recaptcha-handler.js +301 -0
- package/dist/core/auth/remember-me-handler.d.ts +142 -0
- package/dist/core/auth/remember-me-handler.js +255 -0
- package/dist/core/auth/saml-handler.d.ts +173 -0
- package/dist/core/auth/saml-handler.js +364 -0
- package/dist/core/auth/webauthn-handler.d.ts +182 -0
- package/dist/core/auth/webauthn-handler.js +310 -0
- package/dist/core/crawler/advanced-interactions.d.ts +342 -0
- package/dist/core/crawler/advanced-interactions.js +1069 -0
- package/dist/core/crawler/blob-url-download-handler.d.ts +145 -0
- package/dist/core/crawler/blob-url-download-handler.js +392 -0
- package/dist/core/crawler/consent-handler.d.ts +49 -0
- package/dist/core/crawler/consent-handler.js +258 -0
- package/dist/core/crawler/cookie-manager.d.ts +166 -0
- package/dist/core/crawler/cookie-manager.js +353 -0
- package/dist/core/crawler/coop-coep-handler.d.ts +136 -0
- package/dist/core/crawler/coop-coep-handler.js +338 -0
- package/dist/core/crawler/csp-handler.d.ts +151 -0
- package/dist/core/crawler/csp-handler.js +415 -0
- package/dist/core/crawler/download-handler.d.ts +155 -0
- package/dist/core/crawler/download-handler.js +370 -0
- package/dist/core/crawler/email-testing-handler.d.ts +214 -0
- package/dist/core/crawler/email-testing-handler.js +398 -0
- package/dist/core/crawler/error-tracking-handler.d.ts +177 -0
- package/dist/core/crawler/error-tracking-handler.js +378 -0
- package/dist/core/crawler/form-handler.d.ts +100 -0
- package/dist/core/crawler/form-handler.js +465 -0
- package/dist/core/crawler/framework-wait-handler.d.ts +96 -0
- package/dist/core/crawler/framework-wait-handler.js +464 -0
- package/dist/core/crawler/geolocation-handler.d.ts +112 -0
- package/dist/core/crawler/geolocation-handler.js +276 -0
- package/dist/core/crawler/index.d.ts +78 -0
- package/{cli/dist → dist}/core/crawler/index.js +74 -1
- package/dist/core/crawler/intelligent-selector-generator.d.ts +164 -0
- package/dist/core/crawler/intelligent-selector-generator.js +612 -0
- package/{cli/dist → dist}/core/crawler/journey-generator.js +44 -1
- package/{cli/dist → dist}/core/crawler/page-analyzer.d.ts +16 -1
- package/{cli/dist → dist}/core/crawler/page-analyzer.js +469 -17
- package/dist/core/crawler/permissions-handler.d.ts +112 -0
- package/dist/core/crawler/permissions-handler.js +236 -0
- package/dist/core/crawler/permissions-policy-handler.d.ts +113 -0
- package/dist/core/crawler/permissions-policy-handler.js +402 -0
- package/dist/core/crawler/presets.d.ts +100 -0
- package/dist/core/crawler/presets.js +887 -0
- package/dist/core/crawler/repl-debug-handler.d.ts +105 -0
- package/dist/core/crawler/repl-debug-handler.js +552 -0
- package/dist/core/crawler/reporting-api-handler.d.ts +212 -0
- package/dist/core/crawler/reporting-api-handler.js +344 -0
- package/{cli/dist → dist}/core/crawler/selector-generator.d.ts +9 -0
- package/{cli/dist → dist}/core/crawler/selector-generator.js +99 -23
- package/dist/core/crawler/site-profiler.d.ts +89 -0
- package/dist/core/crawler/site-profiler.js +290 -0
- package/dist/core/crawler/sourcemaps-handler.d.ts +144 -0
- package/dist/core/crawler/sourcemaps-handler.js +420 -0
- package/dist/core/crawler/stacked-modals-handler.d.ts +118 -0
- package/dist/core/crawler/stacked-modals-handler.js +429 -0
- package/dist/core/crawler/trusted-types-handler.d.ts +149 -0
- package/dist/core/crawler/trusted-types-handler.js +413 -0
- package/{cli/dist → dist}/core/crawler/types.d.ts +68 -2
- package/dist/core/crawler/wait-strategies.d.ts +108 -0
- package/dist/core/crawler/wait-strategies.js +399 -0
- package/dist/core/fixtures/factories.d.ts +180 -0
- package/dist/core/fixtures/factories.js +279 -0
- package/dist/core/fixtures/index.d.ts +6 -0
- package/dist/core/fixtures/index.js +6 -0
- package/{cli/dist → dist}/core/generation/crawler-pack-generator.d.ts +13 -3
- package/dist/core/generation/crawler-pack-generator.js +232 -0
- package/{cli/dist → dist}/core/generation/index.d.ts +2 -0
- package/{cli/dist → dist}/core/generation/index.js +2 -0
- package/{cli/dist → dist}/core/index.d.ts +2 -0
- package/{cli/dist → dist}/core/index.js +4 -0
- package/dist/core/network/index.d.ts +7 -0
- package/dist/core/network/index.js +7 -0
- package/dist/core/network/network-manager.d.ts +237 -0
- package/dist/core/network/network-manager.js +343 -0
- package/dist/core/network/network-simulator.d.ts +158 -0
- package/dist/core/network/network-simulator.js +261 -0
- package/{cli/dist → dist}/core/pack/validator.js +2 -2
- package/{cli/dist → dist}/core/pack-v2/migrator.d.ts +5 -0
- package/{cli/dist → dist}/core/pack-v2/migrator.js +81 -6
- package/{cli/dist → dist}/core/pack-v2/validator.js +4 -3
- package/{cli/dist → dist}/core/pom/base-page.js +1 -1
- package/{cli/dist → dist}/core/pom/loader.js +1 -1
- package/dist/core/reporting/index.d.ts +9 -0
- package/dist/core/reporting/index.js +10 -0
- package/dist/core/reporting/junit-reporter.d.ts +114 -0
- package/dist/core/reporting/junit-reporter.js +306 -0
- package/{cli/dist → dist}/core/runner/e2e-helpers.d.ts +1 -1
- package/{cli/dist → dist}/core/runner/e2e-helpers.js +2 -2
- package/{cli/dist → dist}/core/runner/phase3-runner.d.ts +3 -0
- package/{cli/dist → dist}/core/runner/phase3-runner.js +45 -14
- package/dist/core/sharding/test-sharding.d.ts +137 -0
- package/dist/core/sharding/test-sharding.js +233 -0
- package/dist/core/storage/cookie-manager.d.ts +160 -0
- package/dist/core/storage/cookie-manager.js +268 -0
- package/dist/core/storage/index.d.ts +7 -0
- package/dist/core/storage/index.js +7 -0
- package/dist/core/storage/storage-helpers.d.ts +138 -0
- package/dist/core/storage/storage-helpers.js +315 -0
- package/dist/core/test-helpers/index.d.ts +6 -0
- package/dist/core/test-helpers/index.js +6 -0
- package/dist/core/test-helpers/state-reset.d.ts +119 -0
- package/dist/core/test-helpers/state-reset.js +234 -0
- package/{cli/dist → dist}/core/types/pack-v1.d.ts +15 -2
- package/{cli/dist → dist}/core/types/pack-v2.d.ts +1 -1
- package/dist/core/upload/chunked-uploader.d.ts +150 -0
- package/dist/core/upload/chunked-uploader.js +289 -0
- package/dist/core/upload/index.d.ts +11 -0
- package/dist/core/upload/index.js +8 -0
- package/dist/core/upload/mime-validator.d.ts +119 -0
- package/dist/core/upload/mime-validator.js +373 -0
- package/dist/core/upload/presigned-uploader.d.ts +118 -0
- package/dist/core/upload/presigned-uploader.js +274 -0
- package/dist/core/utils/device-emulation.d.ts +194 -0
- package/dist/core/utils/device-emulation.js +380 -0
- package/dist/core/utils/index.d.ts +8 -0
- package/dist/core/utils/index.js +8 -0
- package/dist/core/utils/retry.d.ts +145 -0
- package/dist/core/utils/retry.js +242 -0
- package/dist/core/utils/smart-wait.d.ts +133 -0
- package/dist/core/utils/smart-wait.js +417 -0
- package/dist/core/visual/index.d.ts +7 -0
- package/dist/core/visual/index.js +7 -0
- package/dist/core/visual/pixel-diff.d.ts +87 -0
- package/dist/core/visual/pixel-diff.js +213 -0
- package/dist/core/visual/screenshot-helper.d.ts +130 -0
- package/dist/core/visual/screenshot-helper.js +223 -0
- package/{cli/dist → dist}/index.js +2 -3
- package/{cli/dist → dist}/utils/config.d.ts +1 -1
- package/{cli/dist → dist}/utils/config.js +36 -3
- package/examples/README.md +160 -0
- package/examples/accessibility.yml +48 -0
- package/examples/api-basic.yml +27 -0
- package/examples/complete.yml +146 -0
- package/examples/crawler.yml +38 -0
- package/examples/fullstack.yml +78 -0
- package/examples/security.yml +58 -0
- package/examples/ui-advanced.yml +49 -0
- package/examples/ui-basic.yml +24 -0
- package/package.json +33 -67
- package/CHANGELOG.md +0 -330
- package/CONTRIBUTING.md +0 -273
- package/QUICK_START.md +0 -191
- package/cli/CHANGELOG.md +0 -84
- package/cli/LICENSE +0 -24
- package/cli/README.md +0 -222
- package/cli/dist/core/adapters/playwright-ui.js +0 -864
- package/cli/dist/core/auth/oauth2-provider.js +0 -114
- package/cli/dist/core/coverage/analyzer.d.ts +0 -101
- package/cli/dist/core/coverage/analyzer.js +0 -415
- package/cli/dist/core/coverage/collector.d.ts +0 -74
- package/cli/dist/core/coverage/collector.js +0 -459
- package/cli/dist/core/coverage/config.d.ts +0 -37
- package/cli/dist/core/coverage/config.js +0 -156
- package/cli/dist/core/coverage/index.d.ts +0 -11
- package/cli/dist/core/coverage/index.js +0 -15
- package/cli/dist/core/coverage/types.d.ts +0 -267
- package/cli/dist/core/coverage/types.js +0 -6
- package/cli/dist/core/coverage/vault.d.ts +0 -95
- package/cli/dist/core/coverage/vault.js +0 -405
- package/cli/dist/core/crawler/index.d.ts +0 -57
- package/cli/dist/core/fixtures/index.d.ts +0 -8
- package/cli/dist/core/fixtures/index.js +0 -8
- package/cli/dist/core/generation/crawler-pack-generator.js +0 -231
- package/cli/dist/core/reporting/index.d.ts +0 -6
- package/cli/dist/core/reporting/index.js +0 -6
- package/cli/dist/core/visual/index.d.ts +0 -6
- package/cli/dist/core/visual/index.js +0 -6
- package/cli/package.json +0 -76
- package/core/LICENSE +0 -24
- package/core/README.md +0 -105
- package/core/package.json +0 -90
- package/core/schemas/pack.schema.json +0 -236
- /package/{cli/bin → bin}/qa360.js +0 -0
- /package/{cli/dist → dist}/cli-minimal.d.ts +0 -0
- /package/{cli/dist → dist}/cli-minimal.js +0 -0
- /package/{cli/dist → dist}/commands/ai.d.ts +0 -0
- /package/{cli/dist → dist}/commands/ask.d.ts +0 -0
- /package/{cli/dist → dist}/commands/coverage.d.ts +0 -0
- /package/{cli/dist → dist}/commands/crawl.d.ts +0 -0
- /package/{cli/dist → dist}/commands/doctor.d.ts +0 -0
- /package/{cli/dist → dist}/commands/examples.d.ts +0 -0
- /package/{cli/dist → dist}/commands/examples.js +0 -0
- /package/{cli/dist → dist}/commands/explain.d.ts +0 -0
- /package/{cli/dist → dist}/commands/flakiness.d.ts +0 -0
- /package/{cli/dist → dist}/commands/generate.d.ts +0 -0
- /package/{cli/dist → dist}/commands/history.d.ts +0 -0
- /package/{cli/dist → dist}/commands/init.d.ts +0 -0
- /package/{cli/dist → dist}/commands/init.js +0 -0
- /package/{cli/dist → dist}/commands/monitor.d.ts +0 -0
- /package/{cli/dist → dist}/commands/ollama.d.ts +0 -0
- /package/{cli/dist → dist}/commands/pack.d.ts +0 -0
- /package/{cli/dist → dist}/commands/regression.d.ts +0 -0
- /package/{cli/dist → dist}/commands/repair.d.ts +0 -0
- /package/{cli/dist → dist}/commands/report.d.ts +0 -0
- /package/{cli/dist → dist}/commands/report.js +0 -0
- /package/{cli/dist → dist}/commands/retry.d.ts +0 -0
- /package/{cli/dist → dist}/commands/scan.d.ts +0 -0
- /package/{cli/dist → dist}/commands/scan.js +0 -0
- /package/{cli/dist → dist}/commands/secrets.d.ts +0 -0
- /package/{cli/dist → dist}/commands/serve.d.ts +0 -0
- /package/{cli/dist → dist}/commands/slo.d.ts +0 -0
- /package/{cli/dist → dist}/commands/verify.d.ts +0 -0
- /package/{cli/dist → dist}/core/adapters/gitleaks-secrets.d.ts +0 -0
- /package/{cli/dist → dist}/core/adapters/gitleaks-secrets.js +0 -0
- /package/{cli/dist → dist}/core/adapters/jest-adapter.d.ts +0 -0
- /package/{cli/dist → dist}/core/adapters/jest-adapter.js +0 -0
- /package/{cli/dist → dist}/core/adapters/k6-perf.d.ts +0 -0
- /package/{cli/dist → dist}/core/adapters/k6-perf.js +0 -0
- /package/{cli/dist → dist}/core/adapters/osv-deps.d.ts +0 -0
- /package/{cli/dist → dist}/core/adapters/osv-deps.js +0 -0
- /package/{cli/dist → dist}/core/adapters/playwright-native-adapter.d.ts +0 -0
- /package/{cli/dist → dist}/core/adapters/playwright-native-adapter.js +0 -0
- /package/{cli/dist → dist}/core/adapters/pytest-adapter.d.ts +0 -0
- /package/{cli/dist → dist}/core/adapters/pytest-adapter.js +0 -0
- /package/{cli/dist → dist}/core/adapters/semgrep-sast.d.ts +0 -0
- /package/{cli/dist → dist}/core/adapters/semgrep-sast.js +0 -0
- /package/{cli/dist → dist}/core/adapters/unit-test-types.d.ts +0 -0
- /package/{cli/dist → dist}/core/adapters/unit-test-types.js +0 -0
- /package/{cli/dist → dist}/core/adapters/vitest-adapter.d.ts +0 -0
- /package/{cli/dist → dist}/core/adapters/vitest-adapter.js +0 -0
- /package/{cli/dist → dist}/core/adapters/zap-dast.d.ts +0 -0
- /package/{cli/dist → dist}/core/adapters/zap-dast.js +0 -0
- /package/{cli/dist → dist}/core/ai/anthropic-provider.d.ts +0 -0
- /package/{cli/dist → dist}/core/ai/anthropic-provider.js +0 -0
- /package/{cli/dist → dist}/core/ai/deepseek-provider.d.ts +0 -0
- /package/{cli/dist → dist}/core/ai/deepseek-provider.js +0 -0
- /package/{cli/dist → dist}/core/ai/index.d.ts +0 -0
- /package/{cli/dist → dist}/core/ai/index.js +0 -0
- /package/{cli/dist → dist}/core/ai/llm-client.d.ts +0 -0
- /package/{cli/dist → dist}/core/ai/llm-client.js +0 -0
- /package/{cli/dist → dist}/core/ai/mock-provider.d.ts +0 -0
- /package/{cli/dist → dist}/core/ai/mock-provider.js +0 -0
- /package/{cli/dist → dist}/core/ai/openai-provider.d.ts +0 -0
- /package/{cli/dist → dist}/core/ai/openai-provider.js +0 -0
- /package/{cli/dist → dist}/core/ai/provider-factory.d.ts +0 -0
- /package/{cli/dist → dist}/core/ai/provider-factory.js +0 -0
- /package/{cli/dist → dist}/core/artifacts/index.d.ts +0 -0
- /package/{cli/dist → dist}/core/artifacts/index.js +0 -0
- /package/{cli/dist → dist}/core/artifacts/ui-artifacts.d.ts +0 -0
- /package/{cli/dist → dist}/core/assertions/engine.d.ts +0 -0
- /package/{cli/dist → dist}/core/assertions/engine.js +0 -0
- /package/{cli/dist → dist}/core/assertions/index.d.ts +0 -0
- /package/{cli/dist → dist}/core/assertions/index.js +0 -0
- /package/{cli/dist → dist}/core/assertions/types.d.ts +0 -0
- /package/{cli/dist → dist}/core/assertions/types.js +0 -0
- /package/{cli/dist → dist}/core/auth/api-key-provider.d.ts +0 -0
- /package/{cli/dist → dist}/core/auth/api-key-provider.js +0 -0
- /package/{cli/dist → dist}/core/auth/aws-iam-provider.d.ts +0 -0
- /package/{cli/dist → dist}/core/auth/aws-iam-provider.js +0 -0
- /package/{cli/dist → dist}/core/auth/azure-ad-provider.d.ts +0 -0
- /package/{cli/dist → dist}/core/auth/azure-ad-provider.js +0 -0
- /package/{cli/dist → dist}/core/auth/gcp-adc-provider.d.ts +0 -0
- /package/{cli/dist → dist}/core/auth/gcp-adc-provider.js +0 -0
- /package/{cli/dist → dist}/core/auth/jwt-provider.d.ts +0 -0
- /package/{cli/dist → dist}/core/auth/jwt-provider.js +0 -0
- /package/{cli/dist → dist}/core/auth/manager.d.ts +0 -0
- /package/{cli/dist → dist}/core/auth/manager.js +0 -0
- /package/{cli/dist → dist}/core/auth/totp-provider.d.ts +0 -0
- /package/{cli/dist → dist}/core/auth/totp-provider.js +0 -0
- /package/{cli/dist → dist}/core/auth/ui-login-provider.d.ts +0 -0
- /package/{cli/dist → dist}/core/auth/ui-login-provider.js +0 -0
- /package/{cli/dist → dist}/core/cache/index.d.ts +0 -0
- /package/{cli/dist → dist}/core/cache/index.js +0 -0
- /package/{cli/dist → dist}/core/cache/lru-cache.d.ts +0 -0
- /package/{cli/dist → dist}/core/cache/lru-cache.js +0 -0
- /package/{cli/dist/core → dist}/core/coverage/analyzer.d.ts +0 -0
- /package/{cli/dist/core → dist}/core/coverage/analyzer.js +0 -0
- /package/{cli/dist/core → dist}/core/coverage/collector.d.ts +0 -0
- /package/{cli/dist/core → dist}/core/coverage/collector.js +0 -0
- /package/{cli/dist/core → dist}/core/coverage/config.d.ts +0 -0
- /package/{cli/dist/core → dist}/core/coverage/config.js +0 -0
- /package/{cli/dist/core → dist}/core/coverage/index.d.ts +0 -0
- /package/{cli/dist/core → dist}/core/coverage/index.js +0 -0
- /package/{cli/dist/core → dist}/core/coverage/types.d.ts +0 -0
- /package/{cli/dist/core → dist}/core/coverage/types.js +0 -0
- /package/{cli/dist/core → dist}/core/coverage/vault.d.ts +0 -0
- /package/{cli/dist/core → dist}/core/coverage/vault.js +0 -0
- /package/{cli/dist → dist}/core/crawler/journey-generator.d.ts +0 -0
- /package/{cli/dist → dist}/core/crawler/types.js +0 -0
- /package/{cli/dist → dist}/core/dashboard/assets.d.ts +0 -0
- /package/{cli/dist → dist}/core/dashboard/assets.js +0 -0
- /package/{cli/dist → dist}/core/dashboard/index.d.ts +0 -0
- /package/{cli/dist → dist}/core/dashboard/index.js +0 -0
- /package/{cli/dist → dist}/core/dashboard/server.d.ts +0 -0
- /package/{cli/dist → dist}/core/dashboard/server.js +0 -0
- /package/{cli/dist → dist}/core/dashboard/types.d.ts +0 -0
- /package/{cli/dist → dist}/core/dashboard/types.js +0 -0
- /package/{cli/dist → dist}/core/discoverer/index.d.ts +0 -0
- /package/{cli/dist → dist}/core/discoverer/index.js +0 -0
- /package/{cli/dist → dist}/core/fixtures/loader.d.ts +0 -0
- /package/{cli/dist → dist}/core/fixtures/loader.js +0 -0
- /package/{cli/dist → dist}/core/fixtures/resolver.d.ts +0 -0
- /package/{cli/dist → dist}/core/fixtures/resolver.js +0 -0
- /package/{cli/dist → dist}/core/fixtures/types.d.ts +0 -0
- /package/{cli/dist → dist}/core/fixtures/types.js +0 -0
- /package/{cli/dist → dist}/core/flakiness/index.d.ts +0 -0
- /package/{cli/dist → dist}/core/flakiness/index.js +0 -0
- /package/{cli/dist → dist}/core/generation/code-formatter.d.ts +0 -0
- /package/{cli/dist → dist}/core/generation/code-formatter.js +0 -0
- /package/{cli/dist → dist}/core/generation/code-generator.d.ts +0 -0
- /package/{cli/dist → dist}/core/generation/code-generator.js +0 -0
- /package/{cli/dist → dist}/core/generation/generator.d.ts +0 -0
- /package/{cli/dist → dist}/core/generation/generator.js +0 -0
- /package/{cli/dist → dist}/core/generation/pack-generator.d.ts +0 -0
- /package/{cli/dist → dist}/core/generation/pack-generator.js +0 -0
- /package/{cli/dist → dist}/core/generation/prompt-builder.d.ts +0 -0
- /package/{cli/dist → dist}/core/generation/prompt-builder.js +0 -0
- /package/{cli/dist → dist}/core/generation/source-analyzer.d.ts +0 -0
- /package/{cli/dist → dist}/core/generation/source-analyzer.js +0 -0
- /package/{cli/dist → dist}/core/generation/test-optimizer.d.ts +0 -0
- /package/{cli/dist → dist}/core/generation/test-optimizer.js +0 -0
- /package/{cli/dist → dist}/core/generation/types.d.ts +0 -0
- /package/{cli/dist → dist}/core/generation/types.js +0 -0
- /package/{cli/dist → dist}/core/hooks/compose.d.ts +0 -0
- /package/{cli/dist → dist}/core/hooks/compose.js +0 -0
- /package/{cli/dist → dist}/core/hooks/runner.d.ts +0 -0
- /package/{cli/dist → dist}/core/hooks/runner.js +0 -0
- /package/{cli/dist → dist}/core/pack/migrator.d.ts +0 -0
- /package/{cli/dist → dist}/core/pack/migrator.js +0 -0
- /package/{cli/dist → dist}/core/pack/validator.d.ts +0 -0
- /package/{cli/dist → dist}/core/pack-v2/index.d.ts +0 -0
- /package/{cli/dist → dist}/core/pack-v2/index.js +0 -0
- /package/{cli/dist → dist}/core/pack-v2/loader.d.ts +0 -0
- /package/{cli/dist → dist}/core/pack-v2/loader.js +0 -0
- /package/{cli/dist → dist}/core/pack-v2/validator.d.ts +0 -0
- /package/{cli/dist → dist}/core/parallel/index.d.ts +0 -0
- /package/{cli/dist → dist}/core/parallel/index.js +0 -0
- /package/{cli/dist → dist}/core/parallel/parallel-runner.d.ts +0 -0
- /package/{cli/dist → dist}/core/parallel/parallel-runner.js +0 -0
- /package/{cli/dist → dist}/core/pom/base-page.d.ts +0 -0
- /package/{cli/dist → dist}/core/pom/index.d.ts +0 -0
- /package/{cli/dist → dist}/core/pom/index.js +0 -0
- /package/{cli/dist → dist}/core/pom/loader.d.ts +0 -0
- /package/{cli/dist → dist}/core/pom/types.d.ts +0 -0
- /package/{cli/dist → dist}/core/pom/types.js +0 -0
- /package/{cli/dist → dist}/core/proof/bundle.d.ts +0 -0
- /package/{cli/dist → dist}/core/proof/bundle.js +0 -0
- /package/{cli/dist → dist}/core/proof/canonicalize.d.ts +0 -0
- /package/{cli/dist → dist}/core/proof/canonicalize.js +0 -0
- /package/{cli/dist → dist}/core/proof/index.d.ts +0 -0
- /package/{cli/dist → dist}/core/proof/index.js +0 -0
- /package/{cli/dist → dist}/core/proof/schema.d.ts +0 -0
- /package/{cli/dist → dist}/core/proof/schema.js +0 -0
- /package/{cli/dist → dist}/core/proof/signer.d.ts +0 -0
- /package/{cli/dist → dist}/core/proof/signer.js +0 -0
- /package/{cli/dist → dist}/core/proof/verifier.d.ts +0 -0
- /package/{cli/dist → dist}/core/proof/verifier.js +0 -0
- /package/{cli/dist → dist}/core/regression/detector.d.ts +0 -0
- /package/{cli/dist → dist}/core/regression/detector.js +0 -0
- /package/{cli/dist → dist}/core/regression/index.d.ts +0 -0
- /package/{cli/dist → dist}/core/regression/index.js +0 -0
- /package/{cli/dist → dist}/core/regression/trend-analyzer.d.ts +0 -0
- /package/{cli/dist → dist}/core/regression/trend-analyzer.js +0 -0
- /package/{cli/dist → dist}/core/regression/types.d.ts +0 -0
- /package/{cli/dist → dist}/core/regression/types.js +0 -0
- /package/{cli/dist → dist}/core/regression/vault.d.ts +0 -0
- /package/{cli/dist → dist}/core/regression/vault.js +0 -0
- /package/{cli/dist → dist}/core/repair/engine/fixer.d.ts +0 -0
- /package/{cli/dist → dist}/core/repair/engine/fixer.js +0 -0
- /package/{cli/dist → dist}/core/repair/engine/suggestion-engine.d.ts +0 -0
- /package/{cli/dist → dist}/core/repair/engine/suggestion-engine.js +0 -0
- /package/{cli/dist → dist}/core/repair/index.d.ts +0 -0
- /package/{cli/dist → dist}/core/repair/index.js +0 -0
- /package/{cli/dist → dist}/core/repair/repairer.d.ts +0 -0
- /package/{cli/dist → dist}/core/repair/repairer.js +0 -0
- /package/{cli/dist → dist}/core/repair/types.d.ts +0 -0
- /package/{cli/dist → dist}/core/repair/types.js +0 -0
- /package/{cli/dist → dist}/core/repair/utils/error-analyzer.d.ts +0 -0
- /package/{cli/dist → dist}/core/repair/utils/error-analyzer.js +0 -0
- /package/{cli/dist → dist}/core/reporting/html-reporter.d.ts +0 -0
- /package/{cli/dist → dist}/core/reporting/html-reporter.js +0 -0
- /package/{cli/dist → dist}/core/retry/flakiness-integration.d.ts +0 -0
- /package/{cli/dist → dist}/core/retry/flakiness-integration.js +0 -0
- /package/{cli/dist → dist}/core/retry/index.d.ts +0 -0
- /package/{cli/dist → dist}/core/retry/index.js +0 -0
- /package/{cli/dist → dist}/core/retry/retry-engine.d.ts +0 -0
- /package/{cli/dist → dist}/core/retry/retry-engine.js +0 -0
- /package/{cli/dist → dist}/core/retry/types.d.ts +0 -0
- /package/{cli/dist → dist}/core/retry/types.js +0 -0
- /package/{cli/dist → dist}/core/retry/vault.d.ts +0 -0
- /package/{cli/dist → dist}/core/retry/vault.js +0 -0
- /package/{cli/dist → dist}/core/schemas/pack.schema.json +0 -0
- /package/{cli/dist → dist}/core/secrets/crypto.d.ts +0 -0
- /package/{cli/dist → dist}/core/secrets/crypto.js +0 -0
- /package/{cli/dist → dist}/core/secrets/manager.d.ts +0 -0
- /package/{cli/dist → dist}/core/secrets/manager.js +0 -0
- /package/{cli/dist → dist}/core/security/redaction-patterns-extended.d.ts +0 -0
- /package/{cli/dist → dist}/core/security/redaction-patterns-extended.js +0 -0
- /package/{cli/dist → dist}/core/security/redactor.d.ts +0 -0
- /package/{cli/dist → dist}/core/security/redactor.js +0 -0
- /package/{cli/dist → dist}/core/self-healing/assertion-healer.d.ts +0 -0
- /package/{cli/dist → dist}/core/self-healing/assertion-healer.js +0 -0
- /package/{cli/dist → dist}/core/self-healing/engine.d.ts +0 -0
- /package/{cli/dist → dist}/core/self-healing/engine.js +0 -0
- /package/{cli/dist → dist}/core/self-healing/index.d.ts +0 -0
- /package/{cli/dist → dist}/core/self-healing/index.js +0 -0
- /package/{cli/dist → dist}/core/self-healing/selector-healer.d.ts +0 -0
- /package/{cli/dist → dist}/core/self-healing/selector-healer.js +0 -0
- /package/{cli/dist → dist}/core/self-healing/types.d.ts +0 -0
- /package/{cli/dist → dist}/core/self-healing/types.js +0 -0
- /package/{cli/dist → dist}/core/serve/diagnostics-collector.d.ts +0 -0
- /package/{cli/dist → dist}/core/serve/diagnostics-collector.js +0 -0
- /package/{cli/dist → dist}/core/serve/health-checker.d.ts +0 -0
- /package/{cli/dist → dist}/core/serve/health-checker.js +0 -0
- /package/{cli/dist → dist}/core/serve/index.d.ts +0 -0
- /package/{cli/dist → dist}/core/serve/index.js +0 -0
- /package/{cli/dist → dist}/core/serve/metrics-collector.d.ts +0 -0
- /package/{cli/dist → dist}/core/serve/metrics-collector.js +0 -0
- /package/{cli/dist → dist}/core/serve/process-manager.d.ts +0 -0
- /package/{cli/dist → dist}/core/serve/process-manager.js +0 -0
- /package/{cli/dist → dist}/core/serve/server.d.ts +0 -0
- /package/{cli/dist → dist}/core/serve/server.js +0 -0
- /package/{cli/dist → dist}/core/slo/config.d.ts +0 -0
- /package/{cli/dist → dist}/core/slo/config.js +0 -0
- /package/{cli/dist → dist}/core/slo/index.d.ts +0 -0
- /package/{cli/dist → dist}/core/slo/index.js +0 -0
- /package/{cli/dist → dist}/core/slo/sli-calculator.d.ts +0 -0
- /package/{cli/dist → dist}/core/slo/sli-calculator.js +0 -0
- /package/{cli/dist → dist}/core/slo/slo-tracker.d.ts +0 -0
- /package/{cli/dist → dist}/core/slo/slo-tracker.js +0 -0
- /package/{cli/dist → dist}/core/slo/types.d.ts +0 -0
- /package/{cli/dist → dist}/core/slo/types.js +0 -0
- /package/{cli/dist → dist}/core/slo/vault.d.ts +0 -0
- /package/{cli/dist → dist}/core/slo/vault.js +0 -0
- /package/{cli/dist → dist}/core/tui/index.d.ts +0 -0
- /package/{cli/dist → dist}/core/tui/index.js +0 -0
- /package/{cli/dist → dist}/core/tui/monitor.d.ts +0 -0
- /package/{cli/dist → dist}/core/tui/monitor.js +0 -0
- /package/{cli/dist → dist}/core/tui/renderer.d.ts +0 -0
- /package/{cli/dist → dist}/core/tui/renderer.js +0 -0
- /package/{cli/dist → dist}/core/tui/types.d.ts +0 -0
- /package/{cli/dist → dist}/core/tui/types.js +0 -0
- /package/{cli/dist → dist}/core/types/pack-v1.js +0 -0
- /package/{cli/dist → dist}/core/types/pack-v2.js +0 -0
- /package/{cli/dist → dist}/core/types/trust-score.d.ts +0 -0
- /package/{cli/dist → dist}/core/types/trust-score.js +0 -0
- /package/{cli/dist → dist}/core/vault/cas.d.ts +0 -0
- /package/{cli/dist → dist}/core/vault/cas.js +0 -0
- /package/{cli/dist → dist}/core/vault/index.d.ts +0 -0
- /package/{cli/dist → dist}/core/vault/index.js +0 -0
- /package/{cli/dist → dist}/core/visual/visual-regression.d.ts +0 -0
- /package/{cli/dist → dist}/core/visual/visual-regression.js +0 -0
- /package/{cli/dist → dist}/core/watch/index.d.ts +0 -0
- /package/{cli/dist → dist}/core/watch/index.js +0 -0
- /package/{cli/dist → dist}/core/watch/watch-mode.d.ts +0 -0
- /package/{cli/dist → dist}/core/watch/watch-mode.js +0 -0
- /package/{cli/dist → dist}/generators/index.d.ts +0 -0
- /package/{cli/dist → dist}/generators/index.js +0 -0
- /package/{cli/dist → dist}/generators/json-reporter.d.ts +0 -0
- /package/{cli/dist → dist}/generators/json-reporter.js +0 -0
- /package/{cli/dist → dist}/generators/test-generator.d.ts +0 -0
- /package/{cli/dist → dist}/generators/test-generator.js +0 -0
- /package/{cli/dist → dist}/index.d.ts +0 -0
- /package/{cli/dist → dist}/scanners/dom-scanner.d.ts +0 -0
- /package/{cli/dist → dist}/scanners/dom-scanner.js +0 -0
- /package/{cli/dist → dist}/scanners/index.d.ts +0 -0
- /package/{cli/dist → dist}/scanners/index.js +0 -0
- /package/{cli/dist → dist}/schemas/pack.schema.json +0 -0
- /package/{cli/dist → dist}/types/scan.d.ts +0 -0
- /package/{cli/dist → dist}/types/scan.js +0 -0
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Trusted Types Handler
|
|
3
|
+
*
|
|
4
|
+
* P1 - Trusted Types API for XSS prevention
|
|
5
|
+
*
|
|
6
|
+
* Supports:
|
|
7
|
+
* - Trusted Types detection
|
|
8
|
+
* - CSP trusted-types directive parsing
|
|
9
|
+
* - Trusted type policy creation
|
|
10
|
+
* - XSS sink monitoring
|
|
11
|
+
* - Trusted types violation tracking
|
|
12
|
+
*
|
|
13
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/trusted-types
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Trusted Types Handler class
|
|
17
|
+
*/
|
|
18
|
+
export class TrustedTypesHandler {
|
|
19
|
+
page;
|
|
20
|
+
violations = [];
|
|
21
|
+
constructor(page) {
|
|
22
|
+
this.page = page;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Check if Trusted Types is supported
|
|
26
|
+
*/
|
|
27
|
+
async isSupported() {
|
|
28
|
+
return await this.page.evaluate(() => {
|
|
29
|
+
return typeof window.TrustedTypes !== 'undefined' &&
|
|
30
|
+
typeof window.TrustedTypePolicyFactory !== 'undefined';
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Get Trusted Types CSP directive
|
|
35
|
+
*/
|
|
36
|
+
async getTrustedTypesDirective() {
|
|
37
|
+
return await this.page.evaluate(async () => {
|
|
38
|
+
try {
|
|
39
|
+
const response = await fetch(window.location.href, { method: 'HEAD' });
|
|
40
|
+
const csp = response.headers.get('Content-Security-Policy');
|
|
41
|
+
if (!csp)
|
|
42
|
+
return null;
|
|
43
|
+
// Parse CSP for trusted-types directive
|
|
44
|
+
const parts = csp.split(';');
|
|
45
|
+
for (const part of parts) {
|
|
46
|
+
const trimmed = part.trim();
|
|
47
|
+
if (trimmed.startsWith('trusted-types')) {
|
|
48
|
+
return trimmed.slice('trusted-types'.length).trim();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Parse Trusted Types CSP directive
|
|
60
|
+
*/
|
|
61
|
+
parseTrustedTypesDirective(directive) {
|
|
62
|
+
if (!directive) {
|
|
63
|
+
return {
|
|
64
|
+
directiveValues: [],
|
|
65
|
+
policyNames: [],
|
|
66
|
+
allowsNone: false,
|
|
67
|
+
allowsAll: false,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
const values = directive.split(/\s+/).filter(Boolean);
|
|
71
|
+
const policyNames = [];
|
|
72
|
+
let allowsNone = false;
|
|
73
|
+
let allowsAll = false;
|
|
74
|
+
for (const value of values) {
|
|
75
|
+
if (value === "'none'") {
|
|
76
|
+
allowsNone = true;
|
|
77
|
+
}
|
|
78
|
+
else if (value === '*' || value === "'*'") {
|
|
79
|
+
allowsAll = true;
|
|
80
|
+
}
|
|
81
|
+
else if (value.startsWith("'")) {
|
|
82
|
+
// Other quoted value
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
policyNames.push(value);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return {
|
|
89
|
+
directiveValues: values,
|
|
90
|
+
policyNames,
|
|
91
|
+
allowsNone,
|
|
92
|
+
allowsAll,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Get existing Trusted Type policies
|
|
97
|
+
*/
|
|
98
|
+
async getExistingPolicies() {
|
|
99
|
+
return await this.page.evaluate(() => {
|
|
100
|
+
if (typeof window.trustedTypes === 'undefined') {
|
|
101
|
+
return [];
|
|
102
|
+
}
|
|
103
|
+
// Try to get exposed policy names
|
|
104
|
+
// Note: Policy names are not directly enumerable, but we can check
|
|
105
|
+
// if certain operations create trusted types
|
|
106
|
+
const policies = [];
|
|
107
|
+
// Check if we can detect any policy by attempting to create a trusted type
|
|
108
|
+
try {
|
|
109
|
+
const tt = window.trustedTypes;
|
|
110
|
+
if (tt.createPolicy) {
|
|
111
|
+
// The existence of createPolicy means trusted types is active
|
|
112
|
+
policies.push('default');
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
catch {
|
|
116
|
+
// Ignore
|
|
117
|
+
}
|
|
118
|
+
return policies;
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Detect XSS sinks in the page
|
|
123
|
+
*/
|
|
124
|
+
async detectXSSSinks() {
|
|
125
|
+
return await this.page.evaluate(() => {
|
|
126
|
+
const sinks = [];
|
|
127
|
+
// Common XSS sinks to check
|
|
128
|
+
const sinkSelectors = [
|
|
129
|
+
{ selector: '*', property: 'innerHTML', type: 'innerHTML' },
|
|
130
|
+
{ selector: '*', property: 'outerHTML', type: 'outerHTML' },
|
|
131
|
+
{ selector: 'a[href]', property: 'href', type: 'location' },
|
|
132
|
+
{ selector: 'area[href]', property: 'href', type: 'location' },
|
|
133
|
+
{ selector: 'form[action]', property: 'action', type: 'location' },
|
|
134
|
+
{ selector: 'input[formaction]', property: 'formAction', type: 'location' },
|
|
135
|
+
{ selector: 'button[formaction]', property: 'formAction', type: 'location' },
|
|
136
|
+
{ selector: 'iframe[src]', property: 'src', type: 'location' },
|
|
137
|
+
{ selector: 'object[data]', property: 'data', type: 'location' },
|
|
138
|
+
{ selector: 'embed[src]', property: 'src', type: 'location' },
|
|
139
|
+
{ selector: 'link[href]', property: 'href', type: 'location' },
|
|
140
|
+
];
|
|
141
|
+
for (const sink of sinkSelectors) {
|
|
142
|
+
const elements = document.querySelectorAll(sink.selector);
|
|
143
|
+
for (const el of Array.from(elements)) {
|
|
144
|
+
try {
|
|
145
|
+
const value = el[sink.property];
|
|
146
|
+
if (value !== undefined && value !== null) {
|
|
147
|
+
sinks.push({
|
|
148
|
+
type: sink.type,
|
|
149
|
+
element: el.tagName.toLowerCase() + (el.id ? '#' + el.id : ''),
|
|
150
|
+
value: String(value).substring(0, 100),
|
|
151
|
+
isXSSSink: true,
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
catch {
|
|
156
|
+
// Property might not be readable
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return sinks;
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Create a test Trusted Type policy
|
|
165
|
+
*/
|
|
166
|
+
async createTestPolicy(policyName) {
|
|
167
|
+
return await this.page.evaluate((name) => {
|
|
168
|
+
try {
|
|
169
|
+
if (typeof window.trustedTypes === 'undefined') {
|
|
170
|
+
return false;
|
|
171
|
+
}
|
|
172
|
+
const policy = window.trustedTypes.createPolicy(name, {
|
|
173
|
+
createHTML: (input) => input,
|
|
174
|
+
createScriptURL: (input) => input,
|
|
175
|
+
createScript: (input) => input,
|
|
176
|
+
});
|
|
177
|
+
return policy !== undefined;
|
|
178
|
+
}
|
|
179
|
+
catch {
|
|
180
|
+
return false;
|
|
181
|
+
}
|
|
182
|
+
}, policyName);
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Test if a sink requires Trusted Type
|
|
186
|
+
*/
|
|
187
|
+
async testSinkRequiresTrustedType(sinkType) {
|
|
188
|
+
return await this.page.evaluate((type) => {
|
|
189
|
+
try {
|
|
190
|
+
const testDiv = document.createElement('div');
|
|
191
|
+
switch (type) {
|
|
192
|
+
case 'innerHTML':
|
|
193
|
+
testDiv.innerHTML = '<span>test</span>';
|
|
194
|
+
break;
|
|
195
|
+
case 'outerHTML':
|
|
196
|
+
// Can't easily test outerHTML without replacing
|
|
197
|
+
break;
|
|
198
|
+
case 'src':
|
|
199
|
+
const img = document.createElement('img');
|
|
200
|
+
img.src = 'about:blank';
|
|
201
|
+
break;
|
|
202
|
+
}
|
|
203
|
+
// If we got here without error, check if trusted types is enforced
|
|
204
|
+
return typeof window.trustedTypes !== 'undefined';
|
|
205
|
+
}
|
|
206
|
+
catch {
|
|
207
|
+
// Error might indicate trusted types enforcement
|
|
208
|
+
return true;
|
|
209
|
+
}
|
|
210
|
+
}, sinkType);
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Setup violation monitoring
|
|
214
|
+
*/
|
|
215
|
+
async setupViolationMonitoring() {
|
|
216
|
+
await this.page.evaluate(() => {
|
|
217
|
+
// Listen for Trusted Types violations
|
|
218
|
+
const originalHandler = window.trustedTypes?.createPolicy;
|
|
219
|
+
if (!originalHandler)
|
|
220
|
+
return;
|
|
221
|
+
// Store violations
|
|
222
|
+
if (!window.__ttViolations) {
|
|
223
|
+
window.__ttViolations = [];
|
|
224
|
+
}
|
|
225
|
+
// Override console.error to catch Trusted Types violations
|
|
226
|
+
const originalError = console.error;
|
|
227
|
+
console.error = function (...args) {
|
|
228
|
+
const message = args.join(' ');
|
|
229
|
+
if (message.includes('Failed to set') ||
|
|
230
|
+
message.includes('Trusted Types') ||
|
|
231
|
+
message.includes('This document requires')) {
|
|
232
|
+
window.__ttViolations.push({
|
|
233
|
+
message,
|
|
234
|
+
timestamp: Date.now(),
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
originalError.apply(console, args);
|
|
238
|
+
};
|
|
239
|
+
});
|
|
240
|
+
// Listen for console messages
|
|
241
|
+
this.page.on('console', (msg) => {
|
|
242
|
+
if (msg.type() === 'error') {
|
|
243
|
+
const text = msg.text();
|
|
244
|
+
if (text.includes('Trusted Types') || text.includes('Failed to set')) {
|
|
245
|
+
this.violations.push({
|
|
246
|
+
message: text,
|
|
247
|
+
sink: 'unknown',
|
|
248
|
+
value: 'unknown',
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Get collected violations
|
|
256
|
+
*/
|
|
257
|
+
getViolations() {
|
|
258
|
+
return [...this.violations];
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Clear violations
|
|
262
|
+
*/
|
|
263
|
+
clearViolations() {
|
|
264
|
+
this.violations = [];
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Generate full Trusted Types report
|
|
268
|
+
*/
|
|
269
|
+
async generateReport() {
|
|
270
|
+
const supported = await this.isSupported();
|
|
271
|
+
const directive = await this.getTrustedTypesDirective();
|
|
272
|
+
const config = this.parseTrustedTypesDirective(directive);
|
|
273
|
+
const policies = await this.getExistingPolicies();
|
|
274
|
+
const xssSinks = await this.detectXSSSinks();
|
|
275
|
+
// Get violations from page context
|
|
276
|
+
const pageViolations = await this.page.evaluate(() => {
|
|
277
|
+
return window.__ttViolations || [];
|
|
278
|
+
});
|
|
279
|
+
const allViolations = [
|
|
280
|
+
...this.violations,
|
|
281
|
+
...pageViolations.map((v) => ({
|
|
282
|
+
message: v.message,
|
|
283
|
+
sink: 'detected',
|
|
284
|
+
value: 'unknown',
|
|
285
|
+
})),
|
|
286
|
+
];
|
|
287
|
+
// Calculate security score
|
|
288
|
+
let score = 0;
|
|
289
|
+
if (supported) {
|
|
290
|
+
score += 20;
|
|
291
|
+
}
|
|
292
|
+
if (directive) {
|
|
293
|
+
score += 30;
|
|
294
|
+
}
|
|
295
|
+
if (config.allowsNone && xssSinks.length === 0) {
|
|
296
|
+
score += 50; // Strictest configuration
|
|
297
|
+
}
|
|
298
|
+
else if (config.policyNames.length > 0) {
|
|
299
|
+
score += 30; // Named policies
|
|
300
|
+
}
|
|
301
|
+
else if (config.allowsAll) {
|
|
302
|
+
score += 10; // Any policy allowed
|
|
303
|
+
}
|
|
304
|
+
// Deduct for XSS sinks without protection
|
|
305
|
+
if (xssSinks.length > 0 && !supported) {
|
|
306
|
+
score -= 20;
|
|
307
|
+
}
|
|
308
|
+
// Generate recommendations
|
|
309
|
+
const recommendations = [];
|
|
310
|
+
if (!supported) {
|
|
311
|
+
recommendations.push('Trusted Types not supported in this browser');
|
|
312
|
+
}
|
|
313
|
+
else if (!directive) {
|
|
314
|
+
recommendations.push('Add "trusted-types" CSP directive to enable XSS protection');
|
|
315
|
+
recommendations.push('Consider "trusted-types \'none\'" for strictest security');
|
|
316
|
+
}
|
|
317
|
+
else if (config.allowsAll) {
|
|
318
|
+
recommendations.push('Replace "*" with specific policy names for better security');
|
|
319
|
+
}
|
|
320
|
+
if (xssSinks.length > 0 && supported) {
|
|
321
|
+
recommendations.push('Ensure all XSS sinks use Trusted Types');
|
|
322
|
+
}
|
|
323
|
+
if (!config.allowsNone && supported) {
|
|
324
|
+
recommendations.push('Consider using "trusted-types \'none\'" to disable default policy');
|
|
325
|
+
}
|
|
326
|
+
return {
|
|
327
|
+
supported,
|
|
328
|
+
config,
|
|
329
|
+
policies,
|
|
330
|
+
xssSinks,
|
|
331
|
+
violations: allViolations,
|
|
332
|
+
securityScore: Math.max(0, Math.min(100, score)),
|
|
333
|
+
recommendations,
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Validate Trusted Types configuration
|
|
338
|
+
*/
|
|
339
|
+
async validate() {
|
|
340
|
+
const report = await this.generateReport();
|
|
341
|
+
const errors = [];
|
|
342
|
+
const warnings = [];
|
|
343
|
+
if (!report.supported) {
|
|
344
|
+
warnings.push('Trusted Types not supported');
|
|
345
|
+
return { valid: true, errors, warnings };
|
|
346
|
+
}
|
|
347
|
+
if (!report.config.directiveValues.length) {
|
|
348
|
+
errors.push('No trusted-types CSP directive found');
|
|
349
|
+
}
|
|
350
|
+
if (report.xssSinks.length > 0 && !report.config.allowsNone) {
|
|
351
|
+
warnings.push('XSS sinks detected without strict Trusted Types policy');
|
|
352
|
+
}
|
|
353
|
+
if (report.violations.length > 0) {
|
|
354
|
+
errors.push(`Trusted Types violations detected: ${report.violations.length}`);
|
|
355
|
+
}
|
|
356
|
+
return {
|
|
357
|
+
valid: errors.length === 0,
|
|
358
|
+
errors,
|
|
359
|
+
warnings,
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Generate recommended CSP snippet for Trusted Types
|
|
364
|
+
*/
|
|
365
|
+
generateRecommendedCSP(policyNames = ['default'], requireTrustedTypesFor = ['script']) {
|
|
366
|
+
const ttDirective = policyNames.length > 0
|
|
367
|
+
? `trusted-types ${policyNames.join(' ')};`
|
|
368
|
+
: "trusted-types 'none';";
|
|
369
|
+
const requireDirectives = requireTrustedTypesFor.map(feature => `require-trusted-types-for '${feature}'`).join('; ');
|
|
370
|
+
return `${ttDirective} ${requireDirectives}`;
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Test if a string passes Trusted Types validation
|
|
374
|
+
*/
|
|
375
|
+
async testTrustedString(policyName, input, type = 'createHTML') {
|
|
376
|
+
return await this.page.evaluate((data) => {
|
|
377
|
+
try {
|
|
378
|
+
if (typeof window.trustedTypes === 'undefined') {
|
|
379
|
+
return { success: false, error: 'Trusted Types not supported' };
|
|
380
|
+
}
|
|
381
|
+
const policy = window.trustedTypes.createPolicy(data.policy, {
|
|
382
|
+
createHTML: (s) => s,
|
|
383
|
+
createScriptURL: (s) => s,
|
|
384
|
+
createScript: (s) => s,
|
|
385
|
+
});
|
|
386
|
+
const result = policy[data.type](data.input);
|
|
387
|
+
return {
|
|
388
|
+
success: true,
|
|
389
|
+
result: String(result),
|
|
390
|
+
};
|
|
391
|
+
}
|
|
392
|
+
catch (e) {
|
|
393
|
+
return {
|
|
394
|
+
success: false,
|
|
395
|
+
error: e instanceof Error ? e.message : String(e),
|
|
396
|
+
};
|
|
397
|
+
}
|
|
398
|
+
}, { policyName, input, type });
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* Get documentation URL
|
|
402
|
+
*/
|
|
403
|
+
getDocumentation() {
|
|
404
|
+
return 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/trusted-types';
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* Factory function to create Trusted Types Handler
|
|
409
|
+
*/
|
|
410
|
+
export function createTrustedTypesHandler(page) {
|
|
411
|
+
return new TrustedTypesHandler(page);
|
|
412
|
+
}
|
|
413
|
+
export default TrustedTypesHandler;
|
|
@@ -31,6 +31,53 @@ export interface CrawlOptions {
|
|
|
31
31
|
headless?: boolean;
|
|
32
32
|
/** Wait for network idle before analysis (default: true) */
|
|
33
33
|
waitForNetworkIdle?: boolean;
|
|
34
|
+
/** Preset for platform-specific crawling (Phase 1) */
|
|
35
|
+
preset?: CrawlPresetConfig;
|
|
36
|
+
/** Focused scenario for crawling (Phase 1) */
|
|
37
|
+
scenario?: 'login' | 'browse' | 'search' | 'checkout' | 'dashboard' | 'profile';
|
|
38
|
+
/** Only crawl URLs matching these patterns */
|
|
39
|
+
onlyPatterns?: string[];
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Crawler preset with platform-specific selectors and strategies (Phase 1)
|
|
43
|
+
*/
|
|
44
|
+
export interface CrawlPresetConfig {
|
|
45
|
+
/** Preset identifier */
|
|
46
|
+
id: string;
|
|
47
|
+
/** Preset name */
|
|
48
|
+
name: string;
|
|
49
|
+
/** Platform-specific selectors */
|
|
50
|
+
selectors?: {
|
|
51
|
+
/** Login form selectors */
|
|
52
|
+
login?: {
|
|
53
|
+
email?: string[];
|
|
54
|
+
password?: string[];
|
|
55
|
+
submit?: string[];
|
|
56
|
+
/** Success indicators (visible after successful login) */
|
|
57
|
+
successSelectors?: string[];
|
|
58
|
+
};
|
|
59
|
+
/** Action selectors (add, remove, edit, delete) */
|
|
60
|
+
actions?: {
|
|
61
|
+
add?: string[];
|
|
62
|
+
remove?: string[];
|
|
63
|
+
edit?: string[];
|
|
64
|
+
delete?: string[];
|
|
65
|
+
buy?: string[];
|
|
66
|
+
cart?: string[];
|
|
67
|
+
};
|
|
68
|
+
/** Content selectors */
|
|
69
|
+
content?: {
|
|
70
|
+
title?: string[];
|
|
71
|
+
body?: string[];
|
|
72
|
+
price?: string[];
|
|
73
|
+
};
|
|
74
|
+
/** Navigation selectors */
|
|
75
|
+
navigation?: {
|
|
76
|
+
next?: string[];
|
|
77
|
+
prev?: string[];
|
|
78
|
+
menu?: string[];
|
|
79
|
+
};
|
|
80
|
+
};
|
|
34
81
|
}
|
|
35
82
|
/**
|
|
36
83
|
* Authentication for crawling
|
|
@@ -40,8 +87,10 @@ export interface CrawlAuth {
|
|
|
40
87
|
type: 'basic' | 'form' | 'bearer' | 'cookie';
|
|
41
88
|
/** URL for login form (for type: 'form') */
|
|
42
89
|
loginUrl?: string;
|
|
43
|
-
/** Username */
|
|
90
|
+
/** Username or email */
|
|
44
91
|
username?: string;
|
|
92
|
+
/** Email (alias for username, commonly used) */
|
|
93
|
+
email?: string;
|
|
45
94
|
/** Password */
|
|
46
95
|
password?: string;
|
|
47
96
|
/** Username selector (for type: 'form') */
|
|
@@ -131,6 +180,21 @@ export interface LinkInfo extends ElementInfo {
|
|
|
131
180
|
/** Whether link was visited */
|
|
132
181
|
visited: boolean;
|
|
133
182
|
}
|
|
183
|
+
/**
|
|
184
|
+
* Iframe information (Part 5)
|
|
185
|
+
*/
|
|
186
|
+
export interface IframeInfo extends ElementInfo {
|
|
187
|
+
/** Frame URL (src attribute) */
|
|
188
|
+
src?: string;
|
|
189
|
+
/** Frame title for accessibility */
|
|
190
|
+
title?: string;
|
|
191
|
+
/** Frame name attribute */
|
|
192
|
+
name?: string;
|
|
193
|
+
/** Whether frame has same origin (accessible) */
|
|
194
|
+
sameOrigin: boolean;
|
|
195
|
+
/** Frame selector for Playwright (iframe selector) */
|
|
196
|
+
frameSelector: string;
|
|
197
|
+
}
|
|
134
198
|
/**
|
|
135
199
|
* Page definition after crawling
|
|
136
200
|
*/
|
|
@@ -167,6 +231,8 @@ export interface PageDefinition {
|
|
|
167
231
|
checkboxes: ElementInfo[];
|
|
168
232
|
/** Radio buttons */
|
|
169
233
|
radios: ElementInfo[];
|
|
234
|
+
/** Iframes on the page (Part 5) */
|
|
235
|
+
iframes: IframeInfo[];
|
|
170
236
|
};
|
|
171
237
|
/** Navigation elements detected */
|
|
172
238
|
navigation: {
|
|
@@ -271,7 +337,7 @@ export interface JourneyStep {
|
|
|
271
337
|
/**
|
|
272
338
|
* Journey action types
|
|
273
339
|
*/
|
|
274
|
-
export type JourneyAction = 'navigate' | 'click' | 'fill' | 'select' | 'check' | 'uncheck' | 'upload' | 'hover' | 'press' | 'waitFor' | 'waitForNavigation' | 'scroll';
|
|
340
|
+
export type JourneyAction = 'navigate' | 'click' | 'fill' | 'select' | 'check' | 'uncheck' | 'upload' | 'hover' | 'press' | 'waitFor' | 'waitForSelector' | 'waitForLoadState' | 'waitForNavigation' | 'scroll';
|
|
275
341
|
/**
|
|
276
342
|
* Site map structure
|
|
277
343
|
*/
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wait Strategies
|
|
3
|
+
*
|
|
4
|
+
* P1 - Advanced wait conditions for E2E tests
|
|
5
|
+
*
|
|
6
|
+
* Supports:
|
|
7
|
+
* - Network idle (no active network requests)
|
|
8
|
+
* - Element stable (position/size not changing)
|
|
9
|
+
* - DOM content loaded
|
|
10
|
+
* - Custom condition polling
|
|
11
|
+
* - Multiple wait strategies with timeout
|
|
12
|
+
*
|
|
13
|
+
* @see https://playwright.dev/docs/actionability
|
|
14
|
+
*/
|
|
15
|
+
export interface WaitConfig {
|
|
16
|
+
/** Timeout in milliseconds */
|
|
17
|
+
timeout?: number;
|
|
18
|
+
/** Poll interval in milliseconds */
|
|
19
|
+
interval?: number;
|
|
20
|
+
}
|
|
21
|
+
export interface NetworkIdleConfig extends WaitConfig {
|
|
22
|
+
/** Minimum idle time (ms) before considering network idle */
|
|
23
|
+
idleTime?: number;
|
|
24
|
+
/** Ignore certain URLs */
|
|
25
|
+
ignoreUrls?: (string | RegExp)[];
|
|
26
|
+
}
|
|
27
|
+
export interface StabilityConfig extends WaitConfig {
|
|
28
|
+
/** Minimum stable time (ms) */
|
|
29
|
+
stableTime?: number;
|
|
30
|
+
/** Check tolerance for position/size changes (pixels) */
|
|
31
|
+
tolerance?: number;
|
|
32
|
+
}
|
|
33
|
+
export interface WaitResult {
|
|
34
|
+
success: boolean;
|
|
35
|
+
duration?: number;
|
|
36
|
+
error?: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Wait Strategies class
|
|
40
|
+
*/
|
|
41
|
+
export declare class WaitStrategies {
|
|
42
|
+
private defaultTimeout;
|
|
43
|
+
private defaultInterval;
|
|
44
|
+
constructor(config?: WaitConfig);
|
|
45
|
+
/**
|
|
46
|
+
* Wait for network to be idle
|
|
47
|
+
*/
|
|
48
|
+
waitForNetworkIdle(page: any, config?: NetworkIdleConfig): Promise<WaitResult>;
|
|
49
|
+
/**
|
|
50
|
+
* Wait for element to be stable (position/size not changing)
|
|
51
|
+
*/
|
|
52
|
+
waitForStable(page: any, selector: string, config?: StabilityConfig): Promise<WaitResult>;
|
|
53
|
+
/**
|
|
54
|
+
* Wait for DOM content to be loaded
|
|
55
|
+
*/
|
|
56
|
+
waitForDOMContent(page: any, config?: WaitConfig): Promise<WaitResult>;
|
|
57
|
+
/**
|
|
58
|
+
* Wait for network to be mostly idle (allows some background requests)
|
|
59
|
+
*/
|
|
60
|
+
waitForNetworkMostlyIdle(page: any, config?: NetworkIdleConfig): Promise<WaitResult>;
|
|
61
|
+
/**
|
|
62
|
+
* Wait for element to be visible and stable
|
|
63
|
+
*/
|
|
64
|
+
waitForVisibleAndStable(page: any, selector: string, config?: StabilityConfig): Promise<WaitResult>;
|
|
65
|
+
/**
|
|
66
|
+
* Wait for custom condition
|
|
67
|
+
*/
|
|
68
|
+
waitForCondition(page: any, condition: () => boolean | Promise<boolean>, config?: WaitConfig): Promise<WaitResult>;
|
|
69
|
+
/**
|
|
70
|
+
* Wait for any element in a list to be visible
|
|
71
|
+
*/
|
|
72
|
+
waitForAnyElement(page: any, selectors: string[], config?: WaitConfig): Promise<WaitResult>;
|
|
73
|
+
/**
|
|
74
|
+
* Wait for text to appear in element
|
|
75
|
+
*/
|
|
76
|
+
waitForText(page: any, selector: string, text: string | RegExp, config?: WaitConfig): Promise<WaitResult>;
|
|
77
|
+
/**
|
|
78
|
+
* Wait for element count to match expected
|
|
79
|
+
*/
|
|
80
|
+
waitForElementCount(page: any, selector: string, count: number, config?: WaitConfig): Promise<WaitResult>;
|
|
81
|
+
/**
|
|
82
|
+
* Wait for URL to match pattern
|
|
83
|
+
*/
|
|
84
|
+
waitForURL(page: any, pattern: string | RegExp, config?: WaitConfig): Promise<WaitResult>;
|
|
85
|
+
/**
|
|
86
|
+
* Wait for console message matching pattern
|
|
87
|
+
*/
|
|
88
|
+
waitForConsoleMessage(page: any, pattern: string | RegExp, config?: WaitConfig & {
|
|
89
|
+
type?: 'log' | 'error' | 'warning' | 'info';
|
|
90
|
+
}): Promise<WaitResult>;
|
|
91
|
+
/**
|
|
92
|
+
* Wait for page title
|
|
93
|
+
*/
|
|
94
|
+
waitForTitle(page: any, title: string | RegExp, config?: WaitConfig): Promise<WaitResult>;
|
|
95
|
+
/**
|
|
96
|
+
* Wait for multiple conditions (all must be true)
|
|
97
|
+
*/
|
|
98
|
+
waitForAll(page: any, conditions: Array<() => boolean | Promise<boolean>>, config?: WaitConfig): Promise<WaitResult>;
|
|
99
|
+
/**
|
|
100
|
+
* Wait for multiple conditions (any can be true)
|
|
101
|
+
*/
|
|
102
|
+
waitForAny(page: any, conditions: Array<() => boolean | Promise<boolean>>, config?: WaitConfig): Promise<WaitResult>;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Factory function to create Wait Strategies
|
|
106
|
+
*/
|
|
107
|
+
export declare function createWaitStrategies(config?: WaitConfig): WaitStrategies;
|
|
108
|
+
export default WaitStrategies;
|