Skip to content

Instantly share code, notes, and snippets.

@mikeg-de
mikeg-de / internal-traffic-identification.js
Created January 27, 2018 19:37
Identify internal traffic through performance timing API
/* The scripts purpose is to identify internal traffic but it might be used to verify if a user has visited a certain website.
* By assuming a user visited website A, resources or connection information like DNS or SSL get's cached.
* Leveraging the HTML5 Resource Timing API (https://www.w3.org/TR/resource-timing/) a known resources get's attached to the DOM.
* If the resource or it's connection information was already cached the following metrics should be zero:
* domainLookupStart, domainLookupEnd, connectStart, connectEnd, requestStart, responseStart
*
* This script is extended with Google Tag Manager events to track the findings. Later I will elaborate to implement the userID.
*/
var imageCheck = document.createElement("img");
@mikeg-de
mikeg-de / nginx-csp-security.conf
Created October 17, 2017 07:27
CSP definition for Nginx which leverages $server_name
# CSP definition for Nginx which leverages $server_name
# Purpose: One CSP-Header for all vhosts
# Installation
# Include this into each server directive in the nginx.conf
# Note
# Check out the script to send a Google Analytics Event and Email upon CSP violation is triggered
# https://github.com/mikeg-de/CSP-Violation-Google-Analytics-Email