• 1 Post
  • 32 Comments
Joined 1 year ago
cake
Cake day: September 1st, 2023

help-circle










  • hades@lemm.eetoTechnology@lemmy.worldEmail Security for Every Taste
    link
    fedilink
    English
    arrow-up
    3
    arrow-down
    1
    ·
    25 days ago

    Nice article!

    You seem to be missing the word “by” in the table introducing threat T04. Also, the threat summary table uses ✅ and ❌ in a way that was counterintuitive to me: initially I thought ✅ meant the encryption approach protects against the threat.

    A bigger issue IMO is how you describe email encryption in transit as a matter of fact, but according to Google transparency report[1] there are still domains that do not support in transit encryption, and, what’s worse, when you send an email you can’t tell if it will be encrypted or not.

    [1] https://transparencyreport.google.com/safer-email/overview?hl=en








  • I would argue that having distinct match and search helps readability. The difference between match('((([0-9]+-[0-9]+)|([0-9]+))[,]?)+[^,]', s) and search('((([0-9]+-[0-9]+)|([0-9]+))[,]?)+[^,]', s) is clear without the need for me to parse the regular expression myself. It also helps code reuse. Consider that you have PHONE_NUMBER_REGEX defined somewhere. If you only had a method to “search” but not to “match”, you would have to do something like search(f"\A{PHONE_NUMBER_REGEX}\Z", s), which is error-prone and less readable. Most likely you would end up having at least two sets of precompiled regex objects (i.e. PHONE_NUMBER_REGEX and PHONE_NUMBER_FULLMATCH_REGEX). It is also a fairly common practice in other languages’ regex libraries (cf. [1,2]). Golang, which is usually very reserved in the number of ways to express the same thing, has 16 different matching methods[3].

    Regarding re.findall, I see what you mean, however I don’t agree with your conclusions. I think it is a useful convenience method that improves readability in many cases. I’ve found these usages from my code, and I’m quite happy that this method was available[4]:

    digits = [digit_map[digit] for digit in re.findall("(?=(one|two|three|four|five|six|seven|eight|nine|[0-9]))", line)]
    [(minutes, seconds)] = re.findall(r"You have (?:(\d+)m )?(\d+)s left to wait", text)
    

    [1] https://docs.oracle.com/javase/7/docs/api/java/util/regex/Matcher.html

    [2] https://en.cppreference.com/w/cpp/regex

    [3] https://pkg.go.dev/regexp

    [4] https://github.com/search?q=repo%3Ahades%2Faoc23 findall&type=code