security - Is this jquery code secure? -


is following code secure?

$iframe = $('<iframe id="iframe" src="' + $(this).attr('rel') + '" name="iframe">'); $area = $("#ajax-area"); $area.empty().append($iframe); 

where:

  1. $(this) link clicked.
  2. attr('rel') holds src iframe , rel created php (no user input here).
  3. and $iframe holds form upload.

my concern is, since in case iframe's src variable fear malicious user somehow manages edit 'rel' attribute , open iframe or wants. possible?

edit

thanks valuable answers.

php uses following populate rel:

app::basepath . '/some/path/to/my/folder'; 

where basepath constant developer chooses.

i'll redesign jquery in more proper way guys suggested.

theoretically, if rel attribute based on server constant, there should no additional security issues other ones can't control, such mitm.

however, should on safe side these things; , jquery provides safety allowing attributes tag passed second argument constructor:

$iframe = $('<iframe />', {     id: "iframe",     src=: $(this).attr('rel'),     name: "iframe" }); 

Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -