Better HN
topnewbestaskshowjobs
Log inSign up

thinkharderdev

1,874 karma · joined Jun 12, 2019 (7y ago) · 701 submissions

https://www.thinkharder.dev

[ my public key: https://keybase.io/thinkharder; my proof: https://keybase.io/thinkharder/sigs/Ibpz0COsvz2qYl2K8YfzrhucHf2rcZIxityh5WvYC_k ]

Submissions

comment 4y ago · link · parent

That is exactly my point. The way you can eliminate potential injection attacks is by not having libraries which accepts String and treat it as a sanitized input. But once you do that then there is no real reason to be wary of format strings. You can use format strings to build strings, but anything that needs a string that is sanitized against some potential injection attack only accepts a type that represents that invariant.

comment 4y ago · link · parent

Shodan îs a search engine for internet-connected devices. There are a very surprising number of devices (security cameras, IoT thingamajigs, etc) connected directly to the internet.

comment 4y ago · link · parent

But there is nothing enforcing the use of the correct template policy. I can still use the wrong CONCAT to build a SQL query. It certainly makes sense to make string interpolation extensible but doesn't actually eliminate the potential for doing things in an insecure way.

comment 4y ago · link · parent

It seems perverse to make a ubiquitous operation (formatting a string) intentionally hard just because some people may use it for inappropriate purposes such as building SQL queries from untrusted input. Sure, we should have ergonomic easy of building prepared statements and such but that doesn't seem like something that belongs in the standard library. Or maybe it does. But either way there are many, many legitimate use cases for string formatting.

comment 4y ago · link · parent

I would assume so but it probably depends on the "level" of exposure and such.

comment 4y ago · link · parent

Not really, evasion is a continuum rather than a binary distinction. So Omicron seems like it evades immunity acquired from infection with previous variants or vaccines to a certain degree, but from what I have read with vaccine + booster you are still ~60-80% protected from symptomatic infection and almost entirely protected from severe outcomes.

comment 4y ago · link · parent

The booster dose increases antibody titers significantly above what they were after the second dose (or first in the case of J&J) so someone who is boosted should be more protected than someone who got their second dose at the same time. Additionally, through the process of affinity maturation, the antibodies you have after a booster will be more likely to recognize Omicron because your immune system has learned to recognize more features of the virus spike protein and is more robust to mutations.

comment 4y ago · link · parent

From what I understand it is about affinity maturation. Basically, when you get an initial vaccine (or infection) your immune system learns how to recognize the antigen (the virus spike protein) and produces a bunch of antibodies to recognize it. But your immune system also preserves the spike protein in antigen presenting cells so it can continue to produce antibodies to recognize more features of the spike protein. Over time, your immune system learns how to produce a broader range of antibodies that are (in aggregate) more likely to recognize partially mutated versions of the antigen. That's the affinity maturation part.

So when you get a booster (or a breakthrough infection) your immune system kicks into gear again but now it produces a broader range of antibodies. In addition the number of antibodies produced from the booster is quantitatively much larger than from the first vaccine. So with a booster you end up with more antibodies but also a larger variety of antibodies that can recognize different features of the spike protein (including features that are consistent between variants).

That's my understand at least but I am not an immunologist.

comment 5y ago · link · parent

I think you and the parent are saying basically the same thing. I've been working in Scala for the past 10ish years and we have definitely gone through the "hype cycle" of operator overloading. Early Scala libs went a little nuts with creating an incredible array of symbolic operators (most famously this atrocity http://www.flotsam.nl/dispatch-periodic-table.html). We collectively realized that this was overboard and now Scala libraries typically provide a more modest set of symbolic operators (and generally the symbolic operators are just aliases for named methods so you can decide which ones you want to use in any particular codebase).

I would also disagree with the characterization as shitty code. The operators are actually really nice if you manage to learn them all well. It can make the code both very concise and readable. But it optimized for people who know the libraries extremely well over people who don't, which usually is not a great tradeoff for widely used libraries.

comment 5y ago · link · parent

I wouldn't go so far as "no valid reason", but yeah, it is always fun to come on HN and see how everyone using k8s is just doing "resume-driven development" and mindless automatons manipulated by "marketing." I always find it amusing because a lot of these takes seem like thy are at least 5 years out of date. If you are on any one of the major cloud vendors, setting up a k8s cluster is almost trivial at this point. And that comes with a fully-managed control plane and a vibrant ecosystem of drop-in solutions for common deployment patterns.

Do you always need k8s? Of course not, but it really is getting to the point where all but the most trivial of deployments could benefit from running on k8s. Are there other ways to do it? Sure, but the complexity of using k8s has been sanded down through widespread adoption and really nice tooling.

comment 5y ago · link · parent

I've had Terraform break several times when my AWS STS token expired half way through a deployment. When that happens I ended up having to manually delete all the created resources because the Terraform state was corrupted to the point I couldn't reapply to create the remains resources but also couldn't delete the existing resource with Terraform.

That said, I agree in general that this wouldn't be the main reason to use the Cluster API over Terraform.

comment 5y ago · link · parent

Agreed, I think it's not so much that pure FP is too abstract and complicated. It can actually allow really clean, usable abstractions. It's just that many pure FP libraries for some reason try to explicitly model category theoretic abstractions so you end up needing a lot of theory to be able to get your bearings. ZIO is built on the same theoretical foundations but is designed so that you don't need the theory to be productive.

That's all just to say that the issue isn't FP in general, but the way FP has been implemented in beginner-unfriendly ways.

comment 5y ago · link · parent

If you are writing a complex algorithms then an imperative style is usually going to be clearer (and more performant), but when dealing with higher-level code that is just moving data around and doing some relatively straightforward mutations, then functional code can be much more straightforward and intelligible. When you introduce concurrency then that is where I think pure FP really shines. Writing concurrent code with a pure FP effect system like ZIO is so much nicer (and safer!) than writing concurrent code in Java (or any other language I've ever used).

comment 5y ago · link · parent

Yeah, "don't overdo X" is always true by definition. That is what "overdo" means. Likewise "don't be an X zealot" is always true by definition (based on how we use the term zealot in modern English).

That said, despite the clickbait title, I think these sorts of posts make a valid point because people often do in fact take heuristics like DRY to mean "never repeat any code under any circumstances and any code repetition is per se bad."

comment 5y ago · link · parent

That's a fair point. But I think that "long-running processes which can amortize the startup cost and JIT time" covers a very large swath of software development.

comment 5y ago · link · parent

With the modern JVM you actually have to work quite hard to write native code (Rust/C++/C) that outperforms an equivalent Java/Kotlin/Scala implementation. And it is quite easy to perform worse with a native implementation. Of course that is subject to various caveats:

1. Anything running on the JVM will need a 50-500ms of startup time.

2. The JVM implementation will not reach max performance until the runtime has optimized and JIT'd the relevant code paths.

3. There is memory overhead of the VM itself so your runtime will (all else equal) probably require more memory.

If you do need to use Graal to generate native images though it can actually be quite nice. You can run locally (or in benchmarking environments) on the VM and get all the tooling and metrics that come along with that, but build a native binary to actually deploy. I agree that it can be kind of a pain though.

comment 5y ago · link · parent

If you don't need the low-level control of Rust then I think Scala would check all of your boxes (aside from distributing dependencies as code instead of binaries). Specifically, an effect library like ZIO looks a lot like Rust without the complexity of managing lifetimes (because you have a GC).

comment 5y ago · link · parent

Wouldn't that rule also effectively ban HN and Reddit?

comment 5y ago · link · parent

The advantage is if you are explicitly modelling a value that could be empty. You can encode that into the type system by making git an Option<T> instead of just a T (that could be null). At it's most basic level it can just help reduce the possibility of NullPointerExceptions but the real benefit and reduction of boilerplate comes when you use Option as a monad. For instance, in Scala if you have a something like

case class Address(street: String, city: String, state, String) case class User(id: Int, name: String, address: Option[Address])

def filterCAUsers(users: List[User]): List[User] = users.filter(_.address.exists(_.state != "CA"))

comment 5y ago · link · parent

I think the point is not really to compare Java to Rust but highlight that in Java you pay a significant performance penalty (relative to representing Optional.empty() as null).

comment 5y ago · link · parent

One of the hardest things to get any dev organization to start taking seriously is supply chain security. That first scan which lights up like a Christmas Tree is always such a daunting obstacle to get over. It's a shame because it is probably the highest value SDLC practice that many are not doing.

comment 5y ago · link · parent

I think part of it is that we've had near-zero interest rates for the last dozen or so years. So banks can't make any money from small balance checking accounts, hence the ubiquity of minimum account balances. The traditional business model of factional reserve retail banking just doesn't work that well with super-low interest rates.

comment 5y ago · link · parent

It's a near perfect solution assuming nobody ever loses their U2F device.

comment 5y ago · link · parent

Which banks require an HOTP dongle for customers. Maybe it is a non-US thing but I have never once seen that.

comment 5y ago · link · parent

Is there any d2c business anywhere in the world right now that requires U2F on all accounts? I think you underestimate how confusing all of this is to non-technical users.

comment 5y ago · link · parent

They already do for the most part though right? That is, they lose a huge amount of money to "identity theft" and have ample incentives to stop/prevent it.

comment 5y ago · link · parent

Secure/not-secure is not a binary distinction. And SMS-based 2fa is still more secure than password alone.

One thing I've become painfully aware of recently is how all MFA is rendered pretty insecure by various "fallback" processes. I recently switch jobs and realized I had a few accounts using my old work phone as SMS 2fa number. In every case it was ridiculously easy to call a CSR and get 2fa disabled from their end.

comment 5y ago · link · parent

At this point I think the thing holding back U2F is just user experience. It is not "hard" but it is a pain in the ass and most people just find it annoying.

The other issue is that you ultimately need some sort of fallback mechanism if someone loses their keys. And it will happen. So you still end up with a process that can be socially engineered, which is generally the weak link in any authentication system.

comment 5y ago · link · parent

Yeah, I was getting the same phishing SMS weekly related to my Coinbase account.

comment 5y ago · link · parent

Yeah, this ends up being compelling from the business side as well. If you have mission-critical systems running on OSS software then it is absolutely worth it to have access to the maintainers in case you run into serious issues or need a bugfix prioritized.

From the maintainer side it can be a bit tricky though. Typically the finance will want to pay another corporation, so the maintainer would need to create some sort of legal entity to bill with. The other potential issues would be around legal liability in case something goes sideways. You run the risk of getting sued if you don't provide a level of support that some corporate client is expecting.

1
111213
24