Skip to content

Conversation

@jasonchung1871
Copy link
Contributor

Description

This adds form embedding functionality in CHEFS, it includes:

  • A secure domain allowlisting system for controlling where forms can be embedded
  • Admin workflows for approving/denying embed domains
  • Security controls to prevent unauthorized embedding

Type of Change

feat (a new feature)

This is a breaking change because ...

  • Database schema changes
  • Adds middleware to some routes
  • Changes form designer settings

Checklist

  • I have read the CONTRIBUTING doc
  • I have checked that unit tests pass locally with my changes
  • I have run the npm script lint on the frontend and backend
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • I have approval from the product owner for the contribution in this pull request

Further comments

Introduces database migrations and Objection.js models for managing allowed and requested domains for embedded forms. Adds new tables 'form_allowed_domains' and 'form_requested_domains', and registers their models in the forms module.
Introduces embed domain management endpoints, middleware, and service to control which domains can embed forms. Adds security headers (CSP and X-Frame-Options) to form routes based on allowed domains. Updates form routes and mounting logic to integrate the new embed functionality.
Introduces validateRequestId and validateDomainId middleware to ensure these route parameters are valid UUIDs. Updates embed routes to use the new validators and fixes the embed routes import path in the form module.
Changed embed domain-related API routes to include '/embed/' in their paths for better clarity and consistency. Also removed the 'format: uuid' property from the JSON schema validation for 'id' and 'formId' fields in formAllowedDomain and formRequestedDomain models, relying solely on the UUID pattern.
Introduces a new Embed.vue component for managing allowed and requested embed domains for forms, including domain request and removal functionality. Adds embedService for API interactions, updates ManageForm.vue to include the embedding panel, and extends constants and translations to support the new feature.
Replaces the previous allowed/requested domain tables and models with a new, unified embed domain model and supporting history and status code tables. Adds migration, Objection models, and views for embed domain management and history. Updates admin and embed controllers, routes, services, and parameter validation to support new endpoints and logic for requesting, reviewing, revoking, and removing embedded form domains. Cleans up obsolete code and aligns naming and status handling for improved clarity and extensibility.
Consolidate review and revoke logic for form embed domain requests into a single update endpoint and service method. Removes separate revoke functionality and updates route/controller/service naming for clarity and maintainability.
Deleted the search method from the FormEmbedDomainVw model as it is no longer needed or used in the codebase.
Introduces admin UI for managing form embed domain requests, including review, status history, and deletion. Refactors frontend and backend APIs to unify allowed/requested domains, adds embed utilities for iframe resizing, and updates database views and models for consistency. Updates internationalization, store, and service layers to support new embed domain management workflows.
Removed unused isFormEmbedded ref in FormViewer.vue and FormEmbedDomainStatuses import in service.js. Added EMBED constant to constants.spec.js for improved test coverage.
jasonchung1871 and others added 6 commits July 9, 2025 14:24
Refactored AdminFormEmbed.vue and Embed.vue to use translation keys for all user-facing strings related to form embedding. Added new translation entries for form embed features in all supported languages, including error messages, labels, and table headers. This improves localization and consistency across the admin and form management interfaces.
Introduces detailed logging and improved error handling in the embed security middleware and service. Now, errors during embed permission checks are logged and result in default restrictive headers, while the service logs invalid origins and database errors, throwing exceptions for upstream handling.
Refactored admin and form embed components to fetch domain status codes from the backend instead of using hardcoded values. Updated internationalization files for all supported languages to include new error messages related to fetching domain status codes. This improves flexibility and localization for domain status handling.
@github-actions

This comment has been minimized.

jasonchung1871 and others added 3 commits July 9, 2025 16:10
Changed the initial value of embedPanel from 0 to 1 to update the default panel state in ManageForm.vue.
@sonarqubecloud
Copy link

@github-actions
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant