Comparing version 0.2.0 to 0.3.0
@@ -41,3 +41,3 @@ import { Har } from "har-format"; | ||
/** A part of a request, to explain where some information was found. */ | ||
export type Context = 'header' | 'path' | 'query' | 'body'; | ||
export type Context = 'header' | 'cookie' | 'path' | 'query' | 'body'; | ||
/** A tracking company that we have adapters for. */ | ||
@@ -66,3 +66,3 @@ export type Tracker = { | ||
*/ | ||
export type Property = 'accelerometerX' | 'accelerometerY' | 'accelerometerZ' | 'appId' | 'appName' | 'appVersion' | 'architecture' | 'batteryLevel' | 'carrier' | 'country' | 'deviceName' | 'diskFree' | 'diskTotal' | 'diskUsed' | 'hashedIdfa' | 'idfa' | 'idfv' | 'isCharging' | 'isEmulator' | 'isInDarkMode' | 'isInForeground' | 'isRoaming' | 'isRooted' | 'language' | 'latitude' | 'localIp' | 'longitude' | 'macAddress' | 'manufacturer' | 'model' | 'networkConnectionType' | 'orientation' | 'osName' | 'osVersion' | 'otherIdentifiers' | 'publicIp' | 'ramFree' | 'ramTotal' | 'ramUsed' | 'rotationX' | 'rotationY' | 'rotationZ' | 'screenHeight' | 'screenWidth' | 'signalStrengthCellular' | 'signalStrengthWifi' | 'timezone' | 'trackerSdkVersion' | 'uptime' | 'userAgent' | 'viewedPage' | 'volume'; | ||
export type Property = 'accelerometerX' | 'accelerometerY' | 'accelerometerZ' | 'appId' | 'appName' | 'appVersion' | 'architecture' | 'batteryLevel' | 'carrier' | 'country' | 'deviceName' | 'diskFree' | 'diskTotal' | 'diskUsed' | 'hashedIdfa' | 'idfa' | 'idfv' | 'installTime' | 'isCharging' | 'isEmulator' | 'isFirstLaunch' | 'isInDarkMode' | 'isInForeground' | 'isRoaming' | 'isRooted' | 'language' | 'latitude' | 'localIp' | 'longitude' | 'macAddress' | 'manufacturer' | 'model' | 'networkConnectionType' | 'orientation' | 'osName' | 'osVersion' | 'otherIdentifiers' | 'publicIp' | 'pushNotificationToken' | 'ramFree' | 'ramTotal' | 'ramUsed' | 'revenue' | 'referer' | 'rotationX' | 'rotationY' | 'rotationZ' | 'screenHeight' | 'screenWidth' | 'signalStrengthCellular' | 'signalStrengthWifi' | 'startTime' | 'state' | 'timeSpent' | 'timezone' | 'trackerSdkVersion' | 'uptime' | 'userAgent' | 'viewedPage' | 'volume'; | ||
/** A variable on the global state used in the decoding process of a request. This doesn't allow nested property access. */ | ||
@@ -108,3 +108,3 @@ export type Variable = LiteralUnion<Context | 'res', string>; | ||
export type DecodingStep = ({ | ||
function: 'parseQueryString' | 'parseJson' | 'decodeBase64' | 'decodeUrl' | 'decodeProtobuf' | 'ensureArray'; | ||
function: 'parseQueryString' | 'parseJson' | 'decodeBase64' | 'decodeUrl' | 'decodeProtobuf' | 'ensureArray' | 'gunzip'; | ||
} | { | ||
@@ -132,3 +132,3 @@ function: 'getProperty'; | ||
*/ | ||
reasoning: 'obvious property name' | 'obvious observed values' | `https://${string}` | `http://${string}`; | ||
reasoning: 'obvious property name' | 'obvious observed values' | 'observed values match known device parameters' | `https://${string}` | `http://${string}` | `${string}.md`; | ||
}; | ||
@@ -169,2 +169,25 @@ /** | ||
/** | ||
* Decode a request into an object representation using the given decoding steps. | ||
* | ||
* @remarks | ||
* This is not needed for the main purposes of this library, but can be useful for more advanced use cases. | ||
* | ||
* @param r The request to decode in our internal request format. | ||
* @param decodingSteps The decoding steps to use (from the adapter). | ||
* | ||
* @returns An object representation of the request. | ||
*/ | ||
export const decodeRequest: (r: Request, decodingSteps: DecodingStep[]) => any; | ||
/** | ||
* Find the adapter that can handle a certain request. | ||
* | ||
* @remarks | ||
* This is not needed for the main purposes of this library, but can be useful for more advanced use cases. | ||
* | ||
* @param r The request to find an adapter for. | ||
* | ||
* @returns The adapter that can handle the request, or `undefined` if none could be found. | ||
*/ | ||
export const adapterForRequest: (r: Request) => Adapter | undefined; | ||
/** | ||
* Parse a single request in our internal request representation and extract tracking data as an annotated result from | ||
@@ -171,0 +194,0 @@ * it. |
{ | ||
"name": "trackhar", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "Library for detecting tracking data transmissions from traffic in HAR format.", | ||
@@ -31,3 +31,5 @@ "bugs": "https://github.com/tweaselORG/TrackHAR/issues", | ||
"scripts": { | ||
"auto-archive": "tsx scripts/archive-links.ts", | ||
"build": "parcel build", | ||
"debug-adapter": "tsx scripts/debug-adapter.ts", | ||
"fix": "yarn eslint . --ignore-path .gitignore --ext .js,.jsx,.ts,.tsx --fix", | ||
@@ -50,2 +52,5 @@ "lint": "tsc && eslint . --ignore-path .gitignore --ext .js,.jsx,.ts,.tsx && git diff --check", | ||
"eslint --fix" | ||
], | ||
"src/adapters/*.ts": [ | ||
"tsx scripts/check-archived.ts" | ||
] | ||
@@ -59,2 +64,3 @@ }, | ||
"escape-string-regexp": "^5.0.0", | ||
"fflate": "^0.8.0", | ||
"jsonpath-plus": "^7.2.0", | ||
@@ -70,12 +76,21 @@ "protobufjs": "^7.2.3", | ||
"@parcel/transformer-typescript-types": "2.8.3", | ||
"@types/node": "^18.15.11", | ||
"@types/node": "^20.7.0", | ||
"@types/qs": "^6.9.7", | ||
"@typescript-eslint/eslint-plugin": "5.57.0", | ||
"chalk": "^5.3.0", | ||
"chokidar": "^3.5.3", | ||
"cross-fetch": "^4.0.0", | ||
"csv": "^6.3.3", | ||
"deepmerge": "^4.3.1", | ||
"eslint": "8.37.0", | ||
"eslint-plugin-eslint-comments": "3.2.0", | ||
"eslint-plugin-import": "2.27.5", | ||
"execa": "^8.0.1", | ||
"husky": "4.3.7", | ||
"lint-staged": "13.2.0", | ||
"p-map": "^6.0.0", | ||
"p-retry": "^6.0.0", | ||
"parcel": "2.8.3", | ||
"prettier": "2.8.7", | ||
"tsx": "~3.13.0", | ||
"type-fest": "^3.7.2", | ||
@@ -82,0 +97,0 @@ "typedoc": "0.23.28", |
@@ -217,2 +217,15 @@ # TrackHAR | ||
### Debugging adapters | ||
While developing an adapter, you can use our debug script to test your adapter against hundreds of thousands of real requests in our [open request database](https://data.tweasel.org/). To do so, run: | ||
```sh | ||
yarn debug-adapter <tracker slug>/<adapter slug> | ||
# e.g.: yarn debug-adapter facebook/graph | ||
``` | ||
This will run your adapter against all matching requests in the database and print the results to the console. In addition, it will output a deepmerged version of the intermediate decoding result to the file `./merged-decoded-requests.tmp.json`. | ||
You can optionally pass `--merge-result` to see the results for all requests merged into a single object and with duplicate values for each data type removed. | ||
## License | ||
@@ -219,0 +232,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
481274
5058
235
0
8
28
+ Addedfflate@^0.8.0
+ Addedfflate@0.8.2(transitive)