Better HN
topnewbestaskshowjobs
Log inSign up

DCoder

1,260 karma · joined Nov 2, 2009 (17y ago) · 479 submissions

not here anymore
Submissions

comment 10y ago · link · parent

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

comment 10y ago · link · parent

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

comment 10y ago · link · parent

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.

comment 10y ago · link · parent

> 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

comment 10y ago · link · parent

Apparently, the fact that they work until 4am?

comment 10y ago · link · parent

https://en.wikipedia.org/wiki/Strip_(Unix)

comment 10y ago · link · parent

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.)

comment 10y ago · link · parent

See also: https://en.wikipedia.org/wiki/Hubert_Blaine_Wolfeschlegelste....

comment 10y ago · link · parent

> PING krebsonsecurity.com (127.0.0.1): 56 data bytes

Reminds me of: https://twitter.com/troyhunt/status/716408697266679808

comment 10y ago · link · parent

Yeah, instead of this problem Ember will give you other problems:

https://www.google.com/search?q=site:https%3A%2F%2Fwhat.thed...

comment 10y ago · link · parent

Magpie-Driven Development at its finest!

comment 10y ago · link · parent

The same could be said about the "JavaScript vs TypeScript" argument. I can see that argument, but in my opinion, the safety nets provided by TypeScript and TSX are well worth the initial learning curve.

comment 10y ago · link · parent

You don't choose between those two routers, they are not replacements for each other.

At the risk of stating the obvious, the Angular router handles routing for the Angular frontend, the Go router handles routing for the Go backend (the initial page load, the AJAX calls made from Angular to get data...).

comment 10y ago · link · parent

We had to integrate a webshop with the customer's existing SAP installation. The consultants in charge of SAP gave us a SOAP webservice that, among other things, had a command called ExecuteSQL - we could pass a raw SQL string and the SAP server would execute it. They "protected" it by blacklisting common naughty words like DROP, ALTER, etc., as well as semicolons and CAST (I don't really know why). When we needed to actually include a semicolon in the query as part of a string literal, I had to work around their filter by replacing the string literal with CONVERT(VARCHAR(MAX), 0x.......) .

comment 10y ago · link · parent

DK might also be Dunning-Kruger.

comment 10y ago · link · parent

Counter-point: you can tell if the JSON you received is intact or was cut off, because it won't parse properly without the closing braces. You don't have that safety net with YAML or TOML.

comment 10y ago · link · parent

Regarding timestamps, the at-sign is already used by GNU tools, as a prefix to indicate actual UNIX timestamps (seconds since epoch): https://www.gnu.org/software/coreutils/manual/html_node/Seco...

comment 10y ago · link · parent

> If you have to ask...

FWIW, the Development Edition alone, without the enterprise additions, costs 3k$.

comment 10y ago · link · parent

npm v3 tries to dedupe packages during installation to reduce this problem. However, it still does not install packages in a deterministic way...

[0]: https://docs.npmjs.com/how-npm-works/npm3-dupe

[1]: https://docs.npmjs.com/how-npm-works/npm3-nondet

comment 10y ago · link · parent

> When running a 32-bit build of MongoDB, the total storage size for the server, including data and indexes, is 2 gigabytes. For this reason, do not deploy MongoDB to production on 32-bit machines.

From https://docs.mongodb.com/manual/installation/#faq-32-bit-lim...

There was also the issue where errors were either logged or not, based on the result of Math.random(): http://stackoverflow.com/q/16833100/1233508

comment 10y ago · link · parent

> The use case for Magento is (apparently deliberately) confused. It's an unholy melange of a CMS and a shopping basket. There is no good out-of-the-box experience; in practice it's a job creation scheme for consultants.

The CMS capabilities of Magento are quite limited, as the Community Edition does not even include a "menu" module or a hierarchy for your static pages. My opinion is similar to yours, it is a powerful shopping basket that will require lots of custom development or third-party module juggling to get a decent result.

I have been working with Magento 1.x CE for a few years now, and I wanted to add a few more factoids from a developer perspective:

* The database API has an "you want it, you got it!" mentality - if you tell it to add a unique index and MySQL refuses to because existing data is not unique, the API will parse the MySQL error message to identify the duplicated fields/values and delete them silently. You will get your index, but you might no longer have all your data. [0]

* The model classes store nearly all the in-memory data in an untyped dictionary. You can call $model->setFoobar('12345') and later $model->getFoobar() to get it back - all unknown method calls get forwarded to a "catch-all" method which treats the method name as a key into this dictionary, and gets/sets a value of that key [1]. Most of the time, these calls are unannotated, so IDEs can't make any sense of them (see the "Undefined method" part in [2]). This unknown method forwarding is also a performance issue, so they make optimizations like [3] by inlining pieces of the catch-all handler code for commonly-used data.

* The JavaScript is based on Prototype.js, not jQuery, so half the modules and themes bundle their own copies and drop them in different locations. Some of them provide a configuration setting so you can disable their jQuery and use your own, some don't.

* It includes a "Developer Mode" where php notices and warnings are turned into exceptions like in sane languages. But plenty of modules and themes have never been tested with this setting on and they cause faults on every page load - either you have to disable the Developer Mode, or fix this third-party code.

[0]: https://github.com/OpenMage/magento-mirror/blob/magento-1.9/...

[1]: https://github.com/OpenMage/magento-mirror/blob/magento-1.9/...

[2]: https://imgur.com/RMxWEgR

[3]: https://github.com/OpenMage/magento-mirror/blob/magento-1.9/...

> I don't have a good answer on the shopping basket, but Magento was bad enough at that too that we went back to our in-house homerolled system.

Our clients were originally in love with Magento because "we can just add all these existing modules and get all sorts of awesome functionality without having to pay you for it!" We warned them that that was a pipe dream, but they didn't listen. Now they have several thousands of hours worth of custom development on top of Magento 1.x (95% of it written solely by me, no bus factor problems with that) and it's not even finished yet. Last I checked, the end-of-life for M1.x is planned in December 2018, and the client has no plan for what to do then.

> I understand some work has gone into Magento 2.0 to make it less mind-bogglingly horrible.

When I looked at Magento2, they had an amazing solution to PHP's lack of generics: they bundle multiple "template" classes and during system installation, you're supposed to run a CLI script that goes through those classes with a list of wanted concrete classes and generates specialized class files for all of them. If you fail to run this script, don't worry - their custom autoloader will detect this and generate those classes at runtime, when they are needed.

comment 10y ago · link · parent

If you click on the image to see the interactive graph, under "Advanced settings" there's a switch "Date range variable: filter submissions by build date range or submission date range", which is set to "build date range". So those "3 dates" correspond to three different build dates.

comment 10y ago · link · parent

See also: https://twitter.com/boonerang/status/751849519407595520

comment 10y ago · link · parent

From SecurityWeek's writeup on the same topic [1]:

No interaction is required to trigger the exploit. In fact, when Ormandy sent his PoC to Symantec, the security firm’s mail server crashed after its product unpacked the file.

[1]: http://www.securityweek.com/critical-vulnerability-symantec-...

comment 10y ago · link · parent

That's Slack, not IRC. Slack uses the term "Direct Messages" for private conversations.

comment 10y ago · link · parent

To do things like that in a dynamic language, you need to either infer types somehow, or rely on metadata like JSDoc, beyond the language itself, and that sucks – if another developer works on the project with a dumber IDE, their code will probably lack such metadata or it will not be entirely correct.

I have been using IntelliJ daily for the last five years for PHP, JS and TS development. For PHP, I write typehints and PHPDoc wherever possible to help the IDE make sense of things. For JS, I tried doing the same with jsdoc but it didn't work out, and I have decided to avoid any automated refactoring or even autocomplete, it's far too fragile. For TS, using the types in my code makes the IDE smart and reliable, although IntelliJ's support for type inference in TS is still far behind VSCode.

Special mention here goes to Magento developers, whose PHPDoc, 98% of the time, is either lacking or outright incorrect (referencing classes that don't exist – incredibly frustrating).

comment 10y ago · link · parent

Too bad Magento devs missed that newsflash. Nowadays it still bundles Prototype.js, and every theme and 50% third-party modules you install carry their own copies of jQuery, all at different versions, placed in random locations, and embedded into the page differently.

comment 10y ago · link · parent

In addition to handling well-known browser inconsistencies, it also covers obscure edge cases such as these: https://docs.google.com/document/d/1LPaPA30bLUB_publLIMF0Rlh...

comment 10y ago · link · parent

It does not, but the page author can use javascript to generate a confirmation dialog when you're leaving the page: https://developer.mozilla.org/en-US/docs/Web/API/WindowEvent...
1
789
16