I just tried PyIB, and I saw it was pretty fast but still lacking features. I saw the code and it looks decent except for the lack of commenting.
I'd just like to know what are your experiences with it (and if you have any hopes up for it).
I'm especially interested in the security.
Thanks.
All right, I'm up for a bit of a code review... let's see what a casual look through the source code reveals.
database.py# Although SQLAlchemy is optional, it is highly recommendedThis suggests that all the SQL code has to be duplicated in order to handle both cases, and the Settings._.USING_SQLALCHEMY is a gigantic red-flag, because that suggests that any duplication probably isn't being done with a subclass, it's a bunch of hacked-together conditionals. But maybe this is a low level thing that's patched up in some other file. Moving on.
parentid = FetchOne("SELECT `parentid` FROM `posts` WHERE `id` = '%s' LIMIT 1" % postid)["parentid"]Jesus H. Christ! Is that raw SQL that doesn't escape its parameter? What the hell is this, PHPython? That function had better be receiving a properly sanitized SQL string, that's for fucking sure... ok, it looks like its parameter is coming from a regex match against [0-9]+, so it "should" be fine, but the question of what that function receives simply shouldn't ever need to be asked. It's playing with fire.
So it looks like SQLAlchemy isn't actually used anywhere, despite that setting. In all, there don't appear to be any "real" exploits, at least not ones that were immediately apparent. Just be careful with the admin password, although I imagine losing it wouldn't be too much of a loss anyway - what would people do, delete posts? Big deal there.
The most significant issue I see is that it's written by someone who obviously is a PHP programmer. It's a decent start but it needs cleaning up. I think switching to SQLAlchemy (and not in conjunction with the mess that it has now) and getting rid of the FetchOne() junk would be a very good first step toward making it a nice clean codebase. Splitting everything into proper MVC instead of generating HTML inside the post function and other haphazard and sloppy coding would also be highly beneficial. A lot of the points I listed are little stylistic issues; having worked with Trevorchan's source code, this is an enormous improvement. I don't think I could find ten consecutive lines in Trevorchan that didn't have some major problem.
>>2
>>3
Thank you so much and sorry for taking your time, your comments are extremely helpful. The raw SQL issue was highly noticeable and really ugly, and I also noticed the admin password cookie yesterday; you also helped me to find a lot of issues I didn't notice at first sight.
I'll take your advice and try to clean up what I can. Thank you.
>>> Figures a PHP programmer would pick such an abomination.
Wow, you are such a dick. You go WAY beyond construction criticism.