<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Proper encoding of Symbols passed to SAS over the Web in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proper-encoding-of-Symbols-passed-to-SAS-over-the-Web/m-p/737049#M229734</link>
    <description>&lt;P&gt;Does the SAS interpreter remove single quotes for values passed in parameters over the web?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, using the sample intrnet application below and the following webrequest:&amp;nbsp;&lt;A href="https://sampleapplicationserver/cgi-bin/broker?_SERVICE=default&amp;amp;_PROGRAM=SAMPLIB.WEBSAMP.PRINT_TO_HTML.SOURCE&amp;amp;_ENTRY=SAMPLIB.WEBSAMP.PRINT_TO_HTML.SOURCE&amp;amp;BGTYPE=COLOR&amp;amp;BG=%23FFFFFF&amp;amp;DATASET=SA'SHELP.RE'TAIL&amp;amp;TEMPFILE=Unknown" target="_blank"&gt;https://sampleapplicationserver/cgi-bin/broker?_SERVICE=default&amp;amp;_PROGRAM=SAMPLIB.WEBSAMP.PRINT_TO_HTML.SOURCE&amp;amp;_ENTRY=SAMPLIB.WEBSAMP.PRINT_TO_HTML.SOURCE&amp;amp;BGTYPE=COLOR&amp;amp;BG=%23FFFFFF&amp;amp;DATASET=SA'SHELP.RE'TAIL&amp;amp;TEMPFILE=Unknown&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The 'SASHELP.RETAIL' dataset is still rendered correctly despite the addition of single quotes (SA'SHELP.RE'TAIL). I have also tried URL encoding these to %27 and it still has no affect.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;%global bg bgtype dataset style tmpstyle;                                                                                                                                                                                                                                                                                                                                                       
                                                                                                                                                                                                                                                                                                                                                                                                
%macro print_to_html;                                                                                                                                                                                                                                                                                                                                                                           
  %if not %sysfunc(exist(&amp;amp;dataset)) %then                                                                                                                                                                                                                                                                                                                                                       
  %do;                                                                                                                                                                                                                                                                                                                                                                                          
    data _null_;                                                                                                                                                                                                                                                                                                                                                                                
      file _webout;                                                                                                                                                                                                                                                                                                                                                                             
      put '&amp;lt;HTML&amp;gt;';                                                                                                                                                                                                                                                                                                                                                                             
      put '&amp;lt;HEAD&amp;gt;';                                                                                                                                                                                                                                                                                                                                                                             
      put '&amp;lt;TITLE&amp;gt;Missing Data Set&amp;lt;/TITLE&amp;gt;';                                                                                                                                                                                                                                                                                                                                                    
      put '&amp;lt;/HEAD&amp;gt;';                                                                                                                                                                                                                                                                                                                                                                            
      bgtype = symget('bgtype');                                                                                                                                                                                                                                                                                                                                                                
      if trim(upcase(bgtype))="COLOR" then put "&amp;lt;BODY BGCOLOR=&amp;amp;bg&amp;gt;";                                                                                                                                                                                                                                                                                                                            
      else if trim(upcase(bgtype))="IMAGE" then put '&amp;lt;BODY BACKGROUND="' "&amp;amp;bg" '"&amp;gt;';                                                                                                                                                                                                                                                                                                            
      else put '&amp;lt;BODY&amp;gt;';                                                                                                                                                                                                                                                                                                                                                                        
      put '&amp;lt;H1&amp;gt;Missing Data Set&amp;lt;/H1&amp;gt;';                                                                                                                                                                                                                                                                                                                                                          
      put "Data set &amp;amp;dataset not found.";                                                                                                                                                                                                                                                                                                                                                       
      put '&amp;lt;/BODY&amp;gt;';                                                                                                                                                                                                                                                                                                                                                                            
      put '&amp;lt;/HTML&amp;gt;';                                                                                                                                                                                                                                                                                                                                                                            
      run;                                                                                                                                                                                                                                                                                                                                                                                      
    %goto done;                                                                                                                                                                                                                                                                                                                                                                                 
  %end;                                                                                                                                                                                                                                                                                                                                                                                         
                                                                                                                                                                                                                                                                                                                                                                                                
  %if &amp;amp;style ne %then                                                                                                                                                                                                                                                                                                                                                                           
    %let tmpstyle=style=styles.&amp;amp;style;                                                                                                                                                                                                                                                                                                                                                          
  %else %if %UPCASE(&amp;amp;bgtype) eq COLOR %then                                                                                                                                                                                                                                                                                                                                                     
  %do;                                                                                                                                                                                                                                                                                                                                                                                          
    ods path work.templat(update)                                                                                                                                                                                                                                                                                                                                                               
             sasuser.templat(read) sashelp.tmplmst(read);                                                                                                                                                                                                                                                                                                                                       
    proc template;                                                                                                                                                                                                                                                                                                                                                                              
      define style tmpstyle;                                                                                                                                                                                                                                                                                                                                                                    
        parent=styles.default;                                                                                                                                                                                                                                                                                                                                                                  
        style body from body / background=&amp;amp;bg;                                                                                                                                                                                                                                                                                                                                                  
        style systemtitle from systemtitle / background=&amp;amp;bg;                                                                                                                                                                                                                                                                                                                                    
        style systemfooter from systemfooter / background=&amp;amp;bg;                                                                                                                                                                                                                                                                                                                                  
        style systitleandfootercontainer                                                                                                                                                                                                                                                                                                                                                        
              from systitleandfootercontainer / background=&amp;amp;bg;                                                                                                                                                                                                                                                                                                                                 
      end;                                                                                                                                                                                                                                                                                                                                                                                      
      run;                                                                                                                                                                                                                                                                                                                                                                                      
    %let tmpstyle=style=tmpstyle;                                                                                                                                                                                                                                                                                                                                                               
  %end;                                                                                                                                                                                                                                                                                                                                                                                         
  %else %if %UPCASE(&amp;amp;bgtype) eq IMAGE %then                                                                                                                                                                                                                                                                                                                                                     
  %do;                                                                                                                                                                                                                                                                                                                                                                                          
    ods path work.templat(update)                                                                                                                                                                                                                                                                                                                                                               
             sasuser.templat(read) sashelp.tmplmst(read);                                                                                                                                                                                                                                                                                                                                       
    proc template;                                                                                                                                                                                                                                                                                                                                                                              
      define style tmpstyle;                                                                                                                                                                                                                                                                                                                                                                    
        parent=styles.default;                                                                                                                                                                                                                                                                                                                                                                  
        style body from body / backgroundimage="&amp;amp;bg";                                                                                                                                                                                                                                                                                                                                           
      end;                                                                                                                                                                                                                                                                                                                                                                                      
      run;                                                                                                                                                                                                                                                                                                                                                                                      
    %let tmpstyle=style=tmpstyle;                                                                                                                                                                                                                                                                                                                                                               
  %end;                                                                                                                                                                                                                                                                                                                                                                                         
  %else                                                                                                                                                                                                                                                                                                                                                                                         
    %let tmpstyle=;                                                                                                                                                                                                                                                                                                                                                                             
                                                                                                                                                                                                                                                                                                                                                                                                
  ods html &amp;amp;tmpstyle body=_webout rs=none;                                                                                                                                                                                                                                                                                                                                                      
                                                                                                                                                                                                                                                                                                                                                                                                
  title "Data Set &amp;amp;dataset in HTML Format";                                                                                                                                                                                                                                                                                                                                                     
                                                                                                                                                                                                                                                                                                                                                                                                
  proc print data=&amp;amp;dataset;                                                                                                                                                                                                                                                                                                                                                                     
    run;                                                                                                                                                                                                                                                                                                                                                                                        
                                                                                                                                                                                                                                                                                                                                                                                                
  ods html close;                                                                                                                                                                                                                                                                                                                                                                               
%done:                                                                                                                                                                                                                                                                                                                                                                                          
%mend print_to_html;                                                                                                                                                                                                                                                                                                                                                                            
                                                                                                                                                                                                                                                                                                                                                                                                
* HTML encode vulnerable values to prevent XSS injection;                                                                                                                                                                                                                                                                                                                                       
                                                                                                                                                                                                                                                                                                                                                                                                
data _null_;                                                                                                                                                                                                                                                                                                                                                                                    
call symputx('BG',      htmlencode(symget('bg')));                                                                                                                                                                                                                                                                                                                                              
call symputx('DATASET', htmlencode(symget('dataset')));                                                                                                                                                                                                                                                                                                                                         
run;                                                                                                                                                                                                                                                                                                                                                                                            
                                                                                                                                                                                                                                                                                                                                                                                                
%print_to_html;                          &amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 26 Apr 2021 16:46:07 GMT</pubDate>
    <dc:creator>test110</dc:creator>
    <dc:date>2021-04-26T16:46:07Z</dc:date>
    <item>
      <title>Proper encoding of Symbols passed to SAS over the Web</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proper-encoding-of-Symbols-passed-to-SAS-over-the-Web/m-p/737049#M229734</link>
      <description>&lt;P&gt;Does the SAS interpreter remove single quotes for values passed in parameters over the web?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, using the sample intrnet application below and the following webrequest:&amp;nbsp;&lt;A href="https://sampleapplicationserver/cgi-bin/broker?_SERVICE=default&amp;amp;_PROGRAM=SAMPLIB.WEBSAMP.PRINT_TO_HTML.SOURCE&amp;amp;_ENTRY=SAMPLIB.WEBSAMP.PRINT_TO_HTML.SOURCE&amp;amp;BGTYPE=COLOR&amp;amp;BG=%23FFFFFF&amp;amp;DATASET=SA'SHELP.RE'TAIL&amp;amp;TEMPFILE=Unknown" target="_blank"&gt;https://sampleapplicationserver/cgi-bin/broker?_SERVICE=default&amp;amp;_PROGRAM=SAMPLIB.WEBSAMP.PRINT_TO_HTML.SOURCE&amp;amp;_ENTRY=SAMPLIB.WEBSAMP.PRINT_TO_HTML.SOURCE&amp;amp;BGTYPE=COLOR&amp;amp;BG=%23FFFFFF&amp;amp;DATASET=SA'SHELP.RE'TAIL&amp;amp;TEMPFILE=Unknown&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The 'SASHELP.RETAIL' dataset is still rendered correctly despite the addition of single quotes (SA'SHELP.RE'TAIL). I have also tried URL encoding these to %27 and it still has no affect.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;%global bg bgtype dataset style tmpstyle;                                                                                                                                                                                                                                                                                                                                                       
                                                                                                                                                                                                                                                                                                                                                                                                
%macro print_to_html;                                                                                                                                                                                                                                                                                                                                                                           
  %if not %sysfunc(exist(&amp;amp;dataset)) %then                                                                                                                                                                                                                                                                                                                                                       
  %do;                                                                                                                                                                                                                                                                                                                                                                                          
    data _null_;                                                                                                                                                                                                                                                                                                                                                                                
      file _webout;                                                                                                                                                                                                                                                                                                                                                                             
      put '&amp;lt;HTML&amp;gt;';                                                                                                                                                                                                                                                                                                                                                                             
      put '&amp;lt;HEAD&amp;gt;';                                                                                                                                                                                                                                                                                                                                                                             
      put '&amp;lt;TITLE&amp;gt;Missing Data Set&amp;lt;/TITLE&amp;gt;';                                                                                                                                                                                                                                                                                                                                                    
      put '&amp;lt;/HEAD&amp;gt;';                                                                                                                                                                                                                                                                                                                                                                            
      bgtype = symget('bgtype');                                                                                                                                                                                                                                                                                                                                                                
      if trim(upcase(bgtype))="COLOR" then put "&amp;lt;BODY BGCOLOR=&amp;amp;bg&amp;gt;";                                                                                                                                                                                                                                                                                                                            
      else if trim(upcase(bgtype))="IMAGE" then put '&amp;lt;BODY BACKGROUND="' "&amp;amp;bg" '"&amp;gt;';                                                                                                                                                                                                                                                                                                            
      else put '&amp;lt;BODY&amp;gt;';                                                                                                                                                                                                                                                                                                                                                                        
      put '&amp;lt;H1&amp;gt;Missing Data Set&amp;lt;/H1&amp;gt;';                                                                                                                                                                                                                                                                                                                                                          
      put "Data set &amp;amp;dataset not found.";                                                                                                                                                                                                                                                                                                                                                       
      put '&amp;lt;/BODY&amp;gt;';                                                                                                                                                                                                                                                                                                                                                                            
      put '&amp;lt;/HTML&amp;gt;';                                                                                                                                                                                                                                                                                                                                                                            
      run;                                                                                                                                                                                                                                                                                                                                                                                      
    %goto done;                                                                                                                                                                                                                                                                                                                                                                                 
  %end;                                                                                                                                                                                                                                                                                                                                                                                         
                                                                                                                                                                                                                                                                                                                                                                                                
  %if &amp;amp;style ne %then                                                                                                                                                                                                                                                                                                                                                                           
    %let tmpstyle=style=styles.&amp;amp;style;                                                                                                                                                                                                                                                                                                                                                          
  %else %if %UPCASE(&amp;amp;bgtype) eq COLOR %then                                                                                                                                                                                                                                                                                                                                                     
  %do;                                                                                                                                                                                                                                                                                                                                                                                          
    ods path work.templat(update)                                                                                                                                                                                                                                                                                                                                                               
             sasuser.templat(read) sashelp.tmplmst(read);                                                                                                                                                                                                                                                                                                                                       
    proc template;                                                                                                                                                                                                                                                                                                                                                                              
      define style tmpstyle;                                                                                                                                                                                                                                                                                                                                                                    
        parent=styles.default;                                                                                                                                                                                                                                                                                                                                                                  
        style body from body / background=&amp;amp;bg;                                                                                                                                                                                                                                                                                                                                                  
        style systemtitle from systemtitle / background=&amp;amp;bg;                                                                                                                                                                                                                                                                                                                                    
        style systemfooter from systemfooter / background=&amp;amp;bg;                                                                                                                                                                                                                                                                                                                                  
        style systitleandfootercontainer                                                                                                                                                                                                                                                                                                                                                        
              from systitleandfootercontainer / background=&amp;amp;bg;                                                                                                                                                                                                                                                                                                                                 
      end;                                                                                                                                                                                                                                                                                                                                                                                      
      run;                                                                                                                                                                                                                                                                                                                                                                                      
    %let tmpstyle=style=tmpstyle;                                                                                                                                                                                                                                                                                                                                                               
  %end;                                                                                                                                                                                                                                                                                                                                                                                         
  %else %if %UPCASE(&amp;amp;bgtype) eq IMAGE %then                                                                                                                                                                                                                                                                                                                                                     
  %do;                                                                                                                                                                                                                                                                                                                                                                                          
    ods path work.templat(update)                                                                                                                                                                                                                                                                                                                                                               
             sasuser.templat(read) sashelp.tmplmst(read);                                                                                                                                                                                                                                                                                                                                       
    proc template;                                                                                                                                                                                                                                                                                                                                                                              
      define style tmpstyle;                                                                                                                                                                                                                                                                                                                                                                    
        parent=styles.default;                                                                                                                                                                                                                                                                                                                                                                  
        style body from body / backgroundimage="&amp;amp;bg";                                                                                                                                                                                                                                                                                                                                           
      end;                                                                                                                                                                                                                                                                                                                                                                                      
      run;                                                                                                                                                                                                                                                                                                                                                                                      
    %let tmpstyle=style=tmpstyle;                                                                                                                                                                                                                                                                                                                                                               
  %end;                                                                                                                                                                                                                                                                                                                                                                                         
  %else                                                                                                                                                                                                                                                                                                                                                                                         
    %let tmpstyle=;                                                                                                                                                                                                                                                                                                                                                                             
                                                                                                                                                                                                                                                                                                                                                                                                
  ods html &amp;amp;tmpstyle body=_webout rs=none;                                                                                                                                                                                                                                                                                                                                                      
                                                                                                                                                                                                                                                                                                                                                                                                
  title "Data Set &amp;amp;dataset in HTML Format";                                                                                                                                                                                                                                                                                                                                                     
                                                                                                                                                                                                                                                                                                                                                                                                
  proc print data=&amp;amp;dataset;                                                                                                                                                                                                                                                                                                                                                                     
    run;                                                                                                                                                                                                                                                                                                                                                                                        
                                                                                                                                                                                                                                                                                                                                                                                                
  ods html close;                                                                                                                                                                                                                                                                                                                                                                               
%done:                                                                                                                                                                                                                                                                                                                                                                                          
%mend print_to_html;                                                                                                                                                                                                                                                                                                                                                                            
                                                                                                                                                                                                                                                                                                                                                                                                
* HTML encode vulnerable values to prevent XSS injection;                                                                                                                                                                                                                                                                                                                                       
                                                                                                                                                                                                                                                                                                                                                                                                
data _null_;                                                                                                                                                                                                                                                                                                                                                                                    
call symputx('BG',      htmlencode(symget('bg')));                                                                                                                                                                                                                                                                                                                                              
call symputx('DATASET', htmlencode(symget('dataset')));                                                                                                                                                                                                                                                                                                                                         
run;                                                                                                                                                                                                                                                                                                                                                                                            
                                                                                                                                                                                                                                                                                                                                                                                                
%print_to_html;                          &amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Apr 2021 16:46:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proper-encoding-of-Symbols-passed-to-SAS-over-the-Web/m-p/737049#M229734</guid>
      <dc:creator>test110</dc:creator>
      <dc:date>2021-04-26T16:46:07Z</dc:date>
    </item>
    <item>
      <title>Re: Proper encoding of Symbols passed to SAS over the Web</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proper-encoding-of-Symbols-passed-to-SAS-over-the-Web/m-p/737053#M229737</link>
      <description>&lt;P&gt;A few helpful functions can escape special characters in URLs and in HTML. If appearing in a URL, use urlencode. If you need to encode in HTML body, use htmlencode.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE width="828"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="192px"&gt;
&lt;P&gt;&lt;A href="http://go.documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=n0y10oliwg3voun100txgmy6d1g3.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en"&gt;HTMLDECODE Function&lt;/A&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="635px"&gt;
&lt;P&gt;Decodes a string that contains HTML numeric character references or HTML character entity references and returns the decoded string.&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="192px"&gt;
&lt;P&gt;&lt;A href="http://go.documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=n0cm3nfzxlg3iwn1myjzv3t8rt8j.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en"&gt;HTMLENCODE Function&lt;/A&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="635px"&gt;
&lt;P&gt;Encodes characters using HTML character entity references and returns the encoded string.&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="192px"&gt;
&lt;P&gt;&lt;A href="http://go.documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=p05qscijn2kj30n1ofetqnn8abob.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en"&gt;URLDECODE Function&lt;/A&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="635px"&gt;
&lt;P&gt;Returns a string that was decoded using the URL escape syntax.&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="192px"&gt;
&lt;P&gt;&lt;A href="http://go.documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=p19ckwqexa3ir8n19hbvcz73lhmj.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en"&gt;URLENCODE Function&lt;/A&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="635px"&gt;
&lt;P&gt;Returns a string that was encoded using the URL escape syntax.&lt;/P&gt;
&lt;P&gt;From: urlencode(%str(&lt;STRONG&gt;ga:sessions,ga:pageviews,ga:users&lt;/STRONG&gt;));&lt;/P&gt;
&lt;P&gt;To:&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;STRONG&gt;ga%3Asessions,ga%3Apageviews,ga%3Ausers&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="192px"&gt;
&lt;P&gt;%str(&amp;amp;)&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="635px"&gt;
&lt;P&gt;Prevent SAS from interpreting “&amp;amp;” in a URL as a macro variable.&lt;BR /&gt;&amp;nbsp;in="custname=Joe%str(&amp;amp;)size=large%str(&amp;amp;)topping=cheese"&lt;/P&gt;
&lt;P&gt;Avoids "WARNING: Apparent symbolic reference TOPPING not resolved."&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;</description>
      <pubDate>Mon, 26 Apr 2021 16:58:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proper-encoding-of-Symbols-passed-to-SAS-over-the-Web/m-p/737053#M229737</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2021-04-26T16:58:52Z</dc:date>
    </item>
    <item>
      <title>Re: Proper encoding of Symbols passed to SAS over the Web</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proper-encoding-of-Symbols-passed-to-SAS-over-the-Web/m-p/737056#M229738</link>
      <description>&lt;P&gt;Chris, thanks for the reply. I guess my question is, without modifying the previously provided code, why are the single quotes not being interpreted? Other URL encoded symbol characters such as the equal sign, question mark, etc are interpreted correctly, however, single quotes and percent signs appear to have no affect on the values.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Apr 2021 17:09:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proper-encoding-of-Symbols-passed-to-SAS-over-the-Web/m-p/737056#M229738</guid>
      <dc:creator>test110</dc:creator>
      <dc:date>2021-04-26T17:09:37Z</dc:date>
    </item>
    <item>
      <title>Re: Proper encoding of Symbols passed to SAS over the Web</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proper-encoding-of-Symbols-passed-to-SAS-over-the-Web/m-p/737058#M229739</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/375003"&gt;@test110&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Chris, thanks for the reply. I guess my question is, without modifying the previously provided code, why are the single quotes not being interpreted? Other URL encoded symbol characters such as the equal sign, question mark, etc are interpreted correctly, however, single quotes and percent signs appear to have no affect on the values.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Please highlight or extract the lines you expect to be using text with single quotes. I cannot tell where you are expecting them to come from or be used.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Apr 2021 17:30:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proper-encoding-of-Symbols-passed-to-SAS-over-the-Web/m-p/737058#M229739</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-04-26T17:30:17Z</dc:date>
    </item>
    <item>
      <title>Re: Proper encoding of Symbols passed to SAS over the Web</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proper-encoding-of-Symbols-passed-to-SAS-over-the-Web/m-p/737060#M229741</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please see below for the highlighted (in red) lines-&lt;/P&gt;&lt;P&gt;For the URL portion:&amp;nbsp;&lt;FONT color="#000000"&gt;&amp;amp;DATASET=SA%27SHELP.RE%27TAIL&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;For the code portion: line 4 (&amp;amp;dataset)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, here is the full URL that is being used (it appears it got cut off earlier in the post):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;https://sampleapplicationserver/cgi-bin/broker?_SERVICE=default&amp;amp;_PROGRAM=SAMPLIB.WEBSAMP.PRINT_TO_HTML.SOURCE&amp;amp;_ENTRY=SAMPLIB.WEBSAMP.PRINT_TO_HTML.SOURCE&amp;amp;BGTYPE=COLOR&amp;amp;BG=%23FFFFFF&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;&amp;amp;DATASET=SA%27SHELP.RE%27TAIL&lt;/STRONG&gt;&lt;/FONT&gt;&amp;amp;TEMPFILE=Unknown&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;%global bg bgtype dataset style tmpstyle;                                                                                                                                                                                                                                                                                                                                                       
                                                                                                                                                                                                                                                                                                                                                                                                
%macro print_to_html;                                                                                                                                                                                                                                                                                                                                                                           
  %if not %sysfunc(exist(&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;&amp;amp;dataset&lt;/FONT&gt;&lt;/STRONG&gt;)) %then                                                                                                                                                                                                                                                                                                                                                       
  %do;                                                                                                                                                                                                                                                                                                                                                                                          
    data _null_;                                                                                                                                                                                                                                                                                                                                                                                
      file _webout;                                                                                                                                                                                                                                                                                                                                                                             
      put '&amp;lt;HTML&amp;gt;';                                                                                                                                                                                                                                                                                                                                                                             
      put '&amp;lt;HEAD&amp;gt;';                                                                                                                                                                                                                                                                                                                                                                             
      put '&amp;lt;TITLE&amp;gt;Missing Data Set&amp;lt;/TITLE&amp;gt;';                                                                                                                                                                                                                                                                                                                                                    
      put '&amp;lt;/HEAD&amp;gt;';                                                                                                                                                                                                                                                                                                                                                                            
      bgtype = symget('bgtype');                                                                                                                                                                                                                                                                                                                                                                
      if trim(upcase(bgtype))="COLOR" then put "&amp;lt;BODY BGCOLOR=&amp;amp;bg&amp;gt;";                                                                                                                                                                                                                                                                                                                            
      else if trim(upcase(bgtype))="IMAGE" then put '&amp;lt;BODY BACKGROUND="' "&amp;amp;bg" '"&amp;gt;';                                                                                                                                                                                                                                                                                                            
      else put '&amp;lt;BODY&amp;gt;';                                                                                                                                                                                                                                                                                                                                                                        
      put '&amp;lt;H1&amp;gt;Missing Data Set&amp;lt;/H1&amp;gt;';                                                                                                                                                                                                                                                                                                                                                          
      put "Data set &amp;amp;dataset not found.";                                                                                                                                                                                                                                                                                                                                                       
      put '&amp;lt;/BODY&amp;gt;';                                                                                                                                                                                                                                                                                                                                                                            
      put '&amp;lt;/HTML&amp;gt;';                                                                                                                                                                                                                                                                                                                                                                            
      run;                                                                                                                                                                                                                                                                                                                                                                                      
    %goto done;                                                                                                                                                                                                                                                                                                                                                                                 
  %end;                                                                                                                                                                                                                                                                                                                                                                                         
                                                                                                                                                                                                                                                                                                                                                                                                
  %if &amp;amp;style ne %then                                                                                                                                                                                                                                                                                                                                                                           
    %let tmpstyle=style=styles.&amp;amp;style;                                                                                                                                                                                                                                                                                                                                                          
  %else %if %UPCASE(&amp;amp;bgtype) eq COLOR %then                                                                                                                                                                                                                                                                                                                                                     
  %do;                                                                                                                                                                                                                                                                                                                                                                                          
    ods path work.templat(update)                                                                                                                                                                                                                                                                                                                                                               
             sasuser.templat(read) sashelp.tmplmst(read);                                                                                                                                                                                                                                                                                                                                       
    proc template;                                                                                                                                                                                                                                                                                                                                                                              
      define style tmpstyle;                                                                                                                                                                                                                                                                                                                                                                    
        parent=styles.default;                                                                                                                                                                                                                                                                                                                                                                  
        style body from body / background=&amp;amp;bg;                                                                                                                                                                                                                                                                                                                                                  
        style systemtitle from systemtitle / background=&amp;amp;bg;                                                                                                                                                                                                                                                                                                                                    
        style systemfooter from systemfooter / background=&amp;amp;bg;                                                                                                                                                                                                                                                                                                                                  
        style systitleandfootercontainer                                                                                                                                                                                                                                                                                                                                                        
              from systitleandfootercontainer / background=&amp;amp;bg;                                                                                                                                                                                                                                                                                                                                 
      end;                                                                                                                                                                                                                                                                                                                                                                                      
      run;                                                                                                                                                                                                                                                                                                                                                                                      
    %let tmpstyle=style=tmpstyle;                                                                                                                                                                                                                                                                                                                                                               
  %end;                                                                                                                                                                                                                                                                                                                                                                                         
  %else %if %UPCASE(&amp;amp;bgtype) eq IMAGE %then                                                                                                                                                                                                                                                                                                                                                     
  %do;                                                                                                                                                                                                                                                                                                                                                                                          
    ods path work.templat(update)                                                                                                                                                                                                                                                                                                                                                               
             sasuser.templat(read) sashelp.tmplmst(read);                                                                                                                                                                                                                                                                                                                                       
    proc template;                                                                                                                                                                                                                                                                                                                                                                              
      define style tmpstyle;                                                                                                                                                                                                                                                                                                                                                                    
        parent=styles.default;                                                                                                                                                                                                                                                                                                                                                                  
        style body from body / backgroundimage="&amp;amp;bg";                                                                                                                                                                                                                                                                                                                                           
      end;                                                                                                                                                                                                                                                                                                                                                                                      
      run;                                                                                                                                                                                                                                                                                                                                                                                      
    %let tmpstyle=style=tmpstyle;                                                                                                                                                                                                                                                                                                                                                               
  %end;                                                                                                                                                                                                                                                                                                                                                                                         
  %else                                                                                                                                                                                                                                                                                                                                                                                         
    %let tmpstyle=;                                                                                                                                                                                                                                                                                                                                                                             
                                                                                                                                                                                                                                                                                                                                                                                                
  ods html &amp;amp;tmpstyle body=_webout rs=none;                                                                                                                                                                                                                                                                                                                                                      
                                                                                                                                                                                                                                                                                                                                                                                                
  title "Data Set &amp;amp;dataset in HTML Format";                                                                                                                                                                                                                                                                                                                                                     
                                                                                                                                                                                                                                                                                                                                                                                                
  proc print data=&amp;amp;dataset;                                                                                                                                                                                                                                                                                                                                                                     
    run;                                                                                                                                                                                                                                                                                                                                                                                        
                                                                                                                                                                                                                                                                                                                                                                                                
  ods html close;                                                                                                                                                                                                                                                                                                                                                                               
%done:                                                                                                                                                                                                                                                                                                                                                                                          
%mend print_to_html;                                                                                                                                                                                                                                                                                                                                                                            
                                                                                                                                                                                                                                                                                                                                                                                                
* HTML encode vulnerable values to prevent XSS injection;                                                                                                                                                                                                                                                                                                                                       
                                                                                                                                                                                                                                                                                                                                                                                                
data _null_;                                                                                                                                                                                                                                                                                                                                                                                    
call symputx('BG',      htmlencode(symget('bg')));                                                                                                                                                                                                                                                                                                                                              
call symputx('DATASET', htmlencode(symget('dataset')));                                                                                                                                                                                                                                                                                                                                         
run;                                                                                                                                                                                                                                                                                                                                                                                            
                                                                                                                                                                                                                                                                                                                                                                                                
%print_to_html;                          &amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Apr 2021 17:36:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proper-encoding-of-Symbols-passed-to-SAS-over-the-Web/m-p/737060#M229741</guid>
      <dc:creator>test110</dc:creator>
      <dc:date>2021-04-26T17:36:06Z</dc:date>
    </item>
    <item>
      <title>Re: Proper encoding of Symbols passed to SAS over the Web</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proper-encoding-of-Symbols-passed-to-SAS-over-the-Web/m-p/737070#M229742</link>
      <description>&lt;P&gt;Your code does not show where the value of &amp;amp;dataset is set. So we cannot tell what the actual value of the variable &amp;amp;dataset holds. Since you are using the SAS function Exist it is very likely that the data set parameter does not have any quotes because that will generate an error:&lt;/P&gt;
&lt;PRE&gt;52   %let dataset= sas'help.cla'ss;
                      ----------
                      49
NOTE 49-169: The meaning of an identifier after a quoted string might change in a future SAS
             release.  Inserting white space between a quoted string and the succeeding
             identifier is recommended.
53   %put Sysfunc result is: %sysfunc(exist(&amp;amp;dataset)) ;
NOTE: Line generated by the macro variable "DATASET".
1    sas'help.cla'ss
        ----------
        49
Sysfunc result is: 0
NOTE 49-169: The meaning of an identifier after a quoted string might change in a future SAS
             release.  Inserting white space between a quoted string and the succeeding
             identifier is recommended.
&lt;/PRE&gt;
&lt;P&gt;The 0 result means the data set doesn't exist.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The data set sashelp.class does exist as shown here:&lt;/P&gt;
&lt;PRE&gt;54   %let dataset= sashelp.class;
55   %put Sysfunc result is: %sysfunc(exist(&amp;amp;dataset)) ;
Sysfunc result is: 1
&lt;/PRE&gt;
&lt;P&gt;The form of data set names that would be acceptable to the Exist function would be 'some non-standard name'n. No quotes in the middle, the entire name would have to be within quotes and have an n following. So your EXIST always fails. and not of that header information gets by the data _null_ step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or perhaps you need to run the code with OPTIONS MPRINT and examine what is being generated in your macro.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Apr 2021 17:53:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proper-encoding-of-Symbols-passed-to-SAS-over-the-Web/m-p/737070#M229742</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-04-26T17:53:28Z</dc:date>
    </item>
    <item>
      <title>Re: Proper encoding of Symbols passed to SAS over the Web</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proper-encoding-of-Symbols-passed-to-SAS-over-the-Web/m-p/737077#M229745</link>
      <description>&lt;P&gt;The value is being retrieved from the URL request here, with the actual value highlighted in red:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;https://sampleapplicationserver/cgi-bin/broker?_SERVICE=default&amp;amp;_PROGRAM=SAMPLIB.WEBSAMP.PRINT_TO_HTML.SOURCE&amp;amp;_ENTRY=SAMPLIB.WEBSAMP.PRINT_TO_HTML.SOURCE&amp;amp;BGTYPE=COLOR&amp;amp;BG=%23FFFFFF&lt;/SPAN&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;&amp;amp;DATASET=SA%27SHELP.RE%27TAIL&lt;/STRONG&gt;&lt;/FONT&gt;&lt;SPAN&gt;&amp;amp;TEMPFILE=Unknown&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just to reiterate, the %27 (single quotes) are not making it to the actual 'dataset' value, that it my question. Why are the single quotes not being interpreted? Other symbols, like:&amp;nbsp;@$() seem to be interpreted alright, but the single quotes and percent signs, when passed in URL parameters do not get interpreted.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Apr 2021 18:00:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proper-encoding-of-Symbols-passed-to-SAS-over-the-Web/m-p/737077#M229745</guid>
      <dc:creator>test110</dc:creator>
      <dc:date>2021-04-26T18:00:24Z</dc:date>
    </item>
    <item>
      <title>Re: Proper encoding of Symbols passed to SAS over the Web</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proper-encoding-of-Symbols-passed-to-SAS-over-the-Web/m-p/737079#M229747</link>
      <description>&lt;P&gt;So the app broker seems to be "cleaning" them out?&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13635"&gt;@Vince_SAS&lt;/a&gt;&amp;nbsp;may be able to shed some light.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Apr 2021 18:17:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proper-encoding-of-Symbols-passed-to-SAS-over-the-Web/m-p/737079#M229747</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2021-04-26T18:17:22Z</dc:date>
    </item>
    <item>
      <title>Re: Proper encoding of Symbols passed to SAS over the Web</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proper-encoding-of-Symbols-passed-to-SAS-over-the-Web/m-p/737090#M229751</link>
      <description>&lt;P&gt;&lt;FONT face="verdana,geneva"&gt;The quotation marks are stripped from the input parameter to prevent cross-site scripting code injections:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="verdana,geneva"&gt;&lt;STRONG&gt;SAS/IntrNet 9.4: Application Dispatcher &amp;gt; PROC APPSRV Statement &amp;gt; UNSAFE='string'&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="verdana,geneva"&gt;&lt;A href="https://go.documentation.sas.com/doc/en/dispatch/9.4/n08ru77fqa1k2kn17p6oq9abvl0h.htm#n0ad6r9wll3y50n1hoxa7an2c4bc" target="_blank"&gt;https://go.documentation.sas.com/doc/en/dispatch/9.4/n08ru77fqa1k2kn17p6oq9abvl0h.htm#n0ad6r9wll3y50n1hoxa7an2c4bc&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have a good reason to access the value that was passed in, including the quotation marks, you can use the APPSRV_UNSAFE function:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;SAS/IntrNet 9.4: Application Dispatcher &amp;gt; Development Tasks &amp;gt; Application Server Functions &amp;gt; APPSRV_UNSAFE Function&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://go.documentation.sas.com/doc/en/dispatch/9.4/n0gc4breypvrrzn1jfsuk607bcp2.htm" target="_blank"&gt;https://go.documentation.sas.com/doc/en/dispatch/9.4/n0gc4breypvrrzn1jfsuk607bcp2.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But it's called "unsafe" for a reason.&amp;nbsp; You can read a little more about the cautions of using it in the SAS Viya documentation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;SAS 9.4 and SAS Viya 3.5 Programming Documentation &amp;gt; DATA Step Programming &amp;gt; Functions and CALL Routines &amp;gt; Dictionary of Functions and CALL Routines &amp;gt; COMPSRV_OVAL Function&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/p0nj8y96j7l6cun1oholejcecm4x.htm" target="_blank"&gt;https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/p0nj8y96j7l6cun1oholejcecm4x.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="verdana,geneva"&gt;Vince DelGobbo&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="verdana,geneva"&gt;SAS R&amp;amp;D&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Apr 2021 19:17:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proper-encoding-of-Symbols-passed-to-SAS-over-the-Web/m-p/737090#M229751</guid>
      <dc:creator>Vince_SAS</dc:creator>
      <dc:date>2021-04-26T19:17:57Z</dc:date>
    </item>
  </channel>
</rss>

