A framework for automated evaluation of tools for dynamic information flow analysis of JavaScript.
- Ubuntu 22.04 LTS
- Node.js 20 or above
- Build the default toolset: https://github.com/eleumasc/DynSecAnJS-tools
- Clone this repository:
git clone https://github.com/eleumasc/DynSecAnJS && cd DynSecAnJS - Install the dependencies:
npm i - Install Playwright:
npx playwright install - Build:
npm run build - Copy
.env.exampleinto.env:cp .env.example .env; then, set the value ofTOOLS_PATHto the path toDynSecAnJS-tools(see step 1)
The framework performs the analysis in stages. Each stage generates an archive directory, which serves as the input for the subsequent stages.
In the following, execute each command by running npm run start -- <command>.
- Create a site list file, that is a JSON file containing an array of domain strings (e.g.,
["foo.com","bar.com"]). You can store the site list file wherever you want. Anyway, we suggest to store it into a subdirectory calledsitelists(ignored by git). - Execute the command
record /path/to/sitelist.jsonto record an execution for each domain in the site list file created at step 1. This command generates an archive directory calledRecord-[0-9]+. - Execute the command
preanalyze /path/to/Record-[0-9]+to pre-analyze the executions recorded at step 2, in particular parsing the scripts and computing their syntactic compatility. This command generates an archive directory calledPreanalyze-[0-9]+. - Execute the command
collect <browserOrToolName> /path/to/Preanalyze-[0-9]+to replay the executions pre-analyzed at step 3 in the browser or tool specified bybrowserOrToolNameand collect data about those replayed executions. The list of browsers and tools forbrowserOrToolNameis available in BrowserName.ts and ToolName.ts, respectively. This command generates an archive directory calledCollect-<browserOrToolName>-[0-9]+. Repeat this step for every available browser and tool. - Execute the command
measure /path/to/Preanalyze-[0-9]+ --collect /path/to/Collect-<browserOrToolName1>-[0-9]+ ... --collect /path/to/Collect-<browserOrToolNameN>-[0-9]+to perform the measurement using the collect archives created at step 4. It is required that all the collect archives specified must derive from the preanalyze archive specified. Moreover, if a collect archive referred to some tool is specified, then a collect archive referred to the original browser associated to that tool must be specified as well, according to the mapping available in ToolName.ts (getBrowserNameByToolNamefunction). This command generates a report JSON file containing aggregate data for the analysis of compatibility, transparency, coverage (limited to information flow analysis), and performance.
Useful tips:
- The archive directories are stored by default into the
workspacesubdirectory (ignored by git). You can change this location by specifying the--workingDirectory <path>option. - The
--concurrencyLimit <n>option for therecord,preanalyze, andcollectcommands allows the analysis of up tondomains concurrently. - Analyses initiated by the
recordorcollectcommand can be resumed after an interruption by running<command>:resume <archivePath>, wherearchivePathis the archive of the analysis to be resumed. - Execute a command with the
--helpoption to print the command usage.
Feel free to open an issue or send a pull request. We will try to sort it as soon as possible.