<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.appian.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>How to validate/handle file upload for filename contain double extension?</title><link>https://community.appian.com/discussions/f/user-interface/29963/how-to-validate-handle-file-upload-for-filename-contain-double-extension</link><description>Hi All, 
 We have observation from our VA testing team, that while uploading file it should not contain double extension like as shown below: 
 FileUploadBypass.php%00.xlsx 
 Currently Appian is allowing to upload the file in to application because of</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: How to validate/handle file upload for filename contain double extension?</title><link>https://community.appian.com/thread/119154?ContentTypeID=1</link><pubDate>Wed, 13 Sep 2023 10:36:36 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:8a5d123a-d063-4d71-a953-68fde3e1420e</guid><dc:creator>Sandeep</dc:creator><description>&lt;p&gt;Thank you&amp;nbsp;Mathieu Drouin,&lt;br /&gt;On UI at a!fileUploadField() we have put the given validation.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Sandeep&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to validate/handle file upload for filename contain double extension?</title><link>https://community.appian.com/thread/119153?ContentTypeID=1</link><pubDate>Wed, 13 Sep 2023 10:13:36 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:7fc12cf4-2289-44ce-88aa-ef4a8845aa41</guid><dc:creator>Sandeep</dc:creator><description>&lt;p&gt;Thank you Stefan,&lt;br /&gt;As of now we have opened Appian support ticket to discuss further on this.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Sandeep&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to validate/handle file upload for filename contain double extension?</title><link>https://community.appian.com/thread/118975?ContentTypeID=1</link><pubDate>Mon, 11 Sep 2023 13:55:08 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:83ae6f17-9f5e-4aad-8a61-62dc24861f5f</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;There is a file upload API in Appian !?!?!&lt;/p&gt;
&lt;p&gt;I suggest to contact Appian to discuss any &amp;quot;features&amp;quot; of built-in functionality.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to validate/handle file upload for filename contain double extension?</title><link>https://community.appian.com/thread/118971?ContentTypeID=1</link><pubDate>Mon, 11 Sep 2023 12:38:14 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:890162c0-de0a-4f66-83c8-e03a1cef9479</guid><dc:creator>Sandeep</dc:creator><description>&lt;p&gt;Hi Stefan,&lt;/p&gt;
&lt;p&gt;This API is not created by us. It is present in Appian as OOTB functionality to upload file.&lt;br /&gt;Testers are trying to use this API as part of Vulnerability Assessment (VA) testing to find out if Appian is allowing upload of double extension file.&lt;/p&gt;
&lt;p&gt;We will not have any control over this API.&lt;/p&gt;
&lt;p&gt;Just like we have an option to whitelist file extensions in admin console for file upload, do we have any option to reject upload of double extension files (Uploaded via OOTB file upload API)?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to validate/handle file upload for filename contain double extension?</title><link>https://community.appian.com/thread/118970?ContentTypeID=1</link><pubDate>Mon, 11 Sep 2023 12:09:03 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:5d845f07-6425-4189-8f4d-a57389ad1c76</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;Sure. The only problem here is, that you cannot decide whether the file is stored or not. This means, that in case everything is good, just return a 201 HTTP status code. If the file is not good, you need to actively delete the document using a!deleteDocument().&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to validate/handle file upload for filename contain double extension?</title><link>https://community.appian.com/thread/118968?ContentTypeID=1</link><pubDate>Mon, 11 Sep 2023 12:03:57 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:25720bb8-5d5d-4173-a2ec-4615492d32e7</guid><dc:creator>Mathieu Drouin</dc:creator><description>&lt;p&gt;I asked ChatGPT to create a Regex.&amp;nbsp;Haven&amp;#39;t had time to extensively test it but it&amp;#39;s a starting point.&lt;/p&gt;
&lt;p&gt;&lt;img src="/resized-image/__size/640x480/__key/communityserver-discussions-components-files/13/pastedimage1694433638685v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!pattern: &amp;quot;^(?=.*\.[^.]+)(?!(?:.*\.[^.]+){2}).*$&amp;quot;,
  regexmatch(
    local!pattern,
    &amp;quot;FileUploadBypass.php%00.xlsx&amp;quot;
  )
)
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to validate/handle file upload for filename contain double extension?</title><link>https://community.appian.com/thread/118965?ContentTypeID=1</link><pubDate>Mon, 11 Sep 2023 11:56:04 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:4de6c87c-1c70-4a91-88ab-02559f74ec55</guid><dc:creator>Sandeep</dc:creator><description>&lt;p&gt;Thank Stefan,&lt;/p&gt;
&lt;p&gt;As a part of VA testing, testers are using below API to upload the file using third party tool.&lt;/p&gt;
&lt;p&gt;URL is: &lt;strong&gt;suite/api/tempo/file?validateExtension=true&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Method: POST&lt;br /&gt;In the request Body they are passing the file with double extension&amp;nbsp;&lt;strong&gt;&amp;quot;FileUploadBypass.php%00.xlsx&amp;quot;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Please suggest, is there any way to block upload of double extension file from OOTB file upload api mentioned above.&lt;/p&gt;
&lt;p&gt;Please note: We are using 21.4 version of Appian.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to validate/handle file upload for filename contain double extension?</title><link>https://community.appian.com/thread/118957?ContentTypeID=1</link><pubDate>Mon, 11 Sep 2023 11:10:37 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:9e7aa60d-d34c-4c3d-98c8-c0066a446e89</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;len(cleanwith(&amp;quot;FileUploadBypass.php%00.xlsx&amp;quot;, &amp;quot;.&amp;quot;)) &amp;gt; 1&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to validate/handle file upload for filename contain double extension?</title><link>https://community.appian.com/thread/118953?ContentTypeID=1</link><pubDate>Mon, 11 Sep 2023 10:57:44 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:976c0d0e-98fe-45f4-bfcd-3c9adac801d0</guid><dc:creator>Sandeep</dc:creator><description>&lt;p&gt;Thank you Stewart Burchell,&lt;/p&gt;
&lt;p&gt;Could you please suggest some sample validation code, so that i may try to check once.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Sandeep&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to validate/handle file upload for filename contain double extension?</title><link>https://community.appian.com/thread/118948?ContentTypeID=1</link><pubDate>Mon, 11 Sep 2023 10:35:31 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:620fee04-e946-43fa-b0f6-d19147e3fba2</guid><dc:creator>Stewart Burchell</dc:creator><description>&lt;p&gt;A file as you describe will have two period characters in its filename so you can simply validate that the filename can only have one period character in it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>