react-resizable 3.1.1 → 3.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +90 -47
- package/build/propTypes.js +2 -1
- package/build/propTypes.js.flow +2 -1
- package/package.json +7 -2
- package/.babelrc +0 -16
- package/.browserslistrc +0 -3
- package/.claude/settings.local.json +0 -18
- package/.flowconfig +0 -25
- package/.packj.yaml +0 -153
- package/CHANGELOG.md +0 -177
- package/CLAUDE.md +0 -71
- package/dist/bundle.js +0 -488
package/README.md
CHANGED
|
@@ -1,84 +1,118 @@
|
|
|
1
|
-
|
|
1
|
+
# React-Resizable
|
|
2
2
|
|
|
3
|
-
[
|
|
3
|
+
[](https://www.npmjs.com/package/react-resizable)
|
|
4
|
+
[](https://www.npmjs.com/package/react-resizable)
|
|
5
|
+
[](https://github.com/react-grid-layout/react-resizable/actions/workflows/test.yml)
|
|
6
|
+
|
|
7
|
+
[**View the Demo**](https://react-grid-layout.github.io/react-resizable/examples/)
|
|
4
8
|
|
|
5
9
|
A simple widget that can be resized via one or more handles.
|
|
6
10
|
|
|
7
11
|
You can either use the `<Resizable>` element directly, or use the much simpler `<ResizableBox>` element.
|
|
8
12
|
|
|
9
|
-
See the example and associated code in [ExampleLayout](/examples/ExampleLayout.js) and
|
|
10
|
-
[ResizableBox](/lib/ResizableBox.js) for more details.
|
|
13
|
+
See the example and associated code in [ExampleLayout](https://github.com/react-grid-layout/react-resizable/blob/master/examples/ExampleLayout.js) and
|
|
14
|
+
[ResizableBox](https://github.com/react-grid-layout/react-resizable/blob/master/lib/ResizableBox.js) for more details.
|
|
15
|
+
|
|
16
|
+
## Table of Contents
|
|
17
|
+
|
|
18
|
+
- [Installation](#installation)
|
|
19
|
+
- [Compatibility](#compatibility)
|
|
20
|
+
- [Usage](#usage)
|
|
21
|
+
- [Resizable](#resizable)
|
|
22
|
+
- [ResizableBox](#resizablebox)
|
|
23
|
+
- [Props](#props)
|
|
24
|
+
- [Extracting Styles](#extracting-styles)
|
|
25
|
+
- [Custom Resize Handles](#resize-handle)
|
|
26
|
+
|
|
27
|
+
## Installation
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
$ npm install --save react-resizable
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Extracting Styles
|
|
34
|
+
|
|
35
|
+
You **must** include the associated styles in your application, otherwise the resize handles will not be visible and will not work properly.
|
|
11
36
|
|
|
12
|
-
|
|
13
|
-
|
|
37
|
+
```js
|
|
38
|
+
// In your JS/TS entry point:
|
|
39
|
+
import 'react-resizable/css/styles.css';
|
|
40
|
+
```
|
|
14
41
|
|
|
15
|
-
|
|
16
|
-
See the [demo](/examples/TestLayout.js) for more on this.
|
|
42
|
+
Or import it in your CSS:
|
|
17
43
|
|
|
18
|
-
|
|
44
|
+
```css
|
|
45
|
+
@import 'react-resizable/css/styles.css';
|
|
46
|
+
```
|
|
19
47
|
|
|
20
|
-
|
|
48
|
+
If you're using a bundler that doesn't support CSS imports, you can find the styles at `node_modules/react-resizable/css/styles.css` and include them manually.
|
|
21
49
|
|
|
22
|
-
|
|
50
|
+
## Compatibility
|
|
23
51
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
[
|
|
52
|
+
| Version | React Version |
|
|
53
|
+
|---------|---------------|
|
|
54
|
+
| [3.x](https://github.com/react-grid-layout/react-resizable/blob/master/CHANGELOG.md#300-may-10-2021) | `>= 16.3` |
|
|
55
|
+
| 2.x | Skipped |
|
|
56
|
+
| [1.x](https://github.com/react-grid-layout/react-resizable/blob/master/CHANGELOG.md#1111-mar-5-2021) | `14 - 17` |
|
|
27
57
|
|
|
28
|
-
|
|
58
|
+
## Usage
|
|
29
59
|
|
|
30
60
|
This package has two major exports:
|
|
31
61
|
|
|
32
|
-
* [`<Resizable>`](/lib/Resizable.js): A raw component that does not have state. Use as a building block for larger components, by listening to its
|
|
33
|
-
|
|
34
|
-
* [`<ResizableBox>`](/lib/ResizableBox.js): A simple `<div {...props} />` element that manages basic state. Convenient for simple use-cases.
|
|
62
|
+
* [`<Resizable>`](https://github.com/react-grid-layout/react-resizable/blob/master/lib/Resizable.js): A raw component that does not have state. Use as a building block for larger components, by listening to its callbacks and setting its props.
|
|
63
|
+
* [`<ResizableBox>`](https://github.com/react-grid-layout/react-resizable/blob/master/lib/ResizableBox.js): A simple `<div {...props} />` element that manages basic state. Convenient for simple use-cases.
|
|
35
64
|
|
|
65
|
+
### `<Resizable>`
|
|
36
66
|
|
|
37
|
-
#### `<Resizable>`
|
|
38
67
|
```js
|
|
39
|
-
const {Resizable} = require('react-resizable');
|
|
40
|
-
|
|
41
|
-
// ES6
|
|
42
68
|
import { Resizable } from 'react-resizable';
|
|
69
|
+
import 'react-resizable/css/styles.css';
|
|
43
70
|
|
|
44
|
-
// ...
|
|
45
71
|
class Example extends React.Component {
|
|
46
72
|
state = {
|
|
47
73
|
width: 200,
|
|
48
74
|
height: 200,
|
|
49
75
|
};
|
|
50
76
|
|
|
51
|
-
// On top layout
|
|
52
77
|
onResize = (event, {node, size, handle}) => {
|
|
53
78
|
this.setState({width: size.width, height: size.height});
|
|
54
79
|
};
|
|
55
80
|
|
|
56
81
|
render() {
|
|
57
82
|
return (
|
|
58
|
-
<Resizable
|
|
59
|
-
|
|
83
|
+
<Resizable
|
|
84
|
+
height={this.state.height}
|
|
85
|
+
width={this.state.width}
|
|
86
|
+
onResize={this.onResize}
|
|
87
|
+
>
|
|
88
|
+
<div
|
|
89
|
+
className="box"
|
|
90
|
+
style={{width: this.state.width + 'px', height: this.state.height + 'px'}}
|
|
91
|
+
>
|
|
60
92
|
<span>Contents</span>
|
|
61
93
|
</div>
|
|
62
94
|
</Resizable>
|
|
63
95
|
);
|
|
64
96
|
}
|
|
65
97
|
}
|
|
66
|
-
|
|
67
98
|
```
|
|
68
99
|
|
|
100
|
+
### `<ResizableBox>`
|
|
69
101
|
|
|
70
|
-
#### `<ResizableBox>`
|
|
71
102
|
```js
|
|
72
|
-
const {ResizableBox} = require('react-resizable');
|
|
73
|
-
|
|
74
|
-
// ES6
|
|
75
103
|
import { ResizableBox } from 'react-resizable';
|
|
104
|
+
import 'react-resizable/css/styles.css';
|
|
76
105
|
|
|
77
106
|
class Example extends React.Component {
|
|
78
107
|
render() {
|
|
79
108
|
return (
|
|
80
|
-
<ResizableBox
|
|
81
|
-
|
|
109
|
+
<ResizableBox
|
|
110
|
+
width={200}
|
|
111
|
+
height={200}
|
|
112
|
+
draggableOpts={{grid: [25, 25]}}
|
|
113
|
+
minConstraints={[100, 100]}
|
|
114
|
+
maxConstraints={[300, 300]}
|
|
115
|
+
>
|
|
82
116
|
<span>Contents</span>
|
|
83
117
|
</ResizableBox>
|
|
84
118
|
);
|
|
@@ -86,7 +120,7 @@ class Example extends React.Component {
|
|
|
86
120
|
}
|
|
87
121
|
```
|
|
88
122
|
|
|
89
|
-
|
|
123
|
+
## Props
|
|
90
124
|
|
|
91
125
|
These props apply to both `<Resizable>` and `<ResizableBox>`. Unknown props that are not in the list below will be passed to the child component.
|
|
92
126
|
|
|
@@ -96,14 +130,15 @@ type ResizeCallbackData = {
|
|
|
96
130
|
size: {width: number, height: number},
|
|
97
131
|
handle: ResizeHandleAxis
|
|
98
132
|
};
|
|
133
|
+
|
|
99
134
|
type ResizeHandleAxis = 's' | 'w' | 'e' | 'n' | 'sw' | 'nw' | 'se' | 'ne';
|
|
100
135
|
|
|
101
|
-
type ResizableProps =
|
|
102
|
-
{
|
|
136
|
+
type ResizableProps = {
|
|
103
137
|
children: React.Element<any>,
|
|
104
138
|
width: number,
|
|
105
139
|
height: number,
|
|
106
|
-
// Either a ReactElement to be used as handle, or a function
|
|
140
|
+
// Either a ReactElement to be used as handle, or a function
|
|
141
|
+
// returning an element that is fed the handle's location as its first argument.
|
|
107
142
|
handle: ReactElement<any> | (resizeHandle: ResizeHandleAxis, ref: ReactRef<HTMLElement>) => ReactElement<any>,
|
|
108
143
|
// If you change this, be sure to update your css
|
|
109
144
|
handleSize: [number, number] = [10, 10],
|
|
@@ -115,7 +150,9 @@ type ResizableProps =
|
|
|
115
150
|
onResizeStart?: ?(e: SyntheticEvent, data: ResizeCallbackData) => any,
|
|
116
151
|
onResize?: ?(e: SyntheticEvent, data: ResizeCallbackData) => any,
|
|
117
152
|
draggableOpts?: ?Object,
|
|
118
|
-
resizeHandles?: ?Array<ResizeHandleAxis> = ['se']
|
|
153
|
+
resizeHandles?: ?Array<ResizeHandleAxis> = ['se'],
|
|
154
|
+
// If `transform: scale(n)` is set on the parent, this should be set to `n`.
|
|
155
|
+
transformScale?: number = 1
|
|
119
156
|
};
|
|
120
157
|
```
|
|
121
158
|
|
|
@@ -129,15 +166,17 @@ The following props can also be used on `<ResizableBox>`:
|
|
|
129
166
|
|
|
130
167
|
If a `width` or `height` is passed to `<ResizableBox>`'s `style` prop, it will be ignored as it is required for internal function.
|
|
131
168
|
|
|
132
|
-
|
|
169
|
+
You can pass options directly to the underlying `DraggableCore` instance by using the prop `draggableOpts`. See the [demo](https://react-grid-layout.github.io/react-resizable/examples/) for more on this.
|
|
170
|
+
|
|
171
|
+
## Resize Handle
|
|
133
172
|
|
|
134
|
-
If you override the resize handle, we expect that any `ref` passed to your new handle
|
|
173
|
+
If you override the resize handle, we expect that any `ref` passed to your new handle will represent the underlying DOM element.
|
|
135
174
|
|
|
136
175
|
This is required, as `react-resizable` must be able to access the underlying DOM node to attach handlers and measure position deltas.
|
|
137
176
|
|
|
138
177
|
There are a few ways to do this:
|
|
139
178
|
|
|
140
|
-
|
|
179
|
+
### Native DOM Element
|
|
141
180
|
|
|
142
181
|
This requires no special treatment.
|
|
143
182
|
|
|
@@ -145,11 +184,11 @@ This requires no special treatment.
|
|
|
145
184
|
<Resizable handle={<div className="foo" />} />
|
|
146
185
|
```
|
|
147
186
|
|
|
148
|
-
|
|
187
|
+
### Custom React Component
|
|
149
188
|
|
|
150
189
|
You must [forward the ref](https://reactjs.org/docs/forwarding-refs.html) and props to the underlying DOM element.
|
|
151
190
|
|
|
152
|
-
|
|
191
|
+
#### Class Components
|
|
153
192
|
|
|
154
193
|
```js
|
|
155
194
|
class MyHandleComponent extends React.Component {
|
|
@@ -163,7 +202,7 @@ const MyHandle = React.forwardRef((props, ref) => <MyHandleComponent innerRef={r
|
|
|
163
202
|
<Resizable handle={<MyHandle />} />
|
|
164
203
|
```
|
|
165
204
|
|
|
166
|
-
|
|
205
|
+
#### Functional Components
|
|
167
206
|
|
|
168
207
|
```js
|
|
169
208
|
const MyHandle = React.forwardRef((props, ref) => {
|
|
@@ -174,7 +213,7 @@ const MyHandle = React.forwardRef((props, ref) => {
|
|
|
174
213
|
<Resizable handle={<MyHandle />} />
|
|
175
214
|
```
|
|
176
215
|
|
|
177
|
-
|
|
216
|
+
### Custom Function
|
|
178
217
|
|
|
179
218
|
You can define a function as a handle, which will simply receive an axis (see above `ResizeHandleAxis` type) and ref. This may be more clear to read, depending on your coding style.
|
|
180
219
|
|
|
@@ -183,5 +222,9 @@ const MyHandle = (props) => {
|
|
|
183
222
|
return <div ref={props.innerRef} className="foo" {...props} />;
|
|
184
223
|
};
|
|
185
224
|
|
|
186
|
-
<Resizable handle={(handleAxis, ref) => <MyHandle innerRef={ref} className={`foo handle-${handleAxis}`}
|
|
187
|
-
```
|
|
225
|
+
<Resizable handle={(handleAxis, ref) => <MyHandle innerRef={ref} className={`foo handle-${handleAxis}`} />} />
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
## License
|
|
229
|
+
|
|
230
|
+
MIT
|
package/build/propTypes.js
CHANGED
|
@@ -30,7 +30,8 @@ const resizableProps = exports.resizableProps = {
|
|
|
30
30
|
children: _propTypes.default.node,
|
|
31
31
|
disabled: _propTypes.default.bool,
|
|
32
32
|
enableUserSelectHack: _propTypes.default.bool,
|
|
33
|
-
|
|
33
|
+
// #251: Check for Element to support SSR environments where DOM globals don't exist
|
|
34
|
+
offsetParent: typeof Element !== 'undefined' ? _propTypes.default.instanceOf(Element) : _propTypes.default.any,
|
|
34
35
|
grid: _propTypes.default.arrayOf(_propTypes.default.number),
|
|
35
36
|
handle: _propTypes.default.string,
|
|
36
37
|
nodeRef: _propTypes.default.object,
|
package/build/propTypes.js.flow
CHANGED
|
@@ -76,7 +76,8 @@ export const resizableProps: Object = {
|
|
|
76
76
|
children: PropTypes.node,
|
|
77
77
|
disabled: PropTypes.bool,
|
|
78
78
|
enableUserSelectHack: PropTypes.bool,
|
|
79
|
-
|
|
79
|
+
// #251: Check for Element to support SSR environments where DOM globals don't exist
|
|
80
|
+
offsetParent: typeof Element !== 'undefined' ? PropTypes.instanceOf(Element) : PropTypes.any,
|
|
80
81
|
grid: PropTypes.arrayOf(PropTypes.number),
|
|
81
82
|
handle: PropTypes.string,
|
|
82
83
|
nodeRef: PropTypes.object,
|
package/package.json
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-resizable",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.3",
|
|
4
4
|
"description": "A component that is resizable with handles.",
|
|
5
5
|
"main": "index.js",
|
|
6
|
+
"files": [
|
|
7
|
+
"build/",
|
|
8
|
+
"css/",
|
|
9
|
+
"index.js"
|
|
10
|
+
],
|
|
6
11
|
"scripts": {
|
|
7
12
|
"lint": "eslint lib/ __tests__/ setupTests/; flow",
|
|
8
13
|
"test": "jest --coverage",
|
|
@@ -18,7 +23,7 @@
|
|
|
18
23
|
},
|
|
19
24
|
"repository": {
|
|
20
25
|
"type": "git",
|
|
21
|
-
"url": "git@github.com
|
|
26
|
+
"url": "git+ssh://git@github.com/react-grid-layout/react-resizable.git"
|
|
22
27
|
},
|
|
23
28
|
"keywords": [
|
|
24
29
|
"react",
|
package/.babelrc
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"presets": [
|
|
3
|
-
[
|
|
4
|
-
"@babel/preset-env",
|
|
5
|
-
{
|
|
6
|
-
"loose": true
|
|
7
|
-
}
|
|
8
|
-
],
|
|
9
|
-
"@babel/preset-react",
|
|
10
|
-
"@babel/preset-flow"
|
|
11
|
-
],
|
|
12
|
-
"plugins": [
|
|
13
|
-
["@babel/plugin-proposal-class-properties", {"loose": true}],
|
|
14
|
-
"@babel/plugin-proposal-object-rest-spread"
|
|
15
|
-
]
|
|
16
|
-
}
|
package/.browserslistrc
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"permissions": {
|
|
3
|
-
"allow": [
|
|
4
|
-
"WebFetch(domain:github.com)",
|
|
5
|
-
"Bash(npx jest:*)",
|
|
6
|
-
"Bash(git tag:*)",
|
|
7
|
-
"Bash(gh release create:*)",
|
|
8
|
-
"Bash(gh issue close:*)",
|
|
9
|
-
"Bash(gh search:*)",
|
|
10
|
-
"WebFetch(domain:raw.githubusercontent.com)",
|
|
11
|
-
"Bash(curl:*)"
|
|
12
|
-
]
|
|
13
|
-
},
|
|
14
|
-
"enableAllProjectMcpServers": true,
|
|
15
|
-
"enabledMcpjsonServers": [
|
|
16
|
-
"messenger"
|
|
17
|
-
]
|
|
18
|
-
}
|
package/.flowconfig
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
[version]
|
|
2
|
-
^0.153.0
|
|
3
|
-
|
|
4
|
-
[ignore]
|
|
5
|
-
.*/node_modules/@babel.*
|
|
6
|
-
.*/node_modules/.*/malformed_package_json/.*
|
|
7
|
-
<PROJECT_ROOT>/build/.*
|
|
8
|
-
|
|
9
|
-
[include]
|
|
10
|
-
|
|
11
|
-
[libs]
|
|
12
|
-
flow-typed
|
|
13
|
-
|
|
14
|
-
[lints]
|
|
15
|
-
all=warn
|
|
16
|
-
implicit-inexact-object=error
|
|
17
|
-
|
|
18
|
-
[options]
|
|
19
|
-
suppress_type=$FlowFixMe
|
|
20
|
-
experimental.strict_call_arity=true
|
|
21
|
-
module.system.node.allow_root_relative=true
|
|
22
|
-
module.use_strict=true
|
|
23
|
-
server.max_workers=6
|
|
24
|
-
exact_by_default=true
|
|
25
|
-
sharedmemory.heap_size=3221225472
|
package/.packj.yaml
DELETED
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
#
|
|
2
|
-
# Audit policies
|
|
3
|
-
#
|
|
4
|
-
audit:
|
|
5
|
-
alerts:
|
|
6
|
-
#
|
|
7
|
-
# category: malicious packages (publicly known and unknown)
|
|
8
|
-
#
|
|
9
|
-
malicious:
|
|
10
|
-
contains known malware:
|
|
11
|
-
- reason: package is known to contain a dangerous malware
|
|
12
|
-
- enabled: true
|
|
13
|
-
typo-squatting or repo-jacking package:
|
|
14
|
-
- reason: package impersonates another popular package to propagate malware
|
|
15
|
-
- enabled: true
|
|
16
|
-
|
|
17
|
-
#
|
|
18
|
-
# alert category: suspicious packages (potentially malicious)
|
|
19
|
-
#
|
|
20
|
-
suspicious:
|
|
21
|
-
inconsistent with repo source:
|
|
22
|
-
- reason: package code inconsistent with the public repo source code
|
|
23
|
-
- enabled: false # WIP
|
|
24
|
-
overwrites system binaries:
|
|
25
|
-
- reason: package code inconsistent with the public repo source code
|
|
26
|
-
- enabled: false # WIP
|
|
27
|
-
|
|
28
|
-
#
|
|
29
|
-
# alert category: packages vulnerable to code exploits
|
|
30
|
-
#
|
|
31
|
-
vulnerable:
|
|
32
|
-
contains known vulnerabilities:
|
|
33
|
-
- reason: known vulnerabilities (CVEs) in package code could be exploited
|
|
34
|
-
- enabled: true
|
|
35
|
-
insecure network communication:
|
|
36
|
-
- reason: package code uses insecure network communication (not https)
|
|
37
|
-
- enabled: false # WIP
|
|
38
|
-
|
|
39
|
-
#
|
|
40
|
-
# packages with undesirable or "risky" attributes
|
|
41
|
-
#
|
|
42
|
-
undesirable:
|
|
43
|
-
package is old or abandoned:
|
|
44
|
-
- reason: old or abandoned packages receive no security updates and are risky
|
|
45
|
-
- enabled: true
|
|
46
|
-
|
|
47
|
-
invalid or no author email:
|
|
48
|
-
- reason: a package with lack of or invalid author email suggests 2FA not enabled
|
|
49
|
-
- enabled: true
|
|
50
|
-
|
|
51
|
-
invalid or no homepage:
|
|
52
|
-
- reason: a package with no or invalid homepage may not be preferable
|
|
53
|
-
- enabled: false
|
|
54
|
-
|
|
55
|
-
no source repo:
|
|
56
|
-
- reason: lack of public source repo may suggest malicious intention
|
|
57
|
-
- enabled: true
|
|
58
|
-
|
|
59
|
-
fewer downloads:
|
|
60
|
-
- reason: a package with few downloads may not be preferable
|
|
61
|
-
- enabled: true
|
|
62
|
-
|
|
63
|
-
no or insufficient readme:
|
|
64
|
-
- reason: a package with lack of documentation may not be preferable
|
|
65
|
-
- enabled: false
|
|
66
|
-
|
|
67
|
-
fewer versions or releases:
|
|
68
|
-
- reason: few versions suggest unstable or inactive project
|
|
69
|
-
- enabled: true
|
|
70
|
-
|
|
71
|
-
too many dependencies:
|
|
72
|
-
- reason: too many dependencies increase attack surface
|
|
73
|
-
- enabled: false
|
|
74
|
-
|
|
75
|
-
version release after a long gap:
|
|
76
|
-
- reason: a release after a long time may indicate account hijacking
|
|
77
|
-
- enabled: false
|
|
78
|
-
|
|
79
|
-
contains custom installation hooks:
|
|
80
|
-
- reason: custom installation hooks may download or execute malicious code
|
|
81
|
-
- enabled: false # WIP
|
|
82
|
-
|
|
83
|
-
#
|
|
84
|
-
# type: repo stats
|
|
85
|
-
#
|
|
86
|
-
few source repo stars:
|
|
87
|
-
- reason: a package with few repo stars may not be preferable
|
|
88
|
-
- enabled: false
|
|
89
|
-
|
|
90
|
-
few source repo forks:
|
|
91
|
-
- reason: a package with few repo forks may not be preferable
|
|
92
|
-
- enabled: false
|
|
93
|
-
|
|
94
|
-
forked source repo:
|
|
95
|
-
- reason: a forked copy of a popular package may contain malicious code
|
|
96
|
-
- enabled: true
|
|
97
|
-
|
|
98
|
-
#
|
|
99
|
-
# type: APIs and permissions
|
|
100
|
-
#
|
|
101
|
-
generates new code:
|
|
102
|
-
- reason: package generates new code at runtime, which could be malicious
|
|
103
|
-
- enabled: false
|
|
104
|
-
forks or exits OS processes:
|
|
105
|
-
- reason: package spawns new operating system processes, which could be malicious
|
|
106
|
-
- enabled: false
|
|
107
|
-
accesses obfuscated (hidden) code:
|
|
108
|
-
- enabled: true
|
|
109
|
-
accesses environment variables:
|
|
110
|
-
- enabled: false
|
|
111
|
-
changes system/environment variables:
|
|
112
|
-
- enabled: false
|
|
113
|
-
accesses files and dirs:
|
|
114
|
-
- enabled: false
|
|
115
|
-
communicates with external network:
|
|
116
|
-
- enabled: false
|
|
117
|
-
reads user input:
|
|
118
|
-
- enabled: false
|
|
119
|
-
|
|
120
|
-
#
|
|
121
|
-
# Sandboxing policies
|
|
122
|
-
#
|
|
123
|
-
sandbox:
|
|
124
|
-
rules:
|
|
125
|
-
#
|
|
126
|
-
# File system (allow or block accesses to file/dirs)
|
|
127
|
-
#
|
|
128
|
-
# ~/ represents home dir
|
|
129
|
-
# . represents cwd dir
|
|
130
|
-
#
|
|
131
|
-
# NOTE: only ONE 'allow' and 'block' lines are allowed
|
|
132
|
-
#
|
|
133
|
-
fs:
|
|
134
|
-
# TODO: customize as per your threat model
|
|
135
|
-
|
|
136
|
-
# block access to home dir and all other locations (except the ones below)
|
|
137
|
-
block: ~/, /
|
|
138
|
-
allow: ., ~/.cache, ~/.npm, ~/.local, ~/.ruby, /tmp, /proc, /etc, /var, /bin, /usr/include, /usr/local, /usr/bin, /usr/lib, /usr/share, /lib
|
|
139
|
-
|
|
140
|
-
#
|
|
141
|
-
# Network (allow or block domains/ports)
|
|
142
|
-
#
|
|
143
|
-
# NOTE: only ONE 'allow' and 'block' lines are allowed
|
|
144
|
-
#
|
|
145
|
-
network:
|
|
146
|
-
|
|
147
|
-
# TODO: customize as per your threat model
|
|
148
|
-
|
|
149
|
-
# block all external network communication (except the ones below)
|
|
150
|
-
block: 0.0.0.0
|
|
151
|
-
|
|
152
|
-
# For NPM packages
|
|
153
|
-
allow: registry.yarnpkg.com:0, npmjs.org:0, npmjs.com:0
|