Showing posts with label HTML. Show all posts
Showing posts with label HTML. Show all posts

Friday, November 7, 2014

Apex Component error: Element type "input" should be followed by either attribute specifications, ">" or "/>"

Not sure if you have faced this situation, but let's see what we're trying to accomplish.

Scenario Display 2 radio buttons, one unchecked and another one checked based on the value of a variable.

How was developed
For educational purposes I'll just show 1 radio button :)
Looks simple, however we got the weird error message listed as title of this post.

Solution
After thinking carefully and asking salesforce support, we end up with the same solution
In order to display 1 radio button only, we have to write code for 2 radio buttons!

I hope this saves you valuable time.

Thursday, August 8, 2013

Modify iframe contents with Javascript

Conventionally, you are not allowed to play around with the contents of an iframe of external url with javascript. But with the use of javascript injections, you can do it very easily.
For example, you want to modify the values of text fields in the web page open in an iframe, but the web page is from an external url. What you would have tried first would have been:

But this does not work when you open the web page in a browser. So what to do? Let’s explore the possibilities of doing this with JavaScript Injections.
We know that we have the full permissions to modify the url of an iframe. So what we do is,
And viola! The username is changed!

Applications:
Possible applications of such injections are:
  • Automatic form filling Modifying the contents of iframe with
  • Automatic login by using
  • Automatic posting/commenting on sites like facebook, wordpress blogs, etc.
  • Or you can go further and insert a full javascript file into the external web page with:


Examples: Anything else you can imagine of!


Friday, May 20, 2011

Cross-site Scripting (XSS)

Cross-Site Scripting attacks are a type of injection problem, in which malicious scripts are injected into the otherwise benign and trusted web sites. Cross-site scripting (XSS) attacks occur when an attacker uses a web application to send malicious code, generally in the form of a browser side script, to a different end user. Flaws that allow these attacks to succeed are quite widespread and occur anywhere a web application uses input from a user in the output it generates without validating or encoding it.

An attacker can use XSS to send a malicious script to an unsuspecting user. The end user’s browser has no way to know that the script should not be trusted, and will execute the script. Because it thinks the script came from a trusted source, the malicious script can access any cookies, session tokens, or other sensitive information retained by your browser and used with that site. These scripts can even rewrite the content of the HTML page.

The normal practice is to HTML-escape any user-controlled data during redisplaying in JSP, not during processing the submitted data in servlet nor during storing in DB. In JSP you can use the JSTL (to install it, just drop jstl-1.2.jar in /WEB-INF/lib) <c:out> tag or fn:escapeXml function for this. E.g.

OR
This is the classic example: Look carefully to the param authtype, did you see the alert(1)??? If you don't write safe code, you might get an infinite loop in your screen :)

For more details please go to: https://www.owasp.org/index.php/Cross-site_Scripting_(XSS)