Skip to content

Instantly share code, notes, and snippets.

View intltechventures's full-sized avatar

Kelvin D Meeks intltechventures

View GitHub Profile
@archisgore
archisgore / npm_dependency_confusion.md
Last active February 17, 2021 05:52
NPM/Node.js code injection attack

NPM/Node.js recently had a clever, yet simple, code injection attack using "dependency confusion" as the vulnerability. I describe the attack as conducted (simulated, really), and a systemic solution Polyverse has been building for the past two years designed to solve specifically this problem.

A recap of the attack, for baseline:

Node dependencies are specified by name and version but not address/location, i.e., {“sorter”: “1.0”, “binary-search”: “2.0”, “polyverse-billing”: 1.0}.

Notice the last one? It’s intended to be Polyverse internal and contains our proprietary (and sensitive) billing code. Obviously it does not exist on npmjs.com, the public upstream node package repository. It instead comes from a private repository hosted by Polyverse.

In a Sequence Diagram, this is how the flow worked before the attack. Pretty straight-forward.

Podcasts for Data Science & Stuff

I asked the Twittersphere for data science (& tangentially-related) podcasts recommendations, and got a much bigger response than I expected with some really superb recommendations, so I created a gist with the suggestions I received. They're arranged alphabetically by name below, along with relevant Twitter accounts, links, and names of the hosts (if I could find them).

Shoot me a tweet @bennyjtang if you have more suggestions to add to this list!

Original Twitter thread

Adversarial Learning

Applied Functional Programming with Scala - Notes

Copyright © 2016-2018 Fantasyland Institute of Learning. All rights reserved.

1. Mastering Functions

A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.

val square : Int => Int = x => x * x
@paulp
paulp / hey.scala
Created September 14, 2014 03:08
class Bippy(override val toString: String)
trait A { implicit def lowPriority: Bippy = new Bippy("A") }
object B extends A { implicit def highPriority: Bippy = new Bippy("B") }
object C { implicit def highPriority: Bippy = new Bippy("C") }
object Test {
def main(args: Array[String]): Unit = {
import B._, C._
println( implicitly[Bippy] ) // Prints: A
@jsanders
jsanders / generate_big_primes.rs
Last active October 30, 2018 22:53
Generate big primes in Rust. This works pretty fast now thanks to https://github.com/jsanders/rust-bignum and https://github.com/jsanders/rust-gmp! I'm still implementing my own mod_exp, but the performance is quite tolerable nonetheless.
extern crate bignum;
extern crate time;
use std::rand::task_rng;
use std::iter::{count,range_step_inclusive};
use std::num::{Zero,One};
use bignum::{BigUint,RandBigInt,ToBigUint};
// Find all prime numbers less than n
fn small_primes(bound: uint) -> ~[uint] {
@korczis
korczis / architecture.dot
Last active August 23, 2016 17:00
Architecture in Graphviz
// dot.exe -T svg -o architecture.svg architecture.dot
digraph architecture {
// Render chart with left to right layout
rankdir="LR";
// AMQP communication node
amqp [label="AMQP",shape=box,fillcolor="burlywood",style="filled"];
// Clients
@rmacfie
rmacfie / C# hash generator
Created February 15, 2011 19:21
Generate Md5 and SHA hashes in C#.NET.
public static class CryptographyExtensions
{
/// <summary>
/// Calculates the MD5 hash for the given string.
/// </summary>
/// <returns>A 32 char long MD5 hash.</returns>
public static string GetHashMd5(this string input)
{
return ComputeHash(input, new MD5CryptoServiceProvider());
}