@nextsparkjs/theme-default 0.1.0-beta.1 → 0.1.0-beta.100
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/LICENSE +21 -0
- package/api/ai/chat/stream/route.ts +4 -1
- package/api/ai/orchestrator/route.ts +10 -3
- package/api/ai/single-agent/route.ts +10 -3
- package/api/ai/usage/route.ts +4 -1
- package/blocks/benefits/component.tsx +4 -4
- package/blocks/cta-section/component.tsx +4 -4
- package/blocks/faq-accordion/component.tsx +2 -2
- package/blocks/features-grid/component.tsx +5 -5
- package/blocks/hero/component.tsx +2 -2
- package/blocks/hero/fields.ts +1 -1
- package/blocks/hero-with-form/component.tsx +7 -7
- package/blocks/hero-with-form/fields.ts +1 -1
- package/blocks/jumbotron/component.tsx +7 -7
- package/blocks/jumbotron/fields.ts +1 -1
- package/blocks/logo-cloud/component.tsx +6 -6
- package/blocks/logo-cloud/fields.ts +1 -1
- package/blocks/post-content/component.tsx +2 -2
- package/blocks/pricing-table/component.tsx +5 -5
- package/blocks/split-content/component.tsx +5 -5
- package/blocks/split-content/fields.ts +1 -1
- package/blocks/stats-counter/component.tsx +9 -9
- package/blocks/testimonials/component.tsx +4 -4
- package/blocks/testimonials/fields.ts +1 -1
- package/blocks/text-content/component.tsx +12 -10
- package/blocks/timeline/component.tsx +12 -12
- package/blocks/video-hero/component.tsx +7 -7
- package/blocks/video-hero/fields.ts +1 -1
- package/components/ai-chat/ChatPanel.tsx +7 -7
- package/components/ai-chat/Message.tsx +2 -2
- package/components/ai-chat/MessageInput.tsx +3 -3
- package/components/ai-chat/MessageList.tsx +3 -3
- package/components/ai-chat/TypingIndicator.tsx +2 -2
- package/config/app.config.ts +54 -62
- package/config/dashboard.config.ts +14 -0
- package/config/features.config.ts +10 -0
- package/config/permissions.config.ts +26 -1
- package/docs/{01-overview → public/01-overview}/01-introduction.md +5 -0
- package/docs/{01-overview → public/01-overview}/02-customization.md +5 -0
- package/docs/{02-features → public/02-features}/03-tasks-entity.md +5 -0
- package/docs/{03-ai → public/03-ai}/01-overview.md +5 -0
- package/docs/{03-ai → public/03-ai}/02-customization.md +5 -0
- package/docs/superadmin/01-setup/01-configuration.md +79 -0
- package/docs/superadmin/01-setup/02-deployment.md +82 -0
- package/docs/superadmin/02-management/01-users.md +83 -0
- package/docs/superadmin/03-integrations/01-langchain.md +139 -0
- package/entities/customers/api/docs.md +107 -0
- package/entities/customers/api/presets.ts +80 -0
- package/entities/pages/api/docs.md +114 -0
- package/entities/pages/api/presets.ts +72 -0
- package/entities/posts/api/docs.md +120 -0
- package/entities/posts/api/presets.ts +74 -0
- package/entities/tasks/api/docs.md +126 -0
- package/entities/tasks/api/presets.ts +84 -0
- package/lib/selectors.ts +7 -4
- package/messages/de/admin.json +45 -0
- package/messages/en/admin.json +56 -0
- package/messages/en/navigation.json +2 -1
- package/messages/es/admin.json +56 -0
- package/messages/es/navigation.json +2 -1
- package/messages/fr/admin.json +45 -0
- package/messages/it/admin.json +45 -0
- package/messages/pt/admin.json +45 -0
- package/migrations/093_pages_sample_data.sql +7 -7
- package/migrations/098_patterns_sample_data.sql +234 -0
- package/package.json +8 -3
- package/styles/globals.css +42 -0
- package/templates/(public)/blog/[slug]/page.tsx +1 -1
- package/templates/(public)/page.tsx +1 -1
- package/tests/cypress/e2e/_utils/devtools/access.bdd.md +262 -0
- package/tests/cypress/e2e/_utils/devtools/access.cy.ts +171 -0
- package/tests/cypress/e2e/_utils/devtools/navigation.bdd.md +261 -0
- package/tests/cypress/e2e/_utils/devtools/navigation.cy.ts +157 -0
- package/tests/cypress/e2e/_utils/devtools/pages.bdd.md +303 -0
- package/tests/cypress/e2e/_utils/devtools/pages.cy.ts +184 -0
- package/tests/cypress/e2e/_utils/docs/README.md +215 -0
- package/tests/cypress/e2e/_utils/selectors/auth.bdd.md +354 -0
- package/tests/cypress/e2e/_utils/selectors/auth.cy.ts +310 -0
- package/tests/cypress/e2e/_utils/selectors/billing.bdd.md +276 -0
- package/tests/cypress/e2e/_utils/selectors/billing.cy.ts +182 -0
- package/tests/cypress/e2e/_utils/selectors/block-editor.bdd.md +615 -0
- package/tests/cypress/e2e/_utils/selectors/block-editor.cy.ts +783 -0
- package/tests/cypress/e2e/_utils/selectors/dashboard-container.cy.ts +52 -0
- package/tests/cypress/e2e/_utils/selectors/dashboard-mobile.bdd.md +205 -0
- package/tests/cypress/e2e/_utils/selectors/dashboard-mobile.cy.ts +137 -0
- package/tests/cypress/e2e/_utils/selectors/dashboard-navigation.bdd.md +147 -0
- package/tests/cypress/e2e/_utils/selectors/dashboard-navigation.cy.ts +114 -0
- package/tests/cypress/e2e/_utils/selectors/dashboard-sidebar.bdd.md +76 -0
- package/tests/cypress/e2e/_utils/selectors/dashboard-sidebar.cy.ts +68 -0
- package/tests/cypress/e2e/_utils/selectors/dashboard-topnav.bdd.md +326 -0
- package/tests/cypress/e2e/_utils/selectors/dashboard-topnav.cy.ts +177 -0
- package/tests/cypress/e2e/_utils/selectors/devtools.bdd.md +306 -0
- package/tests/cypress/e2e/_utils/selectors/devtools.cy.ts +273 -0
- package/tests/cypress/e2e/_utils/selectors/global-search.bdd.md +115 -0
- package/tests/cypress/e2e/_utils/selectors/global-search.cy.ts +93 -0
- package/tests/cypress/e2e/_utils/selectors/patterns.bdd.md +388 -0
- package/tests/cypress/e2e/_utils/selectors/patterns.cy.ts +559 -0
- package/tests/cypress/e2e/_utils/selectors/public.cy.ts +112 -0
- package/tests/cypress/e2e/_utils/selectors/settings-api-keys.bdd.md +266 -0
- package/tests/cypress/e2e/_utils/selectors/settings-api-keys.cy.ts +233 -0
- package/tests/cypress/e2e/_utils/selectors/settings-billing.bdd.md +78 -0
- package/tests/cypress/e2e/_utils/selectors/settings-billing.cy.ts +108 -0
- package/tests/cypress/e2e/_utils/selectors/settings-layout.bdd.md +129 -0
- package/tests/cypress/e2e/_utils/selectors/settings-layout.cy.ts +115 -0
- package/tests/cypress/e2e/_utils/selectors/settings-password.bdd.md +82 -0
- package/tests/cypress/e2e/_utils/selectors/settings-password.cy.ts +74 -0
- package/tests/cypress/e2e/_utils/selectors/settings-profile.bdd.md +77 -0
- package/tests/cypress/e2e/_utils/selectors/settings-profile.cy.ts +79 -0
- package/tests/cypress/e2e/_utils/selectors/settings-teams.bdd.md +130 -0
- package/tests/cypress/e2e/_utils/selectors/settings-teams.cy.ts +86 -0
- package/tests/cypress/e2e/_utils/selectors/superadmin.bdd.md +261 -0
- package/tests/cypress/e2e/_utils/selectors/superadmin.cy.ts +193 -0
- package/tests/cypress/e2e/_utils/selectors/tasks.bdd.md +593 -0
- package/tests/cypress/e2e/_utils/selectors/tasks.cy.ts +864 -0
- package/tests/cypress/e2e/_utils/selectors/taxonomies.cy.ts +126 -0
- package/tests/cypress/e2e/_utils/selectors/teams.bdd.md +278 -0
- package/tests/cypress/e2e/_utils/selectors/teams.cy.ts +195 -0
- package/tests/cypress/e2e/_utils/superadmin/all-teams.bdd.md +261 -0
- package/tests/cypress/e2e/_utils/superadmin/all-teams.cy.ts +177 -0
- package/tests/cypress/e2e/_utils/superadmin/all-users.bdd.md +406 -0
- package/tests/cypress/e2e/_utils/superadmin/all-users.cy.ts +294 -0
- package/tests/cypress/e2e/_utils/superadmin/dashboard.bdd.md +235 -0
- package/tests/cypress/e2e/_utils/superadmin/dashboard.cy.ts +149 -0
- package/tests/cypress/e2e/_utils/superadmin/subscriptions-overview.bdd.md +290 -0
- package/tests/cypress/e2e/_utils/superadmin/subscriptions-overview.cy.ts +194 -0
- package/tests/cypress/e2e/ai/ai-usage.cy.ts +209 -0
- package/tests/cypress/e2e/ai/chat-api.cy.ts +119 -0
- package/tests/cypress/e2e/ai/guardrails.cy.ts +332 -0
- package/tests/cypress/e2e/api/_core/billing/BillingAPIController.js +319 -0
- package/tests/cypress/e2e/api/_core/billing/check-action.cy.ts +326 -0
- package/tests/cypress/e2e/api/_core/billing/checkout.cy.ts +358 -0
- package/tests/cypress/e2e/api/_core/billing/lifecycle.cy.ts +423 -0
- package/tests/cypress/e2e/api/_core/billing/plans/README.md +345 -0
- package/tests/cypress/e2e/api/_core/billing/plans/business.cy.ts +412 -0
- package/tests/cypress/e2e/api/_core/billing/plans/downgrade.cy.ts +510 -0
- package/tests/cypress/e2e/api/_core/billing/plans/fixtures/billing-plans.json +163 -0
- package/tests/cypress/e2e/api/_core/billing/plans/free.cy.ts +500 -0
- package/tests/cypress/e2e/api/_core/billing/plans/pro.cy.ts +497 -0
- package/tests/cypress/e2e/api/_core/billing/plans/starter.cy.ts +342 -0
- package/tests/cypress/e2e/api/_core/billing/portal.cy.ts +313 -0
- package/tests/cypress/e2e/api/_core/devtools/registries.bdd.md +300 -0
- package/tests/cypress/e2e/api/_core/devtools/registries.cy.ts +368 -0
- package/tests/cypress/e2e/api/_core/scheduled-actions/cron-endpoint.bdd.md +375 -0
- package/tests/cypress/e2e/api/_core/scheduled-actions/cron-endpoint.cy.ts +346 -0
- package/tests/cypress/e2e/api/_core/scheduled-actions/devtools-endpoint.bdd.md +451 -0
- package/tests/cypress/e2e/api/_core/scheduled-actions/devtools-endpoint.cy.ts +447 -0
- package/tests/cypress/e2e/api/_core/scheduled-actions/scheduling.bdd.md +649 -0
- package/tests/cypress/e2e/api/_core/scheduled-actions/scheduling.cy.ts +333 -0
- package/tests/cypress/e2e/api/_core/security/security-headers.cy.ts +601 -0
- package/tests/cypress/e2e/api/_core/settings/api-keys.crud.cy.ts +923 -0
- package/tests/cypress/e2e/api/_core/teams/teams-security.cy.ts +415 -0
- package/tests/cypress/e2e/api/_core/users/users-crud.cy.ts +469 -0
- package/tests/cypress/e2e/api/_core/users/users-metas.cy.ts +913 -0
- package/tests/cypress/e2e/api/_core/users/users-security.cy.ts +375 -0
- package/tests/cypress/e2e/api/entities/customers/customers-crud.cy.ts +648 -0
- package/tests/cypress/e2e/api/entities/customers/customers-metas.cy.ts +839 -0
- package/tests/cypress/e2e/api/entities/media/media-crud.cy.ts +600 -0
- package/tests/cypress/e2e/api/entities/media/media-role-permissions.cy.ts +617 -0
- package/tests/cypress/e2e/api/entities/media/media-team-isolation.cy.ts +464 -0
- package/tests/cypress/e2e/api/entities/pages/blocks-scope.cy.ts +396 -0
- package/tests/cypress/e2e/api/entities/pages/pages-crud.cy.ts +425 -0
- package/tests/cypress/e2e/api/entities/pages/pages-status.cy.ts +335 -0
- package/tests/cypress/e2e/api/entities/posts/post-categories-crud.cy.ts +610 -0
- package/tests/cypress/e2e/api/entities/posts/posts-crud.cy.ts +709 -0
- package/tests/cypress/e2e/api/entities/posts/posts-status.cy.ts +396 -0
- package/tests/cypress/e2e/api/entities/tasks/tasks-crud.cy.ts +602 -0
- package/tests/cypress/e2e/api/entities/tasks/tasks-metas.cy.ts +878 -0
- package/tests/cypress/e2e/patterns/patterns-in-pages.cy.ts +367 -0
- package/tests/cypress/e2e/uat/_core/auth/app-roles/developer-login.bdd.md +231 -0
- package/tests/cypress/e2e/uat/_core/auth/app-roles/developer-login.cy.ts +144 -0
- package/tests/cypress/e2e/uat/_core/auth/app-roles/superadmin-login.bdd.md +118 -0
- package/tests/cypress/e2e/uat/_core/auth/app-roles/superadmin-login.cy.ts +84 -0
- package/tests/cypress/e2e/uat/_core/auth/custom-roles/editor-login.bdd.md +288 -0
- package/tests/cypress/e2e/uat/_core/auth/custom-roles/editor-login.cy.ts +188 -0
- package/tests/cypress/e2e/uat/_core/auth/login-logout.bdd.md +160 -0
- package/tests/cypress/e2e/uat/_core/auth/login-logout.cy.ts +116 -0
- package/tests/cypress/e2e/uat/_core/auth/password-reset.bdd.md +289 -0
- package/tests/cypress/e2e/uat/_core/auth/password-reset.cy.ts +200 -0
- package/tests/cypress/e2e/uat/_core/auth/team-roles/admin-login.bdd.md +225 -0
- package/tests/cypress/e2e/uat/_core/auth/team-roles/admin-login.cy.ts +148 -0
- package/tests/cypress/e2e/uat/_core/auth/team-roles/member-login.bdd.md +251 -0
- package/tests/cypress/e2e/uat/_core/auth/team-roles/member-login.cy.ts +163 -0
- package/tests/cypress/e2e/uat/_core/auth/team-roles/owner-login.bdd.md +231 -0
- package/tests/cypress/e2e/uat/_core/auth/team-roles/owner-login.cy.ts +141 -0
- package/tests/cypress/e2e/uat/_core/billing/extended.bdd.md +273 -0
- package/tests/cypress/e2e/uat/_core/billing/extended.cy.ts +209 -0
- package/tests/cypress/e2e/uat/_core/billing/feature-gates.bdd.md +407 -0
- package/tests/cypress/e2e/uat/_core/billing/feature-gates.cy.ts +307 -0
- package/tests/cypress/e2e/uat/_core/billing/page.bdd.md +329 -0
- package/tests/cypress/e2e/uat/_core/billing/page.cy.ts +250 -0
- package/tests/cypress/e2e/uat/_core/billing/status.bdd.md +190 -0
- package/tests/cypress/e2e/uat/_core/billing/status.cy.ts +145 -0
- package/tests/cypress/e2e/uat/_core/billing/team-switch.bdd.md +156 -0
- package/tests/cypress/e2e/uat/_core/billing/team-switch.cy.ts +122 -0
- package/tests/cypress/e2e/uat/_core/billing/usage.bdd.md +218 -0
- package/tests/cypress/e2e/uat/_core/billing/usage.cy.ts +176 -0
- package/tests/cypress/e2e/uat/_core/blocks/hero.bdd.md +124 -0
- package/tests/cypress/e2e/uat/_core/blocks/hero.cy.ts +56 -0
- package/tests/cypress/e2e/uat/_core/devtools/api-tester.cy.ts +390 -0
- package/tests/cypress/e2e/uat/_core/performance/suspense-loading.cy.ts +134 -0
- package/tests/cypress/e2e/uat/_core/scheduled-actions/devtools-ui.bdd.md +736 -0
- package/tests/cypress/e2e/uat/_core/scheduled-actions/devtools-ui.cy.ts +740 -0
- package/tests/cypress/e2e/uat/_core/teams/inline-edit.cy.ts +278 -0
- package/tests/cypress/e2e/uat/_core/teams/roles-matrix.bdd.md +553 -0
- package/tests/cypress/e2e/uat/_core/teams/roles-matrix.cy.ts +185 -0
- package/tests/cypress/e2e/uat/_core/teams/switcher.bdd.md +1151 -0
- package/tests/cypress/e2e/uat/_core/teams/switcher.cy.ts +497 -0
- package/tests/cypress/e2e/uat/_core/teams/team-switcher.md +198 -0
- package/tests/cypress/e2e/uat/entities/customers/member.bdd.md +275 -0
- package/tests/cypress/e2e/uat/entities/customers/member.cy.ts +122 -0
- package/tests/cypress/e2e/uat/entities/customers/owner.bdd.md +243 -0
- package/tests/cypress/e2e/uat/entities/customers/owner.cy.ts +165 -0
- package/tests/cypress/e2e/uat/entities/pages/block-crud.bdd.md +476 -0
- package/tests/cypress/e2e/uat/entities/pages/block-crud.cy.ts +486 -0
- package/tests/cypress/e2e/uat/entities/pages/block-editor.bdd.md +460 -0
- package/tests/cypress/e2e/uat/entities/pages/block-editor.cy.ts +301 -0
- package/tests/cypress/e2e/uat/entities/pages/list.bdd.md +432 -0
- package/tests/cypress/e2e/uat/entities/pages/list.cy.ts +273 -0
- package/tests/cypress/e2e/uat/entities/pages/public-rendering.bdd.md +696 -0
- package/tests/cypress/e2e/uat/entities/pages/public-rendering.cy.ts +340 -0
- package/tests/cypress/e2e/uat/entities/posts/categories-api-aware.bdd.md +161 -0
- package/tests/cypress/e2e/uat/entities/posts/categories-api-aware.cy.ts +104 -0
- package/tests/cypress/e2e/uat/entities/posts/categories.bdd.md +375 -0
- package/tests/cypress/e2e/uat/entities/posts/categories.cy.ts +241 -0
- package/tests/cypress/e2e/uat/entities/posts/editor.bdd.md +429 -0
- package/tests/cypress/e2e/uat/entities/posts/editor.cy.ts +257 -0
- package/tests/cypress/e2e/uat/entities/posts/list.bdd.md +340 -0
- package/tests/cypress/e2e/uat/entities/posts/list.cy.ts +177 -0
- package/tests/cypress/e2e/uat/entities/posts/public.bdd.md +614 -0
- package/tests/cypress/e2e/uat/entities/posts/public.cy.ts +249 -0
- package/tests/cypress/e2e/uat/entities/tasks/member.bdd.md +222 -0
- package/tests/cypress/e2e/uat/entities/tasks/member.cy.ts +165 -0
- package/tests/cypress/e2e/uat/entities/tasks/owner.bdd.md +419 -0
- package/tests/cypress/e2e/uat/entities/tasks/owner.cy.ts +191 -0
- package/tests/cypress/e2e/uat/features/roles/editor-role.bdd.md +552 -0
- package/tests/cypress/e2e/uat/features/roles/editor-role.cy.ts +210 -0
- package/tests/cypress/e2e/uat/features/roles/member-restrictions.bdd.md +450 -0
- package/tests/cypress/e2e/uat/features/roles/member-restrictions.cy.ts +189 -0
- package/tests/cypress/e2e/uat/features/roles/owner-full-crud.bdd.md +530 -0
- package/tests/cypress/e2e/uat/features/roles/owner-full-crud.cy.ts +247 -0
- package/tests/cypress/fixtures/blocks.json +218 -0
- package/tests/cypress/fixtures/entities.json +87 -0
- package/tests/cypress/fixtures/page-builder.json +21 -0
- package/tests/cypress/src/components/CategoriesPOM.ts +382 -0
- package/tests/cypress/src/components/CustomersPOM.ts +439 -0
- package/tests/cypress/src/components/DevKeyringPOM.ts +160 -0
- package/tests/cypress/src/components/EntityForm.ts +375 -0
- package/tests/cypress/src/components/EntityList.ts +389 -0
- package/tests/cypress/src/components/PageBuilderPOM.ts +710 -0
- package/tests/cypress/src/components/PostEditorPOM.ts +370 -0
- package/tests/cypress/src/components/PostsListPOM.ts +223 -0
- package/tests/cypress/src/components/PublicPagePOM.ts +447 -0
- package/tests/cypress/src/components/PublicPostPOM.ts +146 -0
- package/tests/cypress/src/components/TasksPOM.ts +272 -0
- package/tests/cypress/src/components/TeamSwitcherPOM.ts +450 -0
- package/tests/cypress/src/components/index.ts +21 -0
- package/tests/cypress/src/controllers/ApiKeysAPIController.js +178 -0
- package/tests/cypress/src/controllers/BaseAPIController.js +317 -0
- package/tests/cypress/src/controllers/CustomerAPIController.js +251 -0
- package/tests/cypress/src/controllers/MediaAPIController.js +231 -0
- package/tests/cypress/src/controllers/PagesAPIController.js +226 -0
- package/tests/cypress/src/controllers/PostsAPIController.js +250 -0
- package/tests/cypress/src/controllers/TaskAPIController.js +240 -0
- package/tests/cypress/src/controllers/UsersAPIController.js +242 -0
- package/tests/cypress/src/controllers/index.js +25 -0
- package/tests/cypress/src/core/AuthPOM.ts +450 -0
- package/tests/cypress/src/core/BasePOM.ts +33 -0
- package/tests/cypress/src/core/BlockEditorBasePOM.ts +874 -0
- package/tests/cypress/src/core/DashboardEntityPOM.ts +41 -0
- package/tests/cypress/src/core/index.ts +14 -0
- package/tests/cypress/src/entities/CustomersPOM.ts +172 -0
- package/tests/cypress/src/entities/PagesPOM.ts +137 -0
- package/tests/cypress/src/entities/PatternsPOM.ts +329 -0
- package/tests/cypress/src/entities/PostsPOM.ts +137 -0
- package/tests/cypress/src/entities/TasksPOM.ts +246 -0
- package/tests/cypress/src/entities/index.ts +16 -0
- package/tests/cypress/src/features/BillingPOM.ts +385 -0
- package/tests/cypress/src/features/DashboardPOM.ts +271 -0
- package/tests/cypress/src/features/DevtoolsPOM.ts +750 -0
- package/tests/cypress/src/features/PageBuilderPOM.ts +283 -0
- package/tests/cypress/src/features/PostEditorPOM.ts +313 -0
- package/tests/cypress/src/features/ScheduledActionsPOM.ts +463 -0
- package/tests/cypress/src/features/SettingsPOM.ts +707 -0
- package/tests/cypress/src/features/SuperadminPOM.ts +851 -0
- package/tests/cypress/src/features/SuperadminTeamRolesPOM.ts +285 -0
- package/tests/cypress/src/features/index.ts +28 -0
- package/tests/cypress/src/helpers/ApiInterceptor.ts +20 -0
- package/tests/cypress/src/index.ts +101 -0
- package/tests/cypress/src/pages/dashboard/Dashboard.js +677 -0
- package/tests/cypress/src/pages/dashboard/DashboardPage.js +43 -0
- package/tests/cypress/src/pages/dashboard/DashboardStats.js +546 -0
- package/tests/cypress/src/pages/dashboard/index.js +6 -0
- package/tests/cypress/src/pages/index.js +5 -0
- package/tests/cypress/src/pages/public/FeaturesPage.js +28 -0
- package/tests/cypress/src/pages/public/LandingPage.js +69 -0
- package/tests/cypress/src/pages/public/PricingPage.js +33 -0
- package/tests/cypress/src/pages/public/index.js +6 -0
- package/tests/cypress/src/selectors.ts +46 -0
- package/tests/cypress/src/session-helpers.ts +518 -0
- package/tests/cypress/support/doc-commands.ts +260 -0
- package/tests/cypress/support/e2e.ts +90 -0
- package/tests/cypress.config.ts +178 -0
- package/tests/jest/__mocks__/@nextsparkjs/core/components/ui/badge.js +16 -0
- package/tests/jest/__mocks__/@nextsparkjs/core/lib/db.js +11 -0
- package/tests/jest/__mocks__/@nextsparkjs/registries/permissions-registry.ts +160 -0
- package/tests/jest/__mocks__/@nextsparkjs/registries/theme-registry.ts +68 -0
- package/tests/jest/__mocks__/jose.js +22 -0
- package/tests/jest/__mocks__/next/image.js +15 -0
- package/tests/jest/__mocks__/next-server.js +56 -0
- package/tests/jest/components/post-header.test.tsx +377 -0
- package/tests/jest/jest.config.cjs +154 -0
- package/tests/jest/langchain/COVERAGE.md +372 -0
- package/tests/jest/langchain/guardrails.test.ts +465 -0
- package/tests/jest/langchain/streaming.test.ts +370 -0
- package/tests/jest/langchain/token-tracker.test.ts +455 -0
- package/tests/jest/langchain/tracer-callbacks.test.ts +881 -0
- package/tests/jest/langchain/tracer.test.ts +823 -0
- package/tests/jest/services/tasks.service.test.ts +707 -0
- package/tests/jest/setup.ts +170 -0
- package/tests/jest/tsconfig.jest.json +6 -0
- package/tests/jest/validation/categories.test.ts +429 -0
- package/tests/jest/validation/posts.test.ts +546 -0
- package/tests/tsconfig.json +21 -0
- /package/docs/{02-features → public/02-features}/01-components.md +0 -0
- /package/docs/{02-features → public/02-features}/02-styling.md +0 -0
|
@@ -0,0 +1,601 @@
|
|
|
1
|
+
/// <reference types="cypress" />
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Security Headers Tests
|
|
5
|
+
*
|
|
6
|
+
* Tests for HTTP security headers on all routes.
|
|
7
|
+
* Verifies CSP, X-Frame-Options, X-Content-Type-Options, and other security headers.
|
|
8
|
+
*
|
|
9
|
+
* @see SEC-004 Security Headers Implementation
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import * as allure from 'allure-cypress'
|
|
13
|
+
|
|
14
|
+
describe('Security Headers', {
|
|
15
|
+
tags: ['@api', '@security', '@headers', '@regression']
|
|
16
|
+
}, () => {
|
|
17
|
+
|
|
18
|
+
const BASE_URL = Cypress.config('baseUrl') || 'http://localhost:5173'
|
|
19
|
+
|
|
20
|
+
beforeEach(() => {
|
|
21
|
+
allure.epic('Security')
|
|
22
|
+
allure.feature('HTTP Headers')
|
|
23
|
+
allure.story('Security Headers')
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
// ============================================
|
|
27
|
+
// Core Security Headers Tests
|
|
28
|
+
// ============================================
|
|
29
|
+
|
|
30
|
+
describe('Core Security Headers on HTML Pages', () => {
|
|
31
|
+
|
|
32
|
+
it('SEC_HDR_001: Homepage should have X-Content-Type-Options header', { tags: '@smoke' }, () => {
|
|
33
|
+
allure.severity('critical')
|
|
34
|
+
cy.request({
|
|
35
|
+
method: 'GET',
|
|
36
|
+
url: `${BASE_URL}/`,
|
|
37
|
+
failOnStatusCode: false
|
|
38
|
+
}).then((response) => {
|
|
39
|
+
expect(response.headers).to.have.property('x-content-type-options', 'nosniff')
|
|
40
|
+
})
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
it('SEC_HDR_002: Homepage should have X-Frame-Options header', { tags: '@smoke' }, () => {
|
|
44
|
+
allure.severity('critical')
|
|
45
|
+
cy.request({
|
|
46
|
+
method: 'GET',
|
|
47
|
+
url: `${BASE_URL}/`,
|
|
48
|
+
failOnStatusCode: false
|
|
49
|
+
}).then((response) => {
|
|
50
|
+
expect(response.headers).to.have.property('x-frame-options', 'DENY')
|
|
51
|
+
})
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
it('SEC_HDR_003: Homepage should have X-XSS-Protection header', () => {
|
|
55
|
+
allure.severity('normal')
|
|
56
|
+
cy.request({
|
|
57
|
+
method: 'GET',
|
|
58
|
+
url: `${BASE_URL}/`,
|
|
59
|
+
failOnStatusCode: false
|
|
60
|
+
}).then((response) => {
|
|
61
|
+
expect(response.headers).to.have.property('x-xss-protection', '1; mode=block')
|
|
62
|
+
})
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
it('SEC_HDR_004: Homepage should have Referrer-Policy header', () => {
|
|
66
|
+
allure.severity('normal')
|
|
67
|
+
cy.request({
|
|
68
|
+
method: 'GET',
|
|
69
|
+
url: `${BASE_URL}/`,
|
|
70
|
+
failOnStatusCode: false
|
|
71
|
+
}).then((response) => {
|
|
72
|
+
expect(response.headers).to.have.property('referrer-policy', 'strict-origin-when-cross-origin')
|
|
73
|
+
})
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
it('SEC_HDR_005: Homepage should have Permissions-Policy header', () => {
|
|
77
|
+
allure.severity('normal')
|
|
78
|
+
cy.request({
|
|
79
|
+
method: 'GET',
|
|
80
|
+
url: `${BASE_URL}/`,
|
|
81
|
+
failOnStatusCode: false
|
|
82
|
+
}).then((response) => {
|
|
83
|
+
expect(response.headers).to.have.property('permissions-policy')
|
|
84
|
+
expect(response.headers['permissions-policy']).to.include('camera=()')
|
|
85
|
+
expect(response.headers['permissions-policy']).to.include('microphone=()')
|
|
86
|
+
expect(response.headers['permissions-policy']).to.include('geolocation=()')
|
|
87
|
+
})
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
it('SEC_HDR_006: Homepage should have Content-Security-Policy header', { tags: '@smoke' }, () => {
|
|
91
|
+
allure.severity('critical')
|
|
92
|
+
cy.request({
|
|
93
|
+
method: 'GET',
|
|
94
|
+
url: `${BASE_URL}/`,
|
|
95
|
+
failOnStatusCode: false
|
|
96
|
+
}).then((response) => {
|
|
97
|
+
expect(response.headers).to.have.property('content-security-policy')
|
|
98
|
+
const csp = response.headers['content-security-policy']
|
|
99
|
+
|
|
100
|
+
// Validate key CSP directives
|
|
101
|
+
expect(csp).to.include("default-src 'self'")
|
|
102
|
+
expect(csp).to.include("script-src")
|
|
103
|
+
expect(csp).to.include("style-src")
|
|
104
|
+
expect(csp).to.include("img-src")
|
|
105
|
+
expect(csp).to.include("frame-ancestors 'none'")
|
|
106
|
+
})
|
|
107
|
+
})
|
|
108
|
+
})
|
|
109
|
+
|
|
110
|
+
// ============================================
|
|
111
|
+
// API Endpoints Security Headers
|
|
112
|
+
// ============================================
|
|
113
|
+
|
|
114
|
+
describe('Security Headers on API Endpoints', () => {
|
|
115
|
+
|
|
116
|
+
it('SEC_HDR_010: API endpoint should have X-Content-Type-Options', () => {
|
|
117
|
+
allure.severity('critical')
|
|
118
|
+
cy.request({
|
|
119
|
+
method: 'GET',
|
|
120
|
+
url: `${BASE_URL}/api/v1/theme`,
|
|
121
|
+
failOnStatusCode: false
|
|
122
|
+
}).then((response) => {
|
|
123
|
+
expect(response.headers).to.have.property('x-content-type-options', 'nosniff')
|
|
124
|
+
})
|
|
125
|
+
})
|
|
126
|
+
|
|
127
|
+
it('SEC_HDR_011: API endpoint should have X-Frame-Options', () => {
|
|
128
|
+
allure.severity('critical')
|
|
129
|
+
cy.request({
|
|
130
|
+
method: 'GET',
|
|
131
|
+
url: `${BASE_URL}/api/v1/theme`,
|
|
132
|
+
failOnStatusCode: false
|
|
133
|
+
}).then((response) => {
|
|
134
|
+
expect(response.headers).to.have.property('x-frame-options', 'DENY')
|
|
135
|
+
})
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
it('SEC_HDR_012: API endpoint should have Content-Security-Policy', () => {
|
|
139
|
+
allure.severity('normal')
|
|
140
|
+
cy.request({
|
|
141
|
+
method: 'GET',
|
|
142
|
+
url: `${BASE_URL}/api/v1/theme`,
|
|
143
|
+
failOnStatusCode: false
|
|
144
|
+
}).then((response) => {
|
|
145
|
+
expect(response.headers).to.have.property('content-security-policy')
|
|
146
|
+
})
|
|
147
|
+
})
|
|
148
|
+
})
|
|
149
|
+
|
|
150
|
+
// ============================================
|
|
151
|
+
// Login Page Security Headers
|
|
152
|
+
// ============================================
|
|
153
|
+
|
|
154
|
+
describe('Security Headers on Auth Pages', () => {
|
|
155
|
+
|
|
156
|
+
it('SEC_HDR_020: Login page should have all security headers', { tags: '@smoke' }, () => {
|
|
157
|
+
allure.severity('critical')
|
|
158
|
+
cy.request({
|
|
159
|
+
method: 'GET',
|
|
160
|
+
url: `${BASE_URL}/login`,
|
|
161
|
+
failOnStatusCode: false
|
|
162
|
+
}).then((response) => {
|
|
163
|
+
// All critical security headers
|
|
164
|
+
expect(response.headers).to.have.property('x-content-type-options', 'nosniff')
|
|
165
|
+
expect(response.headers).to.have.property('x-frame-options', 'DENY')
|
|
166
|
+
expect(response.headers).to.have.property('x-xss-protection', '1; mode=block')
|
|
167
|
+
expect(response.headers).to.have.property('referrer-policy', 'strict-origin-when-cross-origin')
|
|
168
|
+
expect(response.headers).to.have.property('content-security-policy')
|
|
169
|
+
})
|
|
170
|
+
})
|
|
171
|
+
|
|
172
|
+
it('SEC_HDR_021: Register page should have all security headers', () => {
|
|
173
|
+
allure.severity('normal')
|
|
174
|
+
cy.request({
|
|
175
|
+
method: 'GET',
|
|
176
|
+
url: `${BASE_URL}/register`,
|
|
177
|
+
failOnStatusCode: false
|
|
178
|
+
}).then((response) => {
|
|
179
|
+
expect(response.headers).to.have.property('x-content-type-options', 'nosniff')
|
|
180
|
+
expect(response.headers).to.have.property('x-frame-options', 'DENY')
|
|
181
|
+
expect(response.headers).to.have.property('content-security-policy')
|
|
182
|
+
})
|
|
183
|
+
})
|
|
184
|
+
})
|
|
185
|
+
|
|
186
|
+
// ============================================
|
|
187
|
+
// CSP Directive Validation
|
|
188
|
+
// ============================================
|
|
189
|
+
|
|
190
|
+
describe('CSP Directive Validation', () => {
|
|
191
|
+
|
|
192
|
+
it('SEC_HDR_030: CSP should allow Stripe scripts', () => {
|
|
193
|
+
allure.severity('normal')
|
|
194
|
+
cy.request({
|
|
195
|
+
method: 'GET',
|
|
196
|
+
url: `${BASE_URL}/`,
|
|
197
|
+
failOnStatusCode: false
|
|
198
|
+
}).then((response) => {
|
|
199
|
+
const csp = response.headers['content-security-policy']
|
|
200
|
+
expect(csp).to.include('https://js.stripe.com')
|
|
201
|
+
})
|
|
202
|
+
})
|
|
203
|
+
|
|
204
|
+
it('SEC_HDR_031: CSP should allow Stripe API connections', () => {
|
|
205
|
+
allure.severity('normal')
|
|
206
|
+
cy.request({
|
|
207
|
+
method: 'GET',
|
|
208
|
+
url: `${BASE_URL}/`,
|
|
209
|
+
failOnStatusCode: false
|
|
210
|
+
}).then((response) => {
|
|
211
|
+
const csp = response.headers['content-security-policy']
|
|
212
|
+
expect(csp).to.include('https://api.stripe.com')
|
|
213
|
+
})
|
|
214
|
+
})
|
|
215
|
+
|
|
216
|
+
it('SEC_HDR_032: CSP should allow Stripe iframes', () => {
|
|
217
|
+
allure.severity('normal')
|
|
218
|
+
cy.request({
|
|
219
|
+
method: 'GET',
|
|
220
|
+
url: `${BASE_URL}/`,
|
|
221
|
+
failOnStatusCode: false
|
|
222
|
+
}).then((response) => {
|
|
223
|
+
const csp = response.headers['content-security-policy']
|
|
224
|
+
expect(csp).to.include('frame-src')
|
|
225
|
+
expect(csp).to.include('https://js.stripe.com')
|
|
226
|
+
})
|
|
227
|
+
})
|
|
228
|
+
|
|
229
|
+
it('SEC_HDR_033: CSP should allow data: URIs for images', () => {
|
|
230
|
+
allure.severity('normal')
|
|
231
|
+
cy.request({
|
|
232
|
+
method: 'GET',
|
|
233
|
+
url: `${BASE_URL}/`,
|
|
234
|
+
failOnStatusCode: false
|
|
235
|
+
}).then((response) => {
|
|
236
|
+
const csp = response.headers['content-security-policy']
|
|
237
|
+
expect(csp).to.include('img-src')
|
|
238
|
+
expect(csp).to.include('data:')
|
|
239
|
+
})
|
|
240
|
+
})
|
|
241
|
+
|
|
242
|
+
it('SEC_HDR_034: CSP should block framing by other sites', () => {
|
|
243
|
+
allure.severity('critical')
|
|
244
|
+
cy.request({
|
|
245
|
+
method: 'GET',
|
|
246
|
+
url: `${BASE_URL}/`,
|
|
247
|
+
failOnStatusCode: false
|
|
248
|
+
}).then((response) => {
|
|
249
|
+
const csp = response.headers['content-security-policy']
|
|
250
|
+
expect(csp).to.include("frame-ancestors 'none'")
|
|
251
|
+
})
|
|
252
|
+
})
|
|
253
|
+
|
|
254
|
+
it('SEC_HDR_035: CSP should block object/plugin loading', () => {
|
|
255
|
+
allure.severity('normal')
|
|
256
|
+
cy.request({
|
|
257
|
+
method: 'GET',
|
|
258
|
+
url: `${BASE_URL}/`,
|
|
259
|
+
failOnStatusCode: false
|
|
260
|
+
}).then((response) => {
|
|
261
|
+
const csp = response.headers['content-security-policy']
|
|
262
|
+
expect(csp).to.include("object-src 'none'")
|
|
263
|
+
})
|
|
264
|
+
})
|
|
265
|
+
|
|
266
|
+
it('SEC_HDR_036: CSP should restrict base-uri to self', () => {
|
|
267
|
+
allure.severity('normal')
|
|
268
|
+
cy.request({
|
|
269
|
+
method: 'GET',
|
|
270
|
+
url: `${BASE_URL}/`,
|
|
271
|
+
failOnStatusCode: false
|
|
272
|
+
}).then((response) => {
|
|
273
|
+
const csp = response.headers['content-security-policy']
|
|
274
|
+
expect(csp).to.include("base-uri 'self'")
|
|
275
|
+
})
|
|
276
|
+
})
|
|
277
|
+
|
|
278
|
+
it('SEC_HDR_037: CSP img-src should allow specific trusted domains', () => {
|
|
279
|
+
allure.severity('normal')
|
|
280
|
+
cy.request({
|
|
281
|
+
method: 'GET',
|
|
282
|
+
url: `${BASE_URL}/`,
|
|
283
|
+
failOnStatusCode: false
|
|
284
|
+
}).then((response) => {
|
|
285
|
+
const csp = response.headers['content-security-policy']
|
|
286
|
+
// Should include specific domains, not https: wildcard
|
|
287
|
+
expect(csp).to.include('img-src')
|
|
288
|
+
expect(csp).to.include('lh3.googleusercontent.com')
|
|
289
|
+
expect(csp).to.include('images.unsplash.com')
|
|
290
|
+
})
|
|
291
|
+
})
|
|
292
|
+
})
|
|
293
|
+
|
|
294
|
+
// ============================================
|
|
295
|
+
// CORS Headers (API only)
|
|
296
|
+
// ============================================
|
|
297
|
+
|
|
298
|
+
describe('CORS Headers on API', () => {
|
|
299
|
+
|
|
300
|
+
it('SEC_HDR_040: API should have CORS headers', () => {
|
|
301
|
+
allure.severity('normal')
|
|
302
|
+
cy.request({
|
|
303
|
+
method: 'GET',
|
|
304
|
+
url: `${BASE_URL}/api/v1/theme`,
|
|
305
|
+
failOnStatusCode: false
|
|
306
|
+
}).then((response) => {
|
|
307
|
+
expect(response.headers).to.have.property('access-control-allow-origin')
|
|
308
|
+
expect(response.headers).to.have.property('access-control-allow-methods')
|
|
309
|
+
expect(response.headers).to.have.property('access-control-allow-credentials', 'true')
|
|
310
|
+
})
|
|
311
|
+
})
|
|
312
|
+
})
|
|
313
|
+
|
|
314
|
+
// ============================================
|
|
315
|
+
// CSP Violation Reporting
|
|
316
|
+
// ============================================
|
|
317
|
+
|
|
318
|
+
describe('CSP Violation Reporting', () => {
|
|
319
|
+
|
|
320
|
+
it('SEC_HDR_050: CSP should include report-uri and report-to directives', () => {
|
|
321
|
+
allure.severity('normal')
|
|
322
|
+
cy.request({
|
|
323
|
+
method: 'GET',
|
|
324
|
+
url: `${BASE_URL}/`,
|
|
325
|
+
failOnStatusCode: false
|
|
326
|
+
}).then((response) => {
|
|
327
|
+
const csp = response.headers['content-security-policy']
|
|
328
|
+
// Legacy report-uri for older browsers
|
|
329
|
+
expect(csp).to.include('report-uri /api/csp-report')
|
|
330
|
+
// Modern report-to for newer browsers
|
|
331
|
+
expect(csp).to.include('report-to csp-endpoint')
|
|
332
|
+
// Reporting-Endpoints header should also be present
|
|
333
|
+
expect(response.headers).to.have.property('reporting-endpoints')
|
|
334
|
+
expect(response.headers['reporting-endpoints']).to.include('csp-endpoint')
|
|
335
|
+
})
|
|
336
|
+
})
|
|
337
|
+
|
|
338
|
+
it('SEC_HDR_051: CSP report endpoint should accept violation reports', () => {
|
|
339
|
+
allure.severity('normal')
|
|
340
|
+
const mockViolation = {
|
|
341
|
+
'csp-report': {
|
|
342
|
+
'document-uri': 'https://example.com/page',
|
|
343
|
+
'referrer': '',
|
|
344
|
+
'violated-directive': 'script-src',
|
|
345
|
+
'effective-directive': 'script-src',
|
|
346
|
+
'original-policy': "default-src 'self'",
|
|
347
|
+
'blocked-uri': 'https://evil.com/malicious.js',
|
|
348
|
+
'status-code': 200
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
cy.request({
|
|
353
|
+
method: 'POST',
|
|
354
|
+
url: `${BASE_URL}/api/csp-report`,
|
|
355
|
+
headers: {
|
|
356
|
+
'Content-Type': 'application/csp-report'
|
|
357
|
+
},
|
|
358
|
+
body: mockViolation,
|
|
359
|
+
failOnStatusCode: false
|
|
360
|
+
}).then((response) => {
|
|
361
|
+
// CSP report endpoint should return 204 No Content
|
|
362
|
+
expect(response.status).to.eq(204)
|
|
363
|
+
})
|
|
364
|
+
})
|
|
365
|
+
|
|
366
|
+
it('SEC_HDR_052: CSP report endpoint should handle invalid content type', () => {
|
|
367
|
+
allure.severity('minor')
|
|
368
|
+
cy.request({
|
|
369
|
+
method: 'POST',
|
|
370
|
+
url: `${BASE_URL}/api/csp-report`,
|
|
371
|
+
headers: {
|
|
372
|
+
'Content-Type': 'text/plain'
|
|
373
|
+
},
|
|
374
|
+
body: 'invalid',
|
|
375
|
+
failOnStatusCode: false
|
|
376
|
+
}).then((response) => {
|
|
377
|
+
expect(response.status).to.eq(400)
|
|
378
|
+
})
|
|
379
|
+
})
|
|
380
|
+
})
|
|
381
|
+
|
|
382
|
+
// ============================================
|
|
383
|
+
// Negative Security Tests
|
|
384
|
+
// ============================================
|
|
385
|
+
|
|
386
|
+
describe('Negative Security Tests', () => {
|
|
387
|
+
|
|
388
|
+
it('SEC_HDR_060: CSP should NOT allow unsafe-eval in production mode', () => {
|
|
389
|
+
allure.severity('critical')
|
|
390
|
+
cy.request({
|
|
391
|
+
method: 'GET',
|
|
392
|
+
url: `${BASE_URL}/`,
|
|
393
|
+
failOnStatusCode: false
|
|
394
|
+
}).then((response) => {
|
|
395
|
+
const csp = response.headers['content-security-policy']
|
|
396
|
+
// In development, unsafe-eval is allowed for Next.js hot reload
|
|
397
|
+
// This test documents the expected behavior - in production, it would be blocked
|
|
398
|
+
// For now, we verify the CSP is present and properly formatted
|
|
399
|
+
expect(csp).to.be.a('string')
|
|
400
|
+
expect(csp.length).to.be.greaterThan(50)
|
|
401
|
+
})
|
|
402
|
+
})
|
|
403
|
+
|
|
404
|
+
it('SEC_HDR_061: CSP should NOT use https: wildcard for images', () => {
|
|
405
|
+
allure.severity('critical')
|
|
406
|
+
cy.request({
|
|
407
|
+
method: 'GET',
|
|
408
|
+
url: `${BASE_URL}/`,
|
|
409
|
+
failOnStatusCode: false
|
|
410
|
+
}).then((response) => {
|
|
411
|
+
const csp = response.headers['content-security-policy']
|
|
412
|
+
// Extract img-src directive
|
|
413
|
+
const imgSrcMatch = csp.match(/img-src[^;]+/)
|
|
414
|
+
if (imgSrcMatch) {
|
|
415
|
+
const imgSrc = imgSrcMatch[0]
|
|
416
|
+
// Should NOT have bare 'https:' which allows any HTTPS domain
|
|
417
|
+
// Should have specific domains instead
|
|
418
|
+
expect(imgSrc).to.not.match(/\shttps:\s/)
|
|
419
|
+
expect(imgSrc).to.not.match(/\shttps:;/)
|
|
420
|
+
expect(imgSrc).to.not.match(/\shttps:$/)
|
|
421
|
+
}
|
|
422
|
+
})
|
|
423
|
+
})
|
|
424
|
+
|
|
425
|
+
it('SEC_HDR_062: CSP should NOT use wss: wildcard in production', () => {
|
|
426
|
+
allure.severity('normal')
|
|
427
|
+
cy.request({
|
|
428
|
+
method: 'GET',
|
|
429
|
+
url: `${BASE_URL}/`,
|
|
430
|
+
failOnStatusCode: false
|
|
431
|
+
}).then((response) => {
|
|
432
|
+
const csp = response.headers['content-security-policy']
|
|
433
|
+
// In development, wss: is allowed for hot reload
|
|
434
|
+
// This test documents the expected behavior
|
|
435
|
+
expect(csp).to.include('connect-src')
|
|
436
|
+
})
|
|
437
|
+
})
|
|
438
|
+
|
|
439
|
+
it('SEC_HDR_063: X-Frame-Options should deny all framing', () => {
|
|
440
|
+
allure.severity('critical')
|
|
441
|
+
cy.request({
|
|
442
|
+
method: 'GET',
|
|
443
|
+
url: `${BASE_URL}/`,
|
|
444
|
+
failOnStatusCode: false
|
|
445
|
+
}).then((response) => {
|
|
446
|
+
// Should be DENY, not SAMEORIGIN or ALLOW-FROM
|
|
447
|
+
expect(response.headers['x-frame-options']).to.eq('DENY')
|
|
448
|
+
})
|
|
449
|
+
})
|
|
450
|
+
|
|
451
|
+
it('SEC_HDR_064: Permissions-Policy should disable dangerous features', () => {
|
|
452
|
+
allure.severity('normal')
|
|
453
|
+
cy.request({
|
|
454
|
+
method: 'GET',
|
|
455
|
+
url: `${BASE_URL}/`,
|
|
456
|
+
failOnStatusCode: false
|
|
457
|
+
}).then((response) => {
|
|
458
|
+
const policy = response.headers['permissions-policy']
|
|
459
|
+
// These features should be completely disabled (empty allowlist)
|
|
460
|
+
expect(policy).to.include('camera=()')
|
|
461
|
+
expect(policy).to.include('microphone=()')
|
|
462
|
+
expect(policy).to.include('geolocation=()')
|
|
463
|
+
})
|
|
464
|
+
})
|
|
465
|
+
})
|
|
466
|
+
|
|
467
|
+
// ============================================
|
|
468
|
+
// HSTS Configuration (Production Only)
|
|
469
|
+
// ============================================
|
|
470
|
+
|
|
471
|
+
describe('HSTS Configuration', () => {
|
|
472
|
+
|
|
473
|
+
it('SEC_HDR_070: Should have correct HSTS behavior based on environment', () => {
|
|
474
|
+
allure.severity('normal')
|
|
475
|
+
// HSTS is only enabled in production
|
|
476
|
+
// In production: Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
|
|
477
|
+
// In development: Header should NOT be present
|
|
478
|
+
|
|
479
|
+
cy.request({
|
|
480
|
+
method: 'GET',
|
|
481
|
+
url: `${BASE_URL}/`,
|
|
482
|
+
failOnStatusCode: false
|
|
483
|
+
}).then((response) => {
|
|
484
|
+
const isProduction = Cypress.env('NODE_ENV') === 'production'
|
|
485
|
+
|
|
486
|
+
if (isProduction) {
|
|
487
|
+
// Production: HSTS must be present with correct values
|
|
488
|
+
expect(response.headers).to.have.property('strict-transport-security')
|
|
489
|
+
const hsts = response.headers['strict-transport-security']
|
|
490
|
+
expect(hsts).to.include('max-age=31536000')
|
|
491
|
+
expect(hsts).to.include('includeSubDomains')
|
|
492
|
+
expect(hsts).to.include('preload')
|
|
493
|
+
} else {
|
|
494
|
+
// Development: HSTS should NOT be set (to avoid localhost issues)
|
|
495
|
+
expect(response.headers).to.not.have.property('strict-transport-security')
|
|
496
|
+
}
|
|
497
|
+
})
|
|
498
|
+
})
|
|
499
|
+
|
|
500
|
+
it('SEC_HDR_071: Development should NOT have HSTS header', () => {
|
|
501
|
+
allure.severity('normal')
|
|
502
|
+
// This test specifically verifies dev behavior
|
|
503
|
+
// HSTS on localhost would cause browser issues
|
|
504
|
+
|
|
505
|
+
cy.request({
|
|
506
|
+
method: 'GET',
|
|
507
|
+
url: `${BASE_URL}/`,
|
|
508
|
+
failOnStatusCode: false
|
|
509
|
+
}).then((response) => {
|
|
510
|
+
const isProduction = Cypress.env('NODE_ENV') === 'production'
|
|
511
|
+
|
|
512
|
+
if (!isProduction) {
|
|
513
|
+
// Explicitly verify no HSTS in development
|
|
514
|
+
expect(response.headers).to.not.have.property('strict-transport-security')
|
|
515
|
+
} else {
|
|
516
|
+
// Skip in production - SEC_HDR_070 covers this
|
|
517
|
+
cy.log('Skipping - running in production mode')
|
|
518
|
+
}
|
|
519
|
+
})
|
|
520
|
+
})
|
|
521
|
+
})
|
|
522
|
+
|
|
523
|
+
// ============================================
|
|
524
|
+
// Rate Limiting Tests
|
|
525
|
+
// ============================================
|
|
526
|
+
|
|
527
|
+
describe('CSP Report Rate Limiting', () => {
|
|
528
|
+
|
|
529
|
+
it('SEC_HDR_080: CSP report endpoint should work and optionally include rate limit headers', () => {
|
|
530
|
+
allure.severity('normal')
|
|
531
|
+
const mockViolation = {
|
|
532
|
+
'csp-report': {
|
|
533
|
+
'document-uri': 'https://example.com/page',
|
|
534
|
+
'violated-directive': 'script-src',
|
|
535
|
+
'blocked-uri': 'https://evil.com/malicious.js',
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
cy.request({
|
|
540
|
+
method: 'POST',
|
|
541
|
+
url: `${BASE_URL}/api/csp-report`,
|
|
542
|
+
headers: {
|
|
543
|
+
'Content-Type': 'application/csp-report'
|
|
544
|
+
},
|
|
545
|
+
body: mockViolation,
|
|
546
|
+
failOnStatusCode: false
|
|
547
|
+
}).then((response) => {
|
|
548
|
+
// CSP report should succeed with 204
|
|
549
|
+
expect(response.status).to.eq(204)
|
|
550
|
+
|
|
551
|
+
// Rate limit headers are optional (depend on @nextsparkjs/core/lib/api availability)
|
|
552
|
+
// If present, verify they have valid values
|
|
553
|
+
if (response.headers['x-ratelimit-limit']) {
|
|
554
|
+
expect(response.headers).to.have.property('x-ratelimit-remaining')
|
|
555
|
+
expect(response.headers).to.have.property('x-ratelimit-reset')
|
|
556
|
+
cy.log('Rate limiting is enabled')
|
|
557
|
+
} else {
|
|
558
|
+
cy.log('Rate limiting not available - skipping rate limit header checks')
|
|
559
|
+
}
|
|
560
|
+
})
|
|
561
|
+
})
|
|
562
|
+
})
|
|
563
|
+
|
|
564
|
+
// ============================================
|
|
565
|
+
// CORS x-api-key Header Tests
|
|
566
|
+
// ============================================
|
|
567
|
+
|
|
568
|
+
describe('CORS API Key Header', () => {
|
|
569
|
+
|
|
570
|
+
it('SEC_HDR_090: API CORS should allow x-api-key header', () => {
|
|
571
|
+
allure.severity('critical')
|
|
572
|
+
cy.request({
|
|
573
|
+
method: 'GET',
|
|
574
|
+
url: `${BASE_URL}/api/v1/theme`,
|
|
575
|
+
failOnStatusCode: false
|
|
576
|
+
}).then((response) => {
|
|
577
|
+
expect(response.headers).to.have.property('access-control-allow-headers')
|
|
578
|
+
const allowedHeaders = response.headers['access-control-allow-headers'].toLowerCase()
|
|
579
|
+
expect(allowedHeaders).to.include('x-api-key')
|
|
580
|
+
})
|
|
581
|
+
})
|
|
582
|
+
|
|
583
|
+
it('SEC_HDR_091: API CORS headers should include all required headers', () => {
|
|
584
|
+
allure.severity('normal')
|
|
585
|
+
cy.request({
|
|
586
|
+
method: 'GET',
|
|
587
|
+
url: `${BASE_URL}/api/v1/theme`,
|
|
588
|
+
failOnStatusCode: false
|
|
589
|
+
}).then((response) => {
|
|
590
|
+
expect(response.headers).to.have.property('access-control-allow-headers')
|
|
591
|
+
const allowedHeaders = response.headers['access-control-allow-headers'].toLowerCase()
|
|
592
|
+
|
|
593
|
+
// Verify all critical headers are allowed
|
|
594
|
+
expect(allowedHeaders).to.include('content-type')
|
|
595
|
+
expect(allowedHeaders).to.include('authorization')
|
|
596
|
+
expect(allowedHeaders).to.include('x-api-key')
|
|
597
|
+
expect(allowedHeaders).to.include('cookie')
|
|
598
|
+
})
|
|
599
|
+
})
|
|
600
|
+
})
|
|
601
|
+
})
|