Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update schema version to support strict whitelist #648

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,17 @@ To allow your app to require a package, add it to the
// ...
},
"dependencies": {
// ...
"lodash": "..."
},
"fastbootDependencies": [
"rsvp",
"lodash",
"path"
]
}
```

The `fastbootDependencies` in the above example means the only node
modules your Ember app can use are `rsvp` and `path`.
modules your Ember app can use are `lodash` and `path`.

If the package you are using is not built-in to Node, **you must also
specify the package and a version in the `package.json` `dependencies`
Expand All @@ -101,15 +101,18 @@ hash.** Built-in modules (`path`, `fs`, etc.) only need to be added to
### Using Dependencies

From your Ember.js app, you can run `FastBoot.require()` to require a
package. This is identical to the CommonJS `require` except it checks
package or its submodule. This is identical to the CommonJS `require` except it checks
all requests against the whitelist first.

```js
let path = FastBoot.require('path');
let filePath = path.join('tmp', session.getID());

let _ = FastBoot.require('lodash');
let at = FastBoot.require('lodash/at');
```

If you attempt to require a package that is not in the whitelist,
If you attempt to require a package or submodule from package that is not in the whitelist,
FastBoot will raise an exception.

Note that the `FastBoot` global is **only** available when running in
Expand Down
2 changes: 1 addition & 1 deletion lib/broccoli/fastboot-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const Plugin = require('broccoli-plugin');

const stringify = require('json-stable-stringify');

const LATEST_SCHEMA_VERSION = 3;
const LATEST_SCHEMA_VERSION = 4;

module.exports = class FastBootConfig extends Plugin {
constructor(inputNode, options) {
Expand Down