npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ops-ias-fraud-ip-ingest

v1.3.0

Published

Ingest fraud ip list from integraladscience into somquery redis

Downloads

1

Readme

ops-ias-fraud-ip-ingest

Objective

In order to avoid serving ads to fraudulant traffic we use data of a third party ad verification provider called Integral Ad Science (IAS).

They are sending lists of IPs claimed as fraudulent by them on an hourly base (S3 upload). We will use that data to block the related traffic (or at least monitor the outcome in the first phase).

Architecture

Architecture

Draw.io source

Resources Workflow

  • IAS uploads a list of ~2.5Mio. IP's to a S3 bucket on hourly basis
  • A StepFunction / Lambda ingests these IP's to the Somquery Redis Cache
    • in bunches of 100,000 in order to avoid latency in Redis / Timeouts of Lambda
    • concurrent ingest of a newer set before switching versions
    • a separate Lambda for removing entries of older versions
  • Somquery is checking the remote IP of every call that is to return any VAST
    • the result in written into the debug output / Cerberus log data
    • the log data is monitored in Sherlog in order to get a figure of the ratio that would really get blocked

Ingest / Request Workflow

  • After every IAS upload a timestamp is generated (<new-timestamp>)
  • Ingest of one entry per IP with schema ip:<new-timestamp>:<the-bad-ip>
  • After Ingest set ip:currentTimestamp to <new-timestamp>
  • Another Lambda is constanty removing IP entries with timestamps oder than currentTimestamp
  • Somquery has to perform 2 Redis calls:
    • const ts = await client.get('ip:currentTimestamp);
    • const isFraud = await client.get(`ip:${ts}:${<ip-to-be-checked>}`);

Q & A

Why ingest into Redis with bunches of only 100,000 IPs?

Redis is a highly available mem cache used in all our Somquery EC2 instances. Operating with bigger chunks could potentially increase any risk of interfere with Redis' life performance or of a timeout of the Lambda function.

Why a separate Lambda for deleting IP entries of older versions?

Basicly for the same reasons (performance / timeout) plus an additional security layer that not any older data caused by a Ingest Lambda crash would bloat up Redis' size without noticing.

AWS Resources

  • Bucket: arn:aws:s3:::adtech-ias-data-exchange
  • S3 Event Rule: arn:aws:events:eu-central-1:377710842884:rule/ias-data-exchange-event-rule
  • StepFunction: arn:aws:states:eu-central-1:377710842884:stateMachine:IasIngestFraudIpsStateMachine
  • Ingest Lambda: arn:aws:lambda:eu-central-1:377710842884:function:ias-ingest-fraud-ips
  • Cleanup Trigger: arn:aws:events:eu-central-1:377710842884:rule/ias-fraud-data-cleanup-hourly
  • Cleanup Lambda: arn:aws:lambda:eu-central-1:377710842884:function:ias-cleanup-fraud-ips