diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 77e73d98..a99e0796 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -152,11 +152,7 @@ jobs: bundle config path vendor/bundle bundle install --jobs 4 --retry 4 yarn install - wget -O pdfium-linux.zip "https://github.com/docusealco/pdfium-binaries/releases/download/20260813/pdfium-musl-$(uname -m).zip" - case "$(uname -m)" in - x86_64) echo "c5c7dde243ecb66ab0819c8193515ef38ad53549fe260f3c2dfd93ea56eda2e7 pdfium-linux.zip" ;; - aarch64) echo "64c4483449b1b4dccc696ad0c5c96e0b7f74dcc57b4f23c676b7a70671b0bbb5 pdfium-linux.zip" ;; - esac | sha256sum -c - + wget -O pdfium-linux.zip "https://github.com/docusealco/pdfium-binaries/releases/latest/download/pdfium-musl-$(uname -m).zip" unzip -q pdfium-linux.zip -d /tmp/pdfium-linux cp /tmp/pdfium-linux/lib/libpdfium.so /usr/lib/libpdfium.so rm -rf pdfium-linux.zip /tmp/pdfium-linux diff --git a/Dockerfile b/Dockerfile index 93c2836e..ee883b70 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,10 +9,10 @@ RUN apk --no-cache add wget unzip && \ wget https://raw.githubusercontent.com/impallari/DancingScript/master/OFL.txt && \ wget https://raw.githubusercontent.com/notofonts/noto-fonts/refs/heads/main/LICENSE && \ wget -O /model.onnx "https://github.com/docusealco/fields-detection/releases/download/2.0.0/model_704_int8.onnx" && \ - wget -O pdfium-linux.zip "https://github.com/docusealco/pdfium-binaries/releases/download/20260813/pdfium-musl-$(uname -m).zip" && \ + wget -O pdfium-linux.zip "https://github.com/docusealco/pdfium-binaries/releases/download/20260920/pdfium-musl-$(uname -m).zip" && \ case "$(uname -m)" in \ - x86_64) echo "c5c7dde243ecb66ab0819c8193515ef38ad53549fe260f3c2dfd93ea56eda2e7 pdfium-linux.zip" ;; \ - aarch64) echo "64c4483449b1b4dccc696ad0c5c96e0b7f74dcc57b4f23c676b7a70671b0bbb5 pdfium-linux.zip" ;; \ + x86_64) echo "bbca8a648dbd1ba81f9c6c223f21dc394cf1ad381c6c17d60c6dcc4a7d3a2ae0 pdfium-linux.zip" ;; \ + aarch64) echo "73b72ed79b9bfdd494dee7e863482c24971a8d4b11f6cd1289aa170d31304a1f pdfium-linux.zip" ;; \ esac | sha256sum -c - && \ mkdir -p /pdfium-linux && \ unzip -q pdfium-linux.zip -d /pdfium-linux diff --git a/app/controllers/api/active_storage_blobs_proxy_controller.rb b/app/controllers/api/active_storage_blobs_proxy_controller.rb index 4198f380..0cddd994 100644 --- a/app/controllers/api/active_storage_blobs_proxy_controller.rb +++ b/app/controllers/api/active_storage_blobs_proxy_controller.rb @@ -23,7 +23,7 @@ module Api blob = ActiveStorage::Blob.find_by!(uuid: blob_uuid) - if Submitters::DANGEROUS_EXTENSIONS.include?(blob.filename.extension.to_s.downcase) + if FilenameUtils.dangerous_extension(blob.filename) Rollbar.error('Dangerous extension') if defined?(Rollbar) return head :unprocessable_content diff --git a/app/controllers/api/active_storage_blobs_proxy_legacy_controller.rb b/app/controllers/api/active_storage_blobs_proxy_legacy_controller.rb index 8bac4ce9..3df2dae2 100644 --- a/app/controllers/api/active_storage_blobs_proxy_legacy_controller.rb +++ b/app/controllers/api/active_storage_blobs_proxy_legacy_controller.rb @@ -19,7 +19,7 @@ module Api return head :not_found unless blob - if Submitters::DANGEROUS_EXTENSIONS.include?(blob.filename.extension.to_s.downcase) + if FilenameUtils.dangerous_extension(blob.filename) Rollbar.error('Dangerous extension') if defined?(Rollbar) return head :unprocessable_content diff --git a/app/controllers/mcp/create_template_controller.rb b/app/controllers/mcp/create_template_controller.rb index b4c06a63..2f54ce71 100644 --- a/app/controllers/mcp/create_template_controller.rb +++ b/app/controllers/mcp/create_template_controller.rb @@ -46,6 +46,8 @@ module Mcp authorize!(:create, @template) + Templates.maybe_assign_access(@template) + if mcp_params['url'].present? tempfile = Tempfile.new tempfile.binmode diff --git a/app/controllers/preview_document_page_controller.rb b/app/controllers/preview_document_page_controller.rb index 05b848da..f4326590 100644 --- a/app/controllers/preview_document_page_controller.rb +++ b/app/controllers/preview_document_page_controller.rb @@ -26,8 +26,9 @@ class PreviewDocumentPageController < ActionController::API @template = attachment.record - preview_image = attachment.preview_images.joins(:blob) - .find_by(blob: { filename: ["#{params[:id]}.png", "#{params[:id]}.jpg"] }) + preview_image = + attachment.preview_images.joins(:blob) + .find_by(blob: { filename: ["#{params[:id].to_i}.png", "#{params[:id].to_i}.jpg"] }) if preview_image return redirect_to preview_image.url(time: ActiveStorage::Attachment.service_url_time), diff --git a/app/controllers/user_initials_controller.rb b/app/controllers/user_initials_controller.rb index f6b87daa..29562e64 100644 --- a/app/controllers/user_initials_controller.rb +++ b/app/controllers/user_initials_controller.rb @@ -11,11 +11,9 @@ class UserInitialsController < ApplicationController return redirect_to settings_profile_index_path, notice: I18n.t('unable_to_save_initials') if file.blank? - extension = File.extname(file.original_filename).delete_prefix('.').downcase + extension = FilenameUtils.dangerous_extension(file.original_filename) - if Submitters::DANGEROUS_EXTENSIONS.include?(extension) - raise Submitters::MaliciousFileExtension, "File type '.#{extension}' is not allowed." - end + raise Submitters::MaliciousFileExtension, "File type '.#{extension}' is not allowed." if extension blob = ActiveStorage::Blob.create_and_upload!(io: file.open, filename: file.original_filename, diff --git a/app/controllers/user_signatures_controller.rb b/app/controllers/user_signatures_controller.rb index f6511d00..da2974ea 100644 --- a/app/controllers/user_signatures_controller.rb +++ b/app/controllers/user_signatures_controller.rb @@ -11,11 +11,9 @@ class UserSignaturesController < ApplicationController return redirect_to settings_profile_index_path, notice: I18n.t('unable_to_save_signature') if file.blank? - extension = File.extname(file.original_filename).delete_prefix('.').downcase + extension = FilenameUtils.dangerous_extension(file.original_filename) - if Submitters::DANGEROUS_EXTENSIONS.include?(extension) - raise Submitters::MaliciousFileExtension, "File type '.#{extension}' is not allowed." - end + raise Submitters::MaliciousFileExtension, "File type '.#{extension}' is not allowed." if extension blob = ActiveStorage::Blob.create_and_upload!(io: file.open, filename: file.original_filename, diff --git a/app/javascript/elements/html_editor.js b/app/javascript/elements/html_editor.js index 29a5f40e..0c851ee5 100644 --- a/app/javascript/elements/html_editor.js +++ b/app/javascript/elements/html_editor.js @@ -353,7 +353,7 @@ function buildExtensions ({ Node, Mark, Extension, Plugin, Decoration, Decoratio const buildDecorations = (doc) => { const decorations = [] - const regex = /\{\{?[a-zA-Z0-9_.-]+\}\}?/g + const regex = /\{\{?[^{}\n]+\}\}?/g doc.descendants((node, pos) => { if (!node.isText) return diff --git a/app/javascript/elements/markdown_editor.js b/app/javascript/elements/markdown_editor.js index bd2508a5..9e31737c 100644 --- a/app/javascript/elements/markdown_editor.js +++ b/app/javascript/elements/markdown_editor.js @@ -150,7 +150,7 @@ export default actionable(targetable(class extends HTMLElement { const buildDecorations = (doc) => { const decorations = [] - const regex = /\{\{?[a-zA-Z0-9_.-]+\}\}?/g + const regex = /\{\{?[^{}\n]+\}\}?/g doc.descendants((node, pos) => { if (!node.isText) return diff --git a/app/views/esign_settings/_default_signature_row.html.erb b/app/views/esign_settings/_default_signature_row.html.erb index 8a2e3148..d5655f98 100644 --- a/app/views/esign_settings/_default_signature_row.html.erb +++ b/app/views/esign_settings/_default_signature_row.html.erb @@ -3,7 +3,7 @@ <%= svg_icon('discount_check_filled', class: 'w-6 h-6 shrink-0 text-green-500') %> <%= t('docuseal_trusted_signature') %> -
+ @@ -14,7 +14,7 @@ -
+
<%= button_to settings_esign_path, method: :put, params: { name: Docuseal::AATL_CERT_NAME }, class: 'btn btn-outline btn-neutral btn-xs whitespace-nowrap', title: t('make_default'), disabled: true do %> <%= t('make_default') %> <% end %> diff --git a/app/views/esign_settings/show.html.erb b/app/views/esign_settings/show.html.erb index 82a5a10e..2692aa37 100644 --- a/app/views/esign_settings/show.html.erb +++ b/app/views/esign_settings/show.html.erb @@ -120,7 +120,7 @@ <%= t('timeserver_url') %> - + diff --git a/app/views/mcp_settings/index.html.erb b/app/views/mcp_settings/index.html.erb index bb27bbc8..b0afcc3a 100644 --- a/app/views/mcp_settings/index.html.erb +++ b/app/views/mcp_settings/index.html.erb @@ -6,12 +6,10 @@ <%= t('mcp_server') %>
-
- <%= link_to new_settings_mcp_path, class: 'btn btn-primary btn-md gap-2 w-full md:w-fit', data: { turbo_frame: 'modal' } do %> - <%= svg_icon('plus', class: 'w-6 h-6') %> - <%= t('new_token') %> - <% end %> -
+ <%= link_to new_settings_mcp_path, class: 'btn btn-primary btn-md gap-2 w-full md:w-fit', data: { turbo_frame: 'modal' } do %> + <%= svg_icon('plus', class: 'w-6 h-6') %> + <%= t('new_token') %> + <% end %>
<% if @mcp_token.present? %> diff --git a/app/views/personalization_settings/_documents_copy_email_form.html.erb b/app/views/personalization_settings/_documents_copy_email_form.html.erb index 0f35fc69..bfa60344 100644 --- a/app/views/personalization_settings/_documents_copy_email_form.html.erb +++ b/app/views/personalization_settings/_documents_copy_email_form.html.erb @@ -12,7 +12,7 @@
<%= ff.label :subject, t('subject'), class: 'label' %> - +
diff --git a/app/views/personalization_settings/_signature_request_email_form.html.erb b/app/views/personalization_settings/_signature_request_email_form.html.erb index dc54826f..0db37c07 100644 --- a/app/views/personalization_settings/_signature_request_email_form.html.erb +++ b/app/views/personalization_settings/_signature_request_email_form.html.erb @@ -12,7 +12,7 @@
<%= ff.label :subject, t('subject'), class: 'label' %> - +
diff --git a/app/views/personalization_settings/_submitter_completed_email_form.html.erb b/app/views/personalization_settings/_submitter_completed_email_form.html.erb index f80ff410..d4daac9b 100644 --- a/app/views/personalization_settings/_submitter_completed_email_form.html.erb +++ b/app/views/personalization_settings/_submitter_completed_email_form.html.erb @@ -12,7 +12,7 @@
<%= ff.label :subject, t('subject'), class: 'label' %> - "> +
diff --git a/app/views/submission_events/index.html.erb b/app/views/submission_events/index.html.erb index cfc13e58..96a1b832 100644 --- a/app/views/submission_events/index.html.erb +++ b/app/views/submission_events/index.html.erb @@ -36,7 +36,7 @@ <%= l(event.event_timestamp.in_time_zone(current_account.timezone), format: :long, locale: current_account.locale) %> <% if (device = DetectBrowserDevice.call(event.data['ua'])) %> - + <%= svg_icon("device_#{device}", class: 'w-4 h-4') %> <% end %> diff --git a/app/views/submissions/_submitters_order.html.erb b/app/views/submissions/_submitters_order.html.erb index 2f603740..185e8737 100644 --- a/app/views/submissions/_submitters_order.html.erb +++ b/app/views/submissions/_submitters_order.html.erb @@ -7,7 +7,7 @@ <%= f.label :preserve_order, for: uuid = SecureRandom.uuid, class: 'flex items-center cursor-pointer' do %> <%= f.check_box :preserve_order, id: uuid, class: 'base-checkbox', checked: last_submission&.submitters_order.in?(['preserved', nil]) %> <%= t('preserve_order') %> - + <% end %> diff --git a/app/views/templates/_embedding.html.erb b/app/views/templates/_embedding.html.erb index 468a51fa..c11672f5 100644 --- a/app/views/templates/_embedding.html.erb +++ b/app/views/templates/_embedding.html.erb @@ -56,7 +56,7 @@
<%= link_to t('learn_more'), console_redirect_index_path(redir: "#{Docuseal::CONSOLE_URL}/embedding/form"), target: '_blank', data: { turbo: false }, class: 'btn btn-ghost text-gray-100 flex', rel: 'noopener' %> - "> "> "> @@ -78,7 +78,7 @@ -
<script src="<%= Docuseal::CDN_URL %>/js/form.js"></script>
+      
<script src="<%= Docuseal.multitenant? ? "#{Docuseal::CDN_URL}/js/form.js" : embed_script_url(filename: 'form.js') %>"></script>
 
 <docuseal-form data-src="<%= start_form_url(slug: template.slug) %>"></docuseal-form>
 
diff --git a/app/views/templates/_submission.html.erb b/app/views/templates/_submission.html.erb index 278bd679..e7ea158b 100644 --- a/app/views/templates/_submission.html.erb +++ b/app/views/templates/_submission.html.erb @@ -35,14 +35,14 @@
<% if submission.expired? && !submitter.completed_at? && !submitter.declined_at? %> -
+
<%= t('expired') %>
<% else %> - + <%= t(submitter.status) %> @@ -125,7 +125,7 @@ <% elsif submission.expired? %> -
+
<%= t('expired') %> diff --git a/app/views/templates_folders/edit.html.erb b/app/views/templates_folders/edit.html.erb index cd2a83ee..83a90ba2 100644 --- a/app/views/templates_folders/edit.html.erb +++ b/app/views/templates_folders/edit.html.erb @@ -5,7 +5,7 @@ <%= f.hidden_field :parent_name, value: @template.folder.parent_folder&.name || @template.folder.name %>
-