GravityPDF / gravity-pdf

Gravity PDF is a GPLv2-licensed WordPress plugin that allows you to automatically generate, email and download PDF documents using Gravity Forms.
https://gravitypdf.com
88 stars 21 forks source link

Validate template filename (A-z0-9_-) format. #1416

Closed jestonihpi closed 1 year ago

jestonihpi commented 1 year ago

Description

Add an if statement that checks if the submitted template filename has an invalid characters and return an Exception if it does. This is based v6.4 release.

Get the template filename path and since basename automatically strips invalid characters. I need to manually pluck the filename and compare it to via regexp based on the provided pattern on #1384

1384

Testing instructions

Upload a filename with invalid characters e.g @~!#. etc

Screenshots

image image

Checklist:

Additional Comments

codecov[bot] commented 1 year ago

Codecov Report

Merging #1416 (db3f7e1) into development (460f600) will increase coverage by 15.16%. The diff coverage is n/a.

:exclamation: Current head db3f7e1 differs from pull request most recent head dbf6988. Consider uploading reports for the commit dbf6988 to get more accurate results

@@                Coverage Diff                 @@
##             development    #1416       +/-   ##
==================================================
+ Coverage          78.14%   93.30%   +15.16%     
==================================================
  Files                243       57      -186     
  Lines              10202     1464     -8738     
  Branches             370      370               
==================================================
- Hits                7972     1366     -6606     
+ Misses              2222       90     -2132     
  Partials               8        8               
Impacted Files Coverage Δ
src/Model/Model_Templates.php
src/View/html/PDF/entry_list_pdf_multiple.php
src/View/View_Settings.php
src/Helper/Fields/Field_Quantity.php
src/Model/Model_Uninstall.php
src/View/html/FormSettings/list.php
src/Helper/Fonts/TtfFontValidation.php
.../Exceptions/GravityPdfModelNotUpdatedException.php
src/templates/focus-gravity.php
src/Helper/Helper_Interface_Url_Signer.php
... and 176 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.