{"_id":"alcatraz","_rev":"269172","name":"alcatraz","description":"A high-security prison for your application code","dist-tags":{"latest":"0.0.1"},"maintainers":[{"name":"3rdeden","email":""},{"name":"indexzero","email":"charlie.robbins@gmail.com"},{"name":"jcrugzz","email":""},{"name":"v1","email":""}],"time":{"modified":"2023-06-28T12:14:37.000Z","created":"2013-12-22T20:03:54.571Z","0.0.1":"2014-01-03T16:01:44.465Z","0.0.0":"2013-12-22T20:03:54.571Z"},"users":{},"author":{"name":"Arnout Kazemier"},"repository":{"type":"git","url":"git://github.com/3rd-Eden/alcatraz.git"},"versions":{"0.0.1":{"name":"alcatraz","version":"0.0.1","description":"A high-security prison for your application code","main":"index.js","scripts":{"test":"mocha $(find test -name '*.test.js')"},"keywords":["prison","jail","sandbox"],"repository":{"type":"git","url":"git://github.com/3rd-Eden/alcatraz.git"},"author":{"name":"Arnout Kazemier"},"license":"MIT","devDependencies":{"pre-commit":"0.0.x","mocha":"1.16.x"},"bugs":{"url":"https://github.com/3rd-Eden/alcatraz/issues"},"_id":"alcatraz@0.0.1","dist":{"shasum":"e4b415b6eff09de6245ae01cd4a57d55a9906543","size":4432,"noattachment":false,"key":"/alcatraz/-/alcatraz-0.0.1.tgz","tarball":"http://name.csiicloud.com:7001/alcatraz/download/alcatraz-0.0.1.tgz"},"_from":".","_npmVersion":"1.3.5","_npmUser":{"name":"V1","email":"info@3rd-Eden.com"},"maintainers":[{"name":"3rdeden","email":""},{"name":"indexzero","email":"charlie.robbins@gmail.com"},{"name":"jcrugzz","email":""},{"name":"v1","email":""}],"directories":{},"_cnpmcore_publish_time":"2021-12-19T13:24:36.513Z","publish_time":1388764904465,"_cnpm_publish_time":1388764904465},"0.0.0":{"name":"alcatraz","version":"0.0.0","description":"A high-security prison for your application code","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"keywords":["prison","jail","sandbox"],"author":{"name":"Arnout Kazemier"},"license":"MIT","_id":"alcatraz@0.0.0","dist":{"shasum":"2eb5add736e7171eb158aa4f6dfadcab6382e011","size":2843,"noattachment":false,"key":"/alcatraz/-/alcatraz-0.0.0.tgz","tarball":"http://name.csiicloud.com:7001/alcatraz/download/alcatraz-0.0.0.tgz"},"_from":".","_npmVersion":"1.3.5","_npmUser":{"name":"V1","email":"info@3rd-Eden.com"},"maintainers":[{"name":"3rdeden","email":""},{"name":"indexzero","email":"charlie.robbins@gmail.com"},{"name":"jcrugzz","email":""},{"name":"v1","email":""}],"directories":{},"_cnpmcore_publish_time":"2021-12-19T13:24:35.644Z","publish_time":1387742634571,"_cnpm_publish_time":1387742634571}},"readme":"# Alcatraz\n\n[![Build Status](https://travis-ci.org/3rd-Eden/alcatraz.png?branch=master)](https://travis-ci.org/3rd-Eden/alcatraz)\n\nAlcatraz is high-security prison for your application code. It does this by\nwrapping your front-end code in an extra closure that can terminate hostile\nscripts by nuking global variables or introducing them in to the local scope and\nthere for overriding them.\n\nThe primary objective of this module was to ensure that code can run safely\nwithin an `iframe` element in the browser without requiring any code rewriting.\nTo see it's use for iframe sandboxing, please take a look at:\n\nhttps://github.com/3rd-Eden/containerization\n\nCurrent alcatraz does:\n\n- set the `document.domain`.\n- try to remove references to iframe parents.\n- add error listeners.\n- prevent alert, prompt, confirm and other blocking dialogs\n- add a `console` object\n- add load listeners\n- communicate the load, errors and console usage with an assigned method.\n- Add a ping/pong method to help with figuring out blocking code.\n\n## Getting started\n\nTo create a new prison for your code you need to require the `alcatraz` module.\n\n```js\nvar Alcatraz = require('alcatraz');\n```\n\nThe `Alcatraz` constructor allows 3 arguments:\n\n1. `method` a string of the global function name that is used to communicate\n   with the jail.\n2. `source` the actual code that needs to be locked down, this assumes a string.\n3. `domain` this sets the `document.domain` to allow cross domain communication\n   if needed. If no argument is give, it defaults to the current\n   `document.domain`.\n\nTo sandbox the code simply `toString` your alcatraz instance.\n\n```js\nvar prison = new Alcatraz('myglobalfn', fs.readFileSync('index.js', 'utf-8'));\n\nconsole.log(prison.toString());\n```\n\n## Protocol\n\nThe wrapped code communicates with the given method using a simple object based\nprotocol.\n\n```js\n{ type: ping }                // send a ping packet\n{ type: load }                // the load event fired\n{ type: error }               // critical javascript error\n  { scope: 'window.onerror' } // the error has a scope, to trace back the origin\n  { args: [] }                // the arguments the error received\n{ type: console }             // console method was accessed\n  { attach: boolean }         // was a logging/debuggin method\n  { scope: method }           // method name used\n  { args: [] }                // arguments of the console\n```\n\n## License\n\nMIT\n","_attachments":{},"bugs":{"url":"https://github.com/3rd-Eden/alcatraz/issues"},"license":"MIT"}