Obfuscate Form Fields Name And Id.
#1
Posted 29 January 2013 - 12:42 AM
The current way of setting the form fields name and id make it too easy for custom bots.
I suggest some uniq id.
The form could store this uniq ids on the user session.
#2
Posted 29 January 2013 - 04:35 AM
TIP: use captcha
#3
Posted 29 January 2013 - 09:51 AM
#4
Posted 30 January 2013 - 03:40 AM
#5
Posted 30 January 2013 - 05:40 PM
So whats the best way, no captcha please, to secure a public form?
#6
Posted 31 January 2013 - 10:39 AM
#8
Posted 06 February 2013 - 02:55 AM
I'm not really for obfuscating. But in some scenarios i find it better to have form field names like "query" instead of "SearchForm[query]". Consider such a search form which you want to submit via GET. So you want your search results to be shown under a nicer URL like: ...?query=myQueryString. As a workaround i now render custom form fields. But then i can't use the gimmicks of CActiveForm.
I'm not asking for changing the default which is fine for most cases. I just want more freedom for the experienced developer who knows what he is doing.
So the question is: Will there be a way in 2.0 to modify the way, Yii generates form input names?
#10
Posted 06 February 2013 - 03:46 AM
<?php $form = $this->beginWidget('CActiveForm', ...) ?>
<?php echo $form->textField($model, 'query'); ?>
Gives me a input field with name "query" instead of "SearchForm[query]"?
#12
Posted 06 February 2013 - 09:15 AM
This way the OP could also create obfuscated form inputs if he wants to. This is really an advanced feature, though. The developer must understand the consequences (e.g. problems if he submits several models from 1 form).
#13
Posted 06 February 2013 - 09:34 AM
#14
Posted 06 February 2013 - 09:39 AM
#15
Posted 06 February 2013 - 10:16 AM
Still i disagree with the final conclusion. In my opinion we should not worship MVC as the golden calf if there's good reason to lessen the strict paradigm slightly. I'd say that this is such a case: the framework forces me to do things the Yii way. If i don't (=use my custom form inputs) i can't use many features anymore (e.g. clientside and AJAX based validation). If this can be solved with a minor break in MVC i can't see, why we should not. This is just an unneccesary restriction.
#16
Posted 06 February 2013 - 01:25 PM
I think, if I understand you correctly, you'd need:
- A class for the HTML elements that create attributeName names, instead of Model[attributename] names
- A class/method then you can use to do something like $model->attributes = MikeCAF::transformGetsOfModel('modelName');
..just brainstorming
#17
Posted 06 February 2013 - 01:29 PM
#18
Posted 07 February 2013 - 08:40 AM
#19
Posted 07 February 2013 - 09:05 AM
#20
Posted 07 February 2013 - 09:45 AM

Help

This topic is locked













