Allowing only specific characters in input

Hello,
My projects were auditted for security and it was found a
logged in user (only) could hack my programs because I was not
being careful to keep certain characters from being input, not just
pointy brackets and pound signs. I am now told to do no client side
checking.
I am thinking to define an allowable character list to
checking each input box character by character.
What is a faster and more efficient way than looping through
each input value's characters 1 by 1 and using find() and to check
if those characters are in the list of good characters?
Thanks.

If you feel you can make use of it, this might be a place to
start:
[^-_,\.@a-zA-Z0-9\s]
I use this reg exp as part of a parameter to an refindnocase
function inside a little udf I wrote to scrub user input. It's not
the entire expression, and I don't feel comfortable simply posting
the whole udf (not trying to be mysterious, but it's part of our
online security, after all, and is the property of my employer).
I think your approach of defining allowable characters,
instead of trying to define non-allowable ones, makes a great deal
of sense and is the approach that seems to be widely recommended.
That's what I use the expression above to do...if the character
ain't in that set, it gets deleted from the input string. It can
extract a price even from an innocent string, though...note that if
a user inputs "O'Brien" it'll come through as "OBrien" which for my
purposes is no more than a minor inconvenience. YMMV.
If that code makes no sense, spend an hour reading up on Reg
Expressions and you'll get it.
Bob's advice to become familiar with cfqueryparam is, of
course, excellent.

Similar Messages

  • Allow only English characters in ESS

    Hi All,
    We have a requirement to allow only english characters in ESS input , what should be the correct way to achieve this.
    Do we need to do this by implementing the Enhancement - HRPAD00INFTYUI  Method INPUT_CONVERSION.
    Thanks
    Amol

    Hi Amol
    How many languages you are currently Implementing??? If In case u have multiple country's available do u want country specific Input languages??? SAP delivers English in std's & it allows other languages which you have Installed in the system to store the data. As mentioned earlier you can place a Validation under INPUT_CONVERSION method to restrict accordingly.
    Try this & let us know the possible outcomes. It would be more appreciable if you can paste some screen shots.
    Cheers
    Pradyp

  • How to allow only specific letters, numbers and symbols in input string

    Hi all
    i'm new to java and trying to program a polynom calculator.
    so, you can enter a polynom string like for example "2.1x^3 + 3x^2 - 1". this all works fine.
    but i only need numbers, some special symbols and only the letter x which will be the variable you can enter here, otherwise a message should be displayed that i entered an invalid character or symbol. and is it also possible to check that there is a space before and after a + or - sing?
    the input string i'm reading it in with: String inputString = TastaturRead.readString();
    anyone out there who can help me?
    many thanks in advance.

    Please don't cross-post.
    Again, this looks backwards here. You seem to be using the string you want to split as the regex string, but again, I'm no expert here.
    import java.util.regex.*;
    public class Splitter {
        public static void main(String[] args) throws Exception {
            // Create a pattern to match breaks
            String pattern = "[+|-]+";
            Pattern p = Pattern.compile(pattern);
            // Split input with the pattern
            String input = "-5x^3+8x^2 - 2";
            //This smells wrong to me, backwards
            String[] result = p.split(input);
            for (int i=0; i<result.length; i++)
                System.out.println(result);
    //This looks better to me.
    result = input.split(pattern);
    for (int i = 0; i < result.length; i++)
    System.out.println(result[i]);

  • I want to allow only specific url using class-map

    i have two  dir on server like abc and  xyz  on the web server , but i have blocked the url using class-map like *xyz*
    is there any way to allow specific url  like in dir /abc/login.html and block all the files from /abc dir

    Thanks.  Actually, I posted my query because I haven't been able to make Parental Controls in OS X do what I want. I've been trying that tool for a while.  It seems that there are sort of three options:
    1. Allow everything with no exceptions
    2. Block sites that fail an automated filter for "adult" content, and then add back allowable sites.
    3. Block everything, and then add a white list of allowed sites
    In my case, option 2 doesn't work, because frankly, I don't care if my kids choose to look at content that somebody has evaluated as "adult."  Generally, the web log says that they don't, and if that does become an issue, then I will deal with it when it arises.  
    What I want to be able to do is the direct opposite of option 3 listed above:  Allow everything except an admin-specified black list defined per user, and be able to modify that list from time to time when I have a specific issue with a specific user. 
    I just want to be able - from time to time, like when I know they are behind on school work - to be able block a short list of "innocuous" persistent time-sucking sites as Youtube, Facebook, Twitter etc., even though there is not necessarily any objection content per se on the sites I want to block for that specific user (the "user-specific, admin-defined blacklist").   It is the lost (mis-allocated) time, not the risk of loose morals that concerns me.
    Network-level solutions exist, but these do not allow me to discriminate among user accounts as far as I can tell.  If anybody knows of a good solution that works in OS X across various platforms - freeware or commercial - I will appreciate a lead.   Or, if there is a hack that will allow me to accomplish this in Parental Controls, I would appreciate a pointer in that direction, as well.

  • Allow only specific domains to use open relay

    I have a client that I have to send emails on behalf of with a reply address for the client. If I have * as an accepted (open relay) I can successfully send emails with the from and replyto address required for my client. The problem with this is being
    an open relay I now have spam emails being sent through my exchange server. Is there a way I can stop external addresses accesing the open relay? Or enable an exchange account to send as a non domain email address?

    Hi Rich,
    I am running exchange 2010 Version: 14.01.0438.000
    I am sending the emails from MSAccess using VBA (see script below)
    With Flds
                .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
                .Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "Domain.A Username"
                .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "********"
                .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
                .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "192.168.1.7"
                .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
                .Item("http://schemas.microsoft.com/cdo/configuration/senduserreplyemailaddress") = "[email protected]"
                .Update
            End With
    strHTML = "HTML for email"
    With iMsg
            Set .Configuration = iConf
            .to = Screen.ActiveForm.[Email]
            .CC = ""
            .BCC = "[email protected];[email protected]"
            .ReplyTo = "[email protected]"
            .From = """Client Name"" <[email protected]>"
            .Subject = "Subject"
            .HTMLBody = strHTML
            .AddAttachment ("s:\emailatt\file.pdf")
            .Send
        End With
    (Domain.A = local domain)
    (Domain.B = clients domain)
    The sending machine is on our LAN and a receive connector has been setup to accept emails from the IP Range that are using this script. Authentication is set to Basic and Exchange Server Authentication and Permission groups is set to Exchange users. The
    [email protected] email address has also been added to the Domain.A User Account email addresses.
    If I do not permit an open relay within the accepted domains list I get the following error
    The message could not be sent to the SMTP server. The transport error code was 0x800ccc69. The server response was 550 5.7.1 Client does not have permission to send as this sender.
    If I add Domain.B as an accepted domain this works however a copy of the email is no longer sent to my client and is treated like an email on our domain. 
    Thanks in advance for any help.
    Ian

  • SharePoint - MS Word Document Only specific pattern allowed. Only data in the following pattern is allowed: ',*\S.*'

    We have a SharePoint 2007 document library setup with a custom template using MS Word. This template is a doc and/or a docx (we have used both and both have the pattern error). We are using the Document Information Panel in the document
    when opening to be filled in. One of the fields - Test - is a multiple lines of text
    field. When we use the Enter key a red dotted line appears. The message for the error appears below:
    Only specific pattern allowed. Only data in the following pattern is allowed: ',*\S.*'
    Does anyone know why this is? We need the ability to use the
    Enter key. We have MS Word at 14.0.4 and it does not have an issue with using the
    Enter key. Any later version of MS Word this issue occurs.
    SharePoint Configuration database version: 12.0.0.6608
    MS Office 2010 14.0.6029.1000
    Chris

    Hi,
    Did you installed some updates recently? Many users encounter this issue after installing KB2817537 or some updates released in Sept.
    This issue occurs because the regular expression used to validate the property doesn't allow for line breaks.
    Fortunately, DPKs attached to this bug have been successfully applied by the build lab.
    We are working on this issue and it will be fixed in future update.
    To work around this issue, please temporarily uninstall the
    KB2817537. If that wouldn’t work, please also uninstall
    KB2760758, KB276041 & KB2760411 and then test the issue again.
    Thanks,
    Steve Fan
    TechNet Community Support
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • Infopath throws error "only specific pattern allowed" when use regular expression for validation in schema

    This is MS info path question, I could not find specific forum for Info-Path So asking my question here
    I am creating Info-Path form from schema. In the schema, the filename has restriction that it can only have extension .pdf or .PDF. But while filling out the form even if I type filename with extension ".pdf", I still see error "only
    specific pattern allowed".
    Below is my schema I used to create form
    <?xml version="1.0" encoding="utf-8" ?>
    <xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="Document">
    <xs:complexType>
    <xs:sequence>
    <xs:element name="FileName" type="FileNameType"/>
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    <xs:simpleType name ="FileNameType">
    <xs:restriction base="xs:string">
    <xs:pattern value="^.*\.(pdf|PDF)$"/>
    <xs:minLength value="1" />
    <xs:maxLength value="128" />
    </xs:restriction>
    </xs:simpleType>
    </xs:schema>

    Hi
    This is the forum to discuss questions about Microsoft Office development. For your question, I recommend you post the question to the Answers forum for Infopath
    Microsoft Community for​ InfoPath​
    By the way, you can get support from here.  Support for Microsoft InfoPath
    Thank you for your understanding.
    Best Regards
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Allow specific characters - Regular Expression

    Hello everyone
    I am new to regular expression and I have a very simple question. I use the "read from text file" function to load a Tab delimited file with 3 columns into my VI. Next, the string is converted in array and I use the values.
    Nevertheless, I want to develop a "filter" allowing only digits (0-9), colon, comma and point into strings.
    Using the "match regular expression" function, I was trying a regular expression like that:
    [^0-9]|[^\].[|^:]|[^,]
    But it is not working.
    Could someone help me with this issue?
    Thanks
    Dan07
    Solved!
    Go to Solution.

    Hello
    Actually I don't need to modify the string that has "invalid" characters, I just need to identify them instead. Find below a VI testing both methods: Match Regular Expression and Search and Replace String.
    Using Match Regular Expression method, I got correct results since all the "valid" values must be identified as "-1" and all the "invalid" values must be identified as positive numbers (offset).
    Nevertheless, using Search and Replace String method I got wrong results, since all the strings were classified as "valid" (-1), but "bg" and "03/12/2010" are not "valid".
    I will go ahead with Match Regular Expression method because it is working great, but I was just wondering how to fix Search and Replace String method to achieve equivalent results.
    Thanks
    Dan07
    Attachments:
    Regular Expression_example.vi ‏18 KB

  • Allow only SI units for specific materials

    Dear all,
    I need to do a change in order to allow only SI units for some material types.
    Do you know a customizing which already does it (better if it can be specific for some material types).
    Or should I develop an user exit (which table should I check to know if it's a SI unit) ?
    Thanks in advance for your answers.

    Thanks Ajit but my users wants to specify only some material types. I think I have to do a user exit and create a specific customizing table with all material types

  • Issue with language specific characters combined with AD-Logon to BO platform and client tools

    We are using SSO via Win AD to logon to BO-Launchpad. Generally this is working which means for Launch Pad no manual log on is needed. But  this is not working for users which have language specific letters in their AD name (e.g. öäüéèê...).
    What we have tried up to now:
    If the AD-User name is Test-BÖ the log on is working with the user name Test-BO with logon type AD
    If the logon Type "SAP" is used than it is possible to use the name Test-BÖ as the username
    Generally it is no problem in AD to use language specific letters (which means it is possible to e.g. log on to Windows with the user Test-BÖ)
    It is possible to read out the AD attributes from BO side and add them to the user. Which means in the user attributes the AD name Test-BÖ is shown via automatic import from AD. So it's not the problem that the character does not reach BO.
    I have opened a ticket concerning that. SAP 1th level support is telling me that this is not a BO problem. They say it is a problem of Tomcat. I don't believe that because the log on with authentification type SAP is working.
    I have set up the same combination (AD User Test-BÖ with SAP User Test-BÖ) as a single sign on authentification in SAP BW and there it is working without problems.
    Which leads me to the conlusion: It is not a problem of AD. It is something which is connected to the BO platform but only combined with logon type AD because SAP Logon is working with language specific characters.

    I have found this article with BO support:
    You cannot add a user name or an object name that only differs by a character with a diacritic mark
    Basically this means AD stores the country specific letters as a base letter internally. Which means that if you have created a user with a country specific letter in the name you can also logon with the Base letter to Windows.
    SAP-GUI and Windows are maybe replacing the country specific letters by the base letter. Due to that SSO is working. BO seems not to be able to do that. Up to now the supporter from BO is telling me that this is not a BO problem.
    Seems to be magic that the colleagues of SAP-GUI are able to to it.

  • How can I see shared pc with firewall set to allow only essential services?

    How can I see shared pc with firewall set to allow only essential services?
    So far if I set it as above then shared does not show up? I have to set the firewall to set access to specific applications and services to get access to my windows based hard drive.
    Cheers
    Mike R

    Ok I solved it myself. Not an ideal solution as I have to connect it manually each time but it will do... Unless anyone has a way to have it auto connect when I start the mac.
    Cheers
    Mike R

  • Transfer on last day allowed only in closed fiscal year

    Hi Guru,
    Client kept asset transfer date as 31/10/2010 first, uploaded some asset on this date, due to some reason asset uploading was not completed for all the asset. so all the asset value which was uploaded on 31/10/2010 was done as zero.
    Client took decision to upload all the asset on last day of FY 10-11 i.e 31-03-2011. transfer date was changed as 31-03.2011 and moved up to quality, unfortunatly rquest was not moved to PRD and while uploading to PRD again 25 asset got uploade  by transfer date as 31/10/2010, when realized transport req of change transfer date is moved to PRD and abt 50000 asset of total 70000 asset got uploaded.F.Y 2010 was closed while uploading this assets
    Year 2010 was again open for posting of cj88 transaction.
    When we are uploading balance  assets in the system  getting error message Transfer on last day allowed only in closed fiscal year
    When tried to close FY 2010, system is giving message ' Depreciation not posted completly' for 25 assets.
    i tried to do value as zero for these asset through as92 but system agiain giving message Transfer on last day allowed only in closed fiscal year
    so situation is we are not able to close FY 2010 and thus assets are not getting uploaded. if we run depreciation for said 25 assets for year 2010 it is not proper because actual  transfer date is 31.03.2011
    Please Help
    Regards,
    Shekhar

    hi,
    go to customizing and under asset data transfer - parameters for data transfer - date specifications - specify transfer date/last closed FY--- you need to place the last day of the period where you have last run depreciation for the legacy system and make sure that I am assuming at this stage will be the previous period or this period.
    rgds,
    jay

  • Creating new String using only specific set of chars from another String

    I've performance troubles doing this task:
    I have a very long String A (up to 1 million character length)
    This String contains different characters.
    I need to create a String B containing only specific characthers (with a defined character code)
    An example:
    String A: [80]='P' [65]='A' [71]='G' [69]='E'For example I want to extract only character 65 and 71
    String B: [65]='A' [71]='G'I already did the code to do this, (it's quite simple) but I think I have some very big performance issues, and I suppose I can do this task much more quickly!!
    String out = "";
              for (counter = 0; counter < text.length(); counter++) {
                   char currentchar = text.charAt(counter);
                   int currentvalue = (new Integer(currentchar)).intValue();
                   switch (currentvalue) {
                   case 65:
                        char[] newstring = new char[1];
                        newstring[0] = currentchar;
                        out += new String(newstring);
                        break;
                   case 71: //
                        break;
                   // other cases
                   default:
                        // nothing to do...
              }Can you suggest me something to improve the performances?
    Thank you!

    If you've got a number of characters in your acceptance set I'd use indexOf, and I'd probably use StringCharacterIterator. Mind you, with a million characters I'd probably not load them all at once anyway, but process them as streams.
    StringBuffer out = new StringBuffer(s.length() / 5); // allocate plenty
    StringCharacterIterator it = new StringCharacterIterator(s);
    for(char c = it.first(); c != CharacterIterator.DONE; c = it.next())
      if("AG".indexOf(c) >= 0)
          out.append(c);
    return c.toString();

  • Copy paste text from pdf exported from Microsoft.Reporting.WinForms.ReportViewer control with Czech specific characters produced box charactex or ?.

    Used Visual studio 2012. In our project there is used the Microsoft.Reporting.WinForms.ReportViewer control. In the report handled by the control are TextBoxs with a text with Czech specific characters e.g. (ř, ě, ...) . When exporting the report to pdf,
    characters are displayed correctly. However when the text with czech characters in the pdf if copied and  placed into the seach box in the pdf document only box characters are displayed. The TextBox in the report use the default font Arial. When the report
    is exported to Word, and then the Word document is saved as a pdf document, its ok. Coping a text with Czech charactes in the result pdf document and pasting into the search box displays again Czech characters not box characters.
    Also when in the report handled by the ReportViewer control are several Tex Boxes and some of the boxes contains Czech characters and some not, after exporting to a pdf document there is problem with text selection. When in the pdf document I'm trying to
    select several paragraphs, some with Czech characters and some without them, selection behaves strangely and jumps from one paragraph to another unexpectedly.

    Hi,
    did you managed to avoid those squares?
    BTW: if any such char. is encountered in a line, the entire line of text is grabbled.
    I've tried even the ReportViewer from MSSQL 2014, but got the same problem. When I've tried IL Spy, I found a code, where it is checked if the PDFFont is composite - depending on that a glyph is created. But that still only a guess.
    I've tried Telerik's reporting, they have similar problem (beside other), but not with the special characters. They produced scuares for some sequences like: ft, fi, tí.
    Please give any info you got.
    Until then my advices for you:
    a) try JasperReports (seems theyre most advanced, although it is java)
    b) Developer express has quiet quality reports - and it seems they got those special chars. right :D
    c) I created a ticket and waiting for Telerik's response (but if I had to choose reporting, I vould stick with a) or b)

  • Is it possible to patch Global Zone and only specific Non-Global Zones?

    Hi Champs,
    Is it possible to patch Global Zone and only specific Non-Global Zones? Idea is to patch DEV-zones only on the system & test applications and then patch only the STG-zones on same server!
    Not sure if it is possible but just throwing a question...
    Cheers,
    Nitin

    M10vir wrote:
    Yes, if you have branded (non-sparse) zone!Branded zones and sparse zones don't have the relation that you imply. In Solaris 10, native zones can be sparse or whole-root (non-sparse, as you say). Zones that are not native zones are branded zones. Branded zones on Solaris 10 include Solaris Legacy Containers, previously known as Solaris 8 Containers and Solaris 9 Containers. That add-on product allows you to run Solaris 8 and Solaris 9 application environments under a thin layer of virtualization provided by the brands framework. solaris8 and solaris9 branded zones can be patched independently of each other and of the global zone.
    Solaris 11 has no "native zones" - all zones use the brands framework. The "solaris" brand does no emulation and in that respect is very similar to native zones on Solaris 10. Solaris 11 also provides Solaris 10 Zones via the solaris10 brand. This allows zones or the global zone from a Solaris 10 system to be transferred to a Solaris 11 system and run as solaris10 zones. When running on Solaris 11, solaris10 zones can each be patched independently from each other and the Solaris 11 global zone. Technically, Solaris 11 doesn't have patches - it just has newer versions of packages to which the system is updated.

Maybe you are looking for