• (nodebb)

    My first job decades ago where I came in contact with asp.net was literally an vb.net webform app written like this by a student.

    No transactional security and the whole thing was a big SQL injection pile of garbage (which a nice simple word for every dark pattern, bad practice and security snafu imaginable combined).

    And no, it was an unfixable mess that was core to business operations, so I touched it up as much as possible and otherwise stayed away from it. In the end it was fun growing from 1.0 into the 2.0 era, but oh man, thinking back this gig was the one I learnt the most of what not to do for sure.

  • Erk (unregistered)

    Yeah, I know this shop. For some reason, they don't have the infamous "'); drop database" album in store.... I've tried to find it several times. It's by "Robert'); drop TABLE Students;--"

  • L (unregistered)

    Me.Run("away")

  • Malte (unregistered)

    Additional to what Remy wrote, I dislike the construction If Not Me.Session("Albumid") Is Nothing And Not Me.Session("Uid") Is Nothing Then

    If you want to catch a or b being Nothing(void/None/...), go for

    if a is None or b is None: return

    Short and easy to read, safe because the "or" short-circuits, and you save one layer of indentation.

  • COBOL Dilettante (unregistered)

    "If Not Me Is Nothing" -- from the programming language brought to you by Ali G.

    (OK, working in a COBOL environment I shouldn't really criticise, but I'm going to anyway)

  • (nodebb) in reply to Malte

    This is VB.Net. "Or" doesn't short-circuits due to backwards compatibilty with VB. VB.Net's "OrElse" is the short-circuiting operator.

  • (nodebb)

    Response.Redirect is unfortunately necessary in WebForms. The big sins of WebForms is that it combines navigation and action. This results in situations where application logic requires navigation and action - and that's where Response.Redirect comes into play.

    My personal pet peeve with Response.Redirect is that to preserve backwards compatibility with Classic ASP behavior, Response.Redirect does its thing by throwing an exception.

  • Tim (unregistered) in reply to Jaime

    Of course there is an even worse option - server.transfer. This chains to the back end logic for the page you specify and sends it without a redirect so the URL the user sees on the browser is not the page that was executed.

  • (nodebb)

    I remember some of good old WebForms. I think the paradigm was actually fine, if they only had the foresight to make it work more like modern React + backend webservices. But I digress.

    What I wanted to say is - Labels don't post data back. That would be a TextBox or some sort of Input. If they're taking the ID out of the label, that means that they put it in there shortly before, in the processing of the same request. Which would very much follow the theme here. Or... they relied on the infamous ViewState. That can optionally be encrypted, which would at least plug the SQL Injection vulnerability, but I really doubt they had the foresight to turn that on....

  • Álvaro González (github)

    I assume they store all the variables in Session because they started using Application and weird things happened.

  • Hmmmm 🤨 (unregistered)

    ... and here I am thinking "what the heck is Electron?" Turns out it's chromium package with Node.js, which is more along the lines of what I thought everyone was programming in these days.

  • (nodebb) in reply to Hmmmm 🤨

    Turns out it's chromium package with Node.js, which is more along the lines of what I thought everyone was programming in these days.

    Fortunately (?) for me (or, maybe, fortunately for the rest of the world), I do not program in that sort of [REDACTED]. C or C++ directly on (or in)(1) FreeBSD.

    (1) "On" for userland services, "in" for deep-juju stuff in the kernel.

  • (nodebb) in reply to Hmmmm 🤨

    Yeah, Electron is basically hosting your browser app in a desktop like container. Good examples are MS Teams or Discord. It's basically the most wasteful way to make a desktop app but it's the cheapest one, because in the end you just have to maintain a web app and hope people won't stone you for the horrible UX on desktop.

  • (nodebb) in reply to Tim

    I found Server.Transfer does have some value... for an app's generic "error" page (especially as I hate errors that redirect you... among which there is none I hate more than redirecting 404 errors, that change the address bar so you can't see the URL that was wrong).

  • (nodebb)

    Don't get me started on If Not x Is Nothing. IsNot has existed since VB 2005, as far back as .NET Framework 2.0! Unless you're doing webforms in .NET Framework 1.x (which you really shouldn't), there is not excuse not to use it.

  • 516052 (unregistered)

    TICKET ON DID NOT PASS RESUME NEXT.

  • Daemon (unregistered)

    Reading the post and code, I can't help but wonder if the Label hack is some sort of misplaced way of doing something that should be done with a 'hidden'-type form field.

  • (nodebb) in reply to Malte

    and you save one layer of indentation.

    I really hate this argument. You can save lots of layers of indentation by not using indentation at all to show the structure of your code. Whatever the arguments are for bailing out early, disguising the complexity of your (which is what this argument amounts to) is not one of them.

  • (nodebb) in reply to Vilx

    That can optionally be encrypted, which would at least plug the SQL Injection vulnerability, but I really doubt they had the foresight to turn that on....

    How would that prevent the injection vulnerability when the SQL is being built via ye olde string concatenation after being received?

  • 516052 (unregistered) in reply to gordonfish

    Would condoms protect you if you were doing the deed in Chernobyl? Still makes sense to wear them.

  • Officer Johnny Holzkopf (unregistered)

    Hello, yes, this is Doctor Johnny Holzkopf: To treat stupid, take 5 Albumid forte in the morning, and if stupid persists, take further 2 Albumid. If it doesn't get better, FORMAT C: or RESUME NEXT.

  • (nodebb) in reply to 516052

    But it also makes way more sense to construct queries properly. It's still being built by simple concatenation so adding encryption to the request, while fine, doesn't change the fact that the SQL injection vulnerability still exists.

  • 516052 (unregistered) in reply to gordonfish

    Naturally. My point is simply that I find it all too easy to harden one part of your pipeline and end there in the mistaken belief that the other parts won't ever be reused abused. I prefer to apply security at both ends for that reason.

Leave a comment on “Session Recording”

Log In or post as a guest

Replying to comment #705705:

« Return to Article