HNHacker News
TopNewBestAskShowJobs

DCoder

1,260 karma · joined November 2, 2009

not here anymore
submissionscomments
DCoder··on Lego Is the Perfect Toy
Out of curiosity, what makes 42030 better than MB Arocs (42043) or Mobile Crane II (42009)? I was just looking for a gift for myself a week ago, and 42043 looks great.
DCoder··on Show HN: QueryStorm – A query IDE inside Excel
Excel has Get & Transform, formerly known as Power Query, which can do similar things... if a custom query language [1] instead of SQL doesn't scare you away. I have used it a few times, it can definitely be useful.

[1]: https://msdn.microsoft.com/en-us/library/mt270258.aspx

DCoder··on SQL injections vulnerabilities in Stack Overflow PHP questions
Perl has such a feature, it's called "taint mode" [1], it marks all variables receiving external data as "tainted" and disallows their usage in sensitive contexts.

PHP has an inactive proposal to implement it as well [2].

[1] http://perldoc.perl.org/perlsec.html#Taint-mode

[2] https://wiki.php.net/rfc/taint

DCoder··on SQL injections vulnerabilities in Stack Overflow PHP questions
The bigger problem is that Google ranks that website higher than the modern stuff. You can make much better tutorials and it won't help as long as that legacy cruft is sitting at the top of every newbie's search results.
DCoder··on SQL injections vulnerabilities in Stack Overflow PHP questions
It gets worse: https://3v4l.org/Slvpp

Note that PHP also has a JavaScript-style triple-equals comparison, which does not attempt type conversion and does not exhibit this bizarre behaviour.

DCoder··on SQL injections vulnerabilities in Stack Overflow PHP questions
How so?
DCoder··on SQL injections vulnerabilities in Stack Overflow PHP questions
> You can also escape the scans by using variable names that start with an underscore

So people who use

    "WHERE id=" . $_GET['id']
will not get detected?
DCoder··on SQL injections vulnerabilities in Stack Overflow PHP questions
Variable table names can also be useful if you have poor man's partitioning – separate tables with historical data , like "logs_201610", "logs_201611", "logs_201612", etc.

Another scenario I just thought of: your schema is more or less dynamic. For example, Drupal lets developers/site administrators create entities with custom fields, each field gets its own DB table, and to load an entity you need to

    SELECT * FROM node
    LEFT OUTER JOIN field_data_field_name_1 ON .. 
    LEFT OUTER JOIN field_data_field_name_2 ON ..
    ...
DCoder··on SQL injections vulnerabilities in Stack Overflow PHP questions
> it's not really representative of the sector of developers that make a living with PHP.

Anecdote: I was integrating a paid Magento extension (which charges about $1000 for a license) into an existing shop, and some poor code in their templates made me look deeper into their main code. Six hours later, I had:

* 4 different ways to read any file on the server that PHP can read,

* 5 different ways to upload any file to a certain directory on the server, including one that lets you overwrite the webserver's security configuration for that directory and then execute uploaded PHP code,

* a way to delete certain things the administrator has created in the backend,

* a way to overwrite other customers' uploaded files,

* a way to edit other customers' information, which lets you then XSS/XSRF those customers when they view that information.

I have reviewed other Magento extensions in the past, and I found many poor ones, but nothing as atrocious as this.

DCoder··on SQL injections vulnerabilities in Stack Overflow PHP questions
That's what happens when you use Regexes to find problems: https://github.com/laurent22/so-sql-injections/blob/7b9d99c0...
DCoder··on Amazon States Language – A JSON-based language to describe state machines
Yes, Ansible supports conditionals and loops in its playbooks. Ansible 2.0 also introduced blocks, which are effectively a try-catch-finally in disguise.
DCoder··on Chrome 55 uses 30% less memory than 54
https://v8project.blogspot.com/2016/12/v8-release-56.html says:

> V8 version 5.6, which will be in beta until it is released in coordination with Chrome 56 Stable in several weeks...

> Starting with 5.6, V8 can optimize the entirety of the JavaScript language.

DCoder··on 8M GitHub profiles were leaked from GeekedIn's MongoDB
> Can you remember all services you signed up for with your email? Cause I definitely didn't.

You might also want to check your browser settings to see which domains have saved cookies, saved passwords, or the "never save passwords on this domain" flag.

DCoder··on AdultFriendFinder was hacked
Browser language preferences, yes. Keyboard layout, no. For one thing, layout names vary between OSes, for another, custom keyboard layouts are a thing... However, you can try and read individual keypress events and see which printable characters are generated for which key codes.
DCoder··on Dear Google, Apple, Mozilla, and MS: Please End Auto-Playing Media in Browsers
We never lost control

You're face to face

With the man who sold the world

DCoder··on Why 30 is the decade friends disappear
You're not the only one who feels that way :)
DCoder··on Why 30 is the decade friends disappear
The email field in your profile is private. Add your email to the "About" field for others to see it.
DCoder··on Leonard Cohen Has Died
Amanda Palmer's rendition is amazing as well: https://www.periscope.tv/w/1DXxyoEbXBLGM (starting at 3:01:56).
DCoder··on The Most Expensive Anti-Pattern
Typically parameterized query APIs (such as PHP's PDO) only support dynamic parameters for elements that do not affect the query plan, that is, as replacements for literal strings or numbers. Dynamic identifiers, such as table/column names, sort direction, etc., are not allowed. This permits an additional benefit – the DB can compile a prepared statement once and reuse its compiled form for multiple executions.
DCoder··on “Sites like these give PHP a bad reputation”
In case of KeePass at least, you can skip the master password and use keyfiles or HOTP such as Yubikey instead. Or, better yet, you can combine the master password with one of those.
DCoder··on “Sites like these give PHP a bad reputation”
No problem :) I just edited the post to add some more security implications, because they deserve more attention.
DCoder··on “Sites like these give PHP a bad reputation”
Yep, I've seen such issues in multiple systems as well.
DCoder··on “Sites like these give PHP a bad reputation”
They reflect poorly on the Lastpass website , not necessarily on their crypto.

Judging from the URLs, it seems that each action is handled by a different standalone script. This is very common in legacy code bases, and it typically (not always) means that:

1) all those scripts need the same bootstrapping boilerplate copy-pasted into them, which is a maintenance nightmare. Even if you simplify it to one or two lines of boilerplate that includes a central boostrap file (or use some configuration magic to automatically run an additional script before the script you requested), it's still worse than having a single centralized entry point that handles routing, auth, and so on. There's always a chance that someone forgets or botches an auth check in one of these files and it goes unnoticed.

2) you will probably be able to make an HTTP request directly to some file that was not intended as an entry point (the author mentions header.php – this is a perfect example), and then who knows what happens, because you never planned for this and your bootstrap code doesn't run and possibly variables expected by that script are not defined, or errors thrown by the script are not handled by a pretty error handler... kinda like doing an assembler jmp into the middle of another function, after any sanity checks it might have had.

3) I have been working with PHP for 8 years now, and almost inevitably, where this pattern shows up, there's most likely outdated and insecure practices like SQL queries from string concatenation (leading to SQL injection) or unescaped HTML output (leading to XSS, XSRF, or other security problems). It's basically an "easy target" sign for hackers.

Front Controller pattern [1] is a recommended alternative.

[1] https://en.wikipedia.org/wiki/Front_controller

DCoder··on The Most Expensive Anti-Pattern
Where do you draw the line at "dynamically constructed strings"? Do I need to duplicate the whole query to another literal just to change the sort field?

See also: Perl has a "taint mode" [1] which marks all variables receiving external data as "tainted" and disallows their usage in sensitive contexts. PHP has an inactive proposal to implement it as well [2].

[1] http://perldoc.perl.org/perlsec.html#Taint-mode

[2] https://wiki.php.net/rfc/taint

DCoder··on The Most Expensive Anti-Pattern
Like it says earlier in the post, it could be enough to only serialize (stringify) the data structure at the very end of building it, once it's finalized. Once it's stringified, it must be treated as a isolated black box, which cannot be inspected, modified, or combined with other black boxes.

I tried to build something like that for rendering HTML, for the same reasons – security and proper structure. But, stupidly, I was working in PHP, and so its syntax was somewhat clunky. I still think it is a good idea, though.

DCoder··on DeepMind and Blizzard to release StarCraft II as an AI research environment
> First person shooters can have super accurate AIs that are really frustrating to play against.

The Worms series is also notorious for this. Their AI targeting seems to flip between "clueless" and "godlike", with very little middle ground. E.g. https://youtu.be/gqPITW04vRQ?t=1m20s

DCoder··on Step-by-step tutorial to build a modern JavaScript stack from scratch
Apparently, the fact that they work until 4am?
DCoder··on A very valuable vulnerability
https://en.wikipedia.org/wiki/Strip_(Unix)
DCoder··on The Sad State of HTML Email Input Fields and IDNs
1. type=number only accepts the period as a decimal separator, and there are lots of locales using comma for that purpose. Customers often ask us to support commas, which requires type=text and manual validation.

2. One customer requested the ability to enter decimals in a field, but to keep up/down spinner in steps of whole numbers. You can't do that, the step attribute makes any values other than (min + N * step) invalid. I can see some sense in that, but I think the step attribute should only affect the increments/decrements done by the spinner, not completely reject certain values. (Though you can use step=any to mark all values valid and step by 1.0, which is good enough for common cases.)

DCoder··on Quora has blocked me because it doesn't think Theodore Ts'o is my real name
See also: https://en.wikipedia.org/wiki/Hubert_Blaine_Wolfeschlegelste....
← PreviousPage 7 of 16Next →