@lazy-sol/access-control 1.1.4 → 1.1.5

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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ v1.1.5: npm packages update
2
+ - Resolved 12 vulnerabilities (6 low, 2 high, 4 critical)
3
+ - Fixed some English grammar in the UI
4
+ - Changed the display format of the connected address to checked summed
5
+
6
+ v1.1.4: npm packages update
7
+
1
8
  v1.1.3: Prem's audit and its resolution
2
9
  - See the list of issues found and resolved in [the audit resolution doc](./audits/1.1_Prem_resolution.md)
3
10
  - See the audit methodology and issues found in [the original audit report](./audits/1.1_final_Prem.pdf)
@@ -0,0 +1,297 @@
1
+ {
2
+ "_format": "hh-sol-artifact-1",
3
+ "contractName": "OwnableToAccessControlAdapter",
4
+ "sourceName": "contracts/OwnableToAccessControlAdapter.sol",
5
+ "abi": [
6
+ {
7
+ "inputs": [
8
+ {
9
+ "internalType": "address",
10
+ "name": "_target",
11
+ "type": "address"
12
+ },
13
+ {
14
+ "internalType": "address",
15
+ "name": "_owner",
16
+ "type": "address"
17
+ }
18
+ ],
19
+ "stateMutability": "nonpayable",
20
+ "type": "constructor"
21
+ },
22
+ {
23
+ "inputs": [],
24
+ "name": "AccessDenied",
25
+ "type": "error"
26
+ },
27
+ {
28
+ "anonymous": false,
29
+ "inputs": [
30
+ {
31
+ "indexed": true,
32
+ "internalType": "bytes4",
33
+ "name": "selector",
34
+ "type": "bytes4"
35
+ },
36
+ {
37
+ "indexed": false,
38
+ "internalType": "uint256",
39
+ "name": "role",
40
+ "type": "uint256"
41
+ }
42
+ ],
43
+ "name": "AccessRoleUpdated",
44
+ "type": "event"
45
+ },
46
+ {
47
+ "anonymous": false,
48
+ "inputs": [
49
+ {
50
+ "indexed": true,
51
+ "internalType": "bytes4",
52
+ "name": "selector",
53
+ "type": "bytes4"
54
+ },
55
+ {
56
+ "indexed": false,
57
+ "internalType": "uint256",
58
+ "name": "roleRequired",
59
+ "type": "uint256"
60
+ },
61
+ {
62
+ "indexed": false,
63
+ "internalType": "bytes",
64
+ "name": "data",
65
+ "type": "bytes"
66
+ },
67
+ {
68
+ "indexed": false,
69
+ "internalType": "bytes",
70
+ "name": "result",
71
+ "type": "bytes"
72
+ }
73
+ ],
74
+ "name": "ExecutionComplete",
75
+ "type": "event"
76
+ },
77
+ {
78
+ "anonymous": false,
79
+ "inputs": [
80
+ {
81
+ "indexed": true,
82
+ "internalType": "address",
83
+ "name": "by",
84
+ "type": "address"
85
+ },
86
+ {
87
+ "indexed": true,
88
+ "internalType": "address",
89
+ "name": "operator",
90
+ "type": "address"
91
+ },
92
+ {
93
+ "indexed": false,
94
+ "internalType": "uint256",
95
+ "name": "requested",
96
+ "type": "uint256"
97
+ },
98
+ {
99
+ "indexed": false,
100
+ "internalType": "uint256",
101
+ "name": "assigned",
102
+ "type": "uint256"
103
+ }
104
+ ],
105
+ "name": "RoleUpdated",
106
+ "type": "event"
107
+ },
108
+ {
109
+ "stateMutability": "payable",
110
+ "type": "fallback"
111
+ },
112
+ {
113
+ "inputs": [],
114
+ "name": "ROLE_ACCESS_MANAGER",
115
+ "outputs": [
116
+ {
117
+ "internalType": "uint256",
118
+ "name": "",
119
+ "type": "uint256"
120
+ }
121
+ ],
122
+ "stateMutability": "view",
123
+ "type": "function"
124
+ },
125
+ {
126
+ "inputs": [],
127
+ "name": "ROLE_ACCESS_ROLES_MANAGER",
128
+ "outputs": [
129
+ {
130
+ "internalType": "uint256",
131
+ "name": "",
132
+ "type": "uint256"
133
+ }
134
+ ],
135
+ "stateMutability": "view",
136
+ "type": "function"
137
+ },
138
+ {
139
+ "inputs": [
140
+ {
141
+ "internalType": "bytes4",
142
+ "name": "",
143
+ "type": "bytes4"
144
+ }
145
+ ],
146
+ "name": "accessRoles",
147
+ "outputs": [
148
+ {
149
+ "internalType": "uint256",
150
+ "name": "",
151
+ "type": "uint256"
152
+ }
153
+ ],
154
+ "stateMutability": "view",
155
+ "type": "function"
156
+ },
157
+ {
158
+ "inputs": [
159
+ {
160
+ "internalType": "bytes",
161
+ "name": "data",
162
+ "type": "bytes"
163
+ }
164
+ ],
165
+ "name": "execute",
166
+ "outputs": [
167
+ {
168
+ "internalType": "bytes",
169
+ "name": "",
170
+ "type": "bytes"
171
+ }
172
+ ],
173
+ "stateMutability": "payable",
174
+ "type": "function"
175
+ },
176
+ {
177
+ "inputs": [],
178
+ "name": "features",
179
+ "outputs": [
180
+ {
181
+ "internalType": "uint256",
182
+ "name": "",
183
+ "type": "uint256"
184
+ }
185
+ ],
186
+ "stateMutability": "view",
187
+ "type": "function"
188
+ },
189
+ {
190
+ "inputs": [
191
+ {
192
+ "internalType": "address",
193
+ "name": "operator",
194
+ "type": "address"
195
+ }
196
+ ],
197
+ "name": "getRole",
198
+ "outputs": [
199
+ {
200
+ "internalType": "uint256",
201
+ "name": "",
202
+ "type": "uint256"
203
+ }
204
+ ],
205
+ "stateMutability": "view",
206
+ "type": "function"
207
+ },
208
+ {
209
+ "inputs": [],
210
+ "name": "target",
211
+ "outputs": [
212
+ {
213
+ "internalType": "address",
214
+ "name": "",
215
+ "type": "address"
216
+ }
217
+ ],
218
+ "stateMutability": "view",
219
+ "type": "function"
220
+ },
221
+ {
222
+ "inputs": [
223
+ {
224
+ "internalType": "bytes4",
225
+ "name": "selector",
226
+ "type": "bytes4"
227
+ },
228
+ {
229
+ "internalType": "uint256",
230
+ "name": "role",
231
+ "type": "uint256"
232
+ }
233
+ ],
234
+ "name": "updateAccessRole",
235
+ "outputs": [],
236
+ "stateMutability": "nonpayable",
237
+ "type": "function"
238
+ },
239
+ {
240
+ "inputs": [
241
+ {
242
+ "internalType": "string",
243
+ "name": "signature",
244
+ "type": "string"
245
+ },
246
+ {
247
+ "internalType": "uint256",
248
+ "name": "role",
249
+ "type": "uint256"
250
+ }
251
+ ],
252
+ "name": "updateAccessRole",
253
+ "outputs": [],
254
+ "stateMutability": "nonpayable",
255
+ "type": "function"
256
+ },
257
+ {
258
+ "inputs": [
259
+ {
260
+ "internalType": "uint256",
261
+ "name": "_mask",
262
+ "type": "uint256"
263
+ }
264
+ ],
265
+ "name": "updateFeatures",
266
+ "outputs": [],
267
+ "stateMutability": "nonpayable",
268
+ "type": "function"
269
+ },
270
+ {
271
+ "inputs": [
272
+ {
273
+ "internalType": "address",
274
+ "name": "operator",
275
+ "type": "address"
276
+ },
277
+ {
278
+ "internalType": "uint256",
279
+ "name": "role",
280
+ "type": "uint256"
281
+ }
282
+ ],
283
+ "name": "updateRole",
284
+ "outputs": [],
285
+ "stateMutability": "nonpayable",
286
+ "type": "function"
287
+ },
288
+ {
289
+ "stateMutability": "payable",
290
+ "type": "receive"
291
+ }
292
+ ],
293
+ "bytecode": "0x60a060405234801561001057600080fd5b50604051610b42380380610b4283398101604081905261002f9161016d565b8060006001600160a01b0382161561004e5761004e82600019806100f7565b6100593082806100f7565b50506001600160a01b0382166100a55760405162461bcd60e51b815260206004820152600c60248201526b7a65726f206164647265737360a01b60448201526064015b60405180910390fd5b816001600160a01b03163b6000036100e55760405162461bcd60e51b8152602060048201526003602482015262454f4160e81b604482015260640161009c565b506001600160a01b03166080526101a0565b6001600160a01b03831660008181526020818152604091829020849055815185815290810184905233917f5a10526456f5116c0b7b80582c217d666243fd51b6a2d92c8011e601c2462e5f910160405180910390a3505050565b80516001600160a01b038116811461016857600080fd5b919050565b6000806040838503121561018057600080fd5b61018983610151565b915061019760208401610151565b90509250929050565b6080516109806101c26000396000818161025d015261034a01526109806000f3fe6080604052600436106100a05760003560e01c8063491d261111610064578063491d2611146101d35780635defb40d146101f3578063ae5b102e14610213578063ae682e2e14610233578063d4b839921461024b578063d5bb7f6714610297576100bf565b806309c5eabe146100ff5780630e82fe25146101285780632b5214161461016357806334e48c9e14610185578063442767331461019d576100bf565b366100bf576100bd604051806020016040528060008152506102b7565b005b6100bd6000368080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506102b792505050565b61011261010d366004610723565b6102b7565b60405161011f91906107c4565b60405180910390f35b34801561013457600080fd5b506101556101433660046107f4565b60016020526000908152604090205481565b60405190815260200161011f565b34801561016f57600080fd5b5030600090815260208190526040902054610155565b34801561019157600080fd5b50610155600160fd1b81565b3480156101a957600080fd5b506101556101b8366004610826565b6001600160a01b031660009081526020819052604090205490565b3480156101df57600080fd5b506100bd6101ee366004610841565b610421565b3480156101ff57600080fd5b506100bd61020e36600461086b565b61042f565b34801561021f57600080fd5b506100bd61022e3660046108c4565b610440565b34801561023f57600080fd5b50610155600160ff1b81565b34801561025757600080fd5b5061027f7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161011f565b3480156102a357600080fd5b506100bd6102b23660046108e0565b61044a565b6060600082516000146102d2576102cd83610457565b6102d5565b60005b6001600160e01b0319811660009081526001602052604081205491925081900361033c5760405162461bcd60e51b81526020600482015260136024820152721858d8d95cdcc81c9bdb19481b9bdd081cd95d606a1b60448201526064015b60405180910390fd5b610345816104a2565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316348760405161038191906108f9565b60006040518083038185875af1925050503d80600081146103be576040519150601f19603f3d011682016040523d82523d6000602084013e6103c3565b606091505b50915091506103d282826104b3565b836001600160e01b0319167faeab73ac4708d07b7b6bd6ebb2c0cea23453b4cfaffcac887aade0e39091bb6e84888460405161041093929190610915565b60405180910390a295945050505050565b61042b82826104ea565b5050565b61042b8280519060200120826104ea565b61042b8282610551565b6104543082610551565b50565b600060048251101561049a5760405162461bcd60e51b815260206004820152600c60248201526b3130b21039b2b632b1ba37b960a11b6044820152606401610333565b506020015190565b6104546104ae826105ba565b6105cc565b8161042b5761042b816040518060400160405280601081526020016f195e1958dd5d1a5bdb8819985a5b195960821b8152506105ea565b6104f7600160fd1b6104a2565b6001600160e01b0319821660008181526001602052604090819020839055517fdb8ed917742b49e83acd1322bcaa8f18b1e5f78a70784c43ea14db7ab50e628d906105459084815260200190565b60405180910390a25050565b61055e600160ff1b6104a2565b61042b82826105b533610586876001600160a01b031660009081526020819052604090205490565b6001600160a01b0391909116600090815260208190526040902054600019808818821618908716919091171690565b610614565b60006105c6338361066e565b92915050565b8061045457604051634ca8886760e01b815260040160405180910390fd5b8151156105fa5781518083602001fd5b8060405162461bcd60e51b815260040161033391906107c4565b6001600160a01b03831660008181526020818152604091829020849055815185815290810184905233917f5a10526456f5116c0b7b80582c217d666243fd51b6a2d92c8011e601c2462e5f910160405180910390a3505050565b6001600160a01b038216600090815260208190526040812054821682145b9392505050565b634e487b7160e01b600052604160045260246000fd5b60008067ffffffffffffffff8411156106c4576106c4610693565b50604051601f19601f85018116603f0116810181811067ffffffffffffffff821117156106f3576106f3610693565b60405283815290508082840185101561070b57600080fd5b83836020830137600060208583010152509392505050565b60006020828403121561073557600080fd5b813567ffffffffffffffff81111561074c57600080fd5b8201601f8101841361075d57600080fd5b61076c848235602084016106a9565b949350505050565b60005b8381101561078f578181015183820152602001610777565b50506000910152565b600081518084526107b0816020860160208601610774565b601f01601f19169290920160200192915050565b60208152600061068c6020830184610798565b80356001600160e01b0319811681146107ef57600080fd5b919050565b60006020828403121561080657600080fd5b61068c826107d7565b80356001600160a01b03811681146107ef57600080fd5b60006020828403121561083857600080fd5b61068c8261080f565b6000806040838503121561085457600080fd5b61085d836107d7565b946020939093013593505050565b6000806040838503121561087e57600080fd5b823567ffffffffffffffff81111561089557600080fd5b8301601f810185136108a657600080fd5b6108b5858235602084016106a9565b95602094909401359450505050565b600080604083850312156108d757600080fd5b61085d8361080f565b6000602082840312156108f257600080fd5b5035919050565b6000825161090b818460208701610774565b9190910192915050565b83815260606020820152600061092e6060830185610798565b82810360408401526109408185610798565b969550505050505056fea2646970667358221220485384b54439e8a977182177430875bb4970bdaf23d9dbc6c70120529074eca864736f6c634300081c0033",
294
+ "deployedBytecode": "0x6080604052600436106100a05760003560e01c8063491d261111610064578063491d2611146101d35780635defb40d146101f3578063ae5b102e14610213578063ae682e2e14610233578063d4b839921461024b578063d5bb7f6714610297576100bf565b806309c5eabe146100ff5780630e82fe25146101285780632b5214161461016357806334e48c9e14610185578063442767331461019d576100bf565b366100bf576100bd604051806020016040528060008152506102b7565b005b6100bd6000368080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506102b792505050565b61011261010d366004610723565b6102b7565b60405161011f91906107c4565b60405180910390f35b34801561013457600080fd5b506101556101433660046107f4565b60016020526000908152604090205481565b60405190815260200161011f565b34801561016f57600080fd5b5030600090815260208190526040902054610155565b34801561019157600080fd5b50610155600160fd1b81565b3480156101a957600080fd5b506101556101b8366004610826565b6001600160a01b031660009081526020819052604090205490565b3480156101df57600080fd5b506100bd6101ee366004610841565b610421565b3480156101ff57600080fd5b506100bd61020e36600461086b565b61042f565b34801561021f57600080fd5b506100bd61022e3660046108c4565b610440565b34801561023f57600080fd5b50610155600160ff1b81565b34801561025757600080fd5b5061027f7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161011f565b3480156102a357600080fd5b506100bd6102b23660046108e0565b61044a565b6060600082516000146102d2576102cd83610457565b6102d5565b60005b6001600160e01b0319811660009081526001602052604081205491925081900361033c5760405162461bcd60e51b81526020600482015260136024820152721858d8d95cdcc81c9bdb19481b9bdd081cd95d606a1b60448201526064015b60405180910390fd5b610345816104a2565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316348760405161038191906108f9565b60006040518083038185875af1925050503d80600081146103be576040519150601f19603f3d011682016040523d82523d6000602084013e6103c3565b606091505b50915091506103d282826104b3565b836001600160e01b0319167faeab73ac4708d07b7b6bd6ebb2c0cea23453b4cfaffcac887aade0e39091bb6e84888460405161041093929190610915565b60405180910390a295945050505050565b61042b82826104ea565b5050565b61042b8280519060200120826104ea565b61042b8282610551565b6104543082610551565b50565b600060048251101561049a5760405162461bcd60e51b815260206004820152600c60248201526b3130b21039b2b632b1ba37b960a11b6044820152606401610333565b506020015190565b6104546104ae826105ba565b6105cc565b8161042b5761042b816040518060400160405280601081526020016f195e1958dd5d1a5bdb8819985a5b195960821b8152506105ea565b6104f7600160fd1b6104a2565b6001600160e01b0319821660008181526001602052604090819020839055517fdb8ed917742b49e83acd1322bcaa8f18b1e5f78a70784c43ea14db7ab50e628d906105459084815260200190565b60405180910390a25050565b61055e600160ff1b6104a2565b61042b82826105b533610586876001600160a01b031660009081526020819052604090205490565b6001600160a01b0391909116600090815260208190526040902054600019808818821618908716919091171690565b610614565b60006105c6338361066e565b92915050565b8061045457604051634ca8886760e01b815260040160405180910390fd5b8151156105fa5781518083602001fd5b8060405162461bcd60e51b815260040161033391906107c4565b6001600160a01b03831660008181526020818152604091829020849055815185815290810184905233917f5a10526456f5116c0b7b80582c217d666243fd51b6a2d92c8011e601c2462e5f910160405180910390a3505050565b6001600160a01b038216600090815260208190526040812054821682145b9392505050565b634e487b7160e01b600052604160045260246000fd5b60008067ffffffffffffffff8411156106c4576106c4610693565b50604051601f19601f85018116603f0116810181811067ffffffffffffffff821117156106f3576106f3610693565b60405283815290508082840185101561070b57600080fd5b83836020830137600060208583010152509392505050565b60006020828403121561073557600080fd5b813567ffffffffffffffff81111561074c57600080fd5b8201601f8101841361075d57600080fd5b61076c848235602084016106a9565b949350505050565b60005b8381101561078f578181015183820152602001610777565b50506000910152565b600081518084526107b0816020860160208601610774565b601f01601f19169290920160200192915050565b60208152600061068c6020830184610798565b80356001600160e01b0319811681146107ef57600080fd5b919050565b60006020828403121561080657600080fd5b61068c826107d7565b80356001600160a01b03811681146107ef57600080fd5b60006020828403121561083857600080fd5b61068c8261080f565b6000806040838503121561085457600080fd5b61085d836107d7565b946020939093013593505050565b6000806040838503121561087e57600080fd5b823567ffffffffffffffff81111561089557600080fd5b8301601f810185136108a657600080fd5b6108b5858235602084016106a9565b95602094909401359450505050565b600080604083850312156108d757600080fd5b61085d8361080f565b6000602082840312156108f257600080fd5b5035919050565b6000825161090b818460208701610774565b9190910192915050565b83815260606020820152600061092e6060830185610798565b82810360408401526109408185610798565b969550505050505056fea2646970667358221220485384b54439e8a977182177430875bb4970bdaf23d9dbc6c70120529074eca864736f6c634300081c0033",
295
+ "linkReferences": {},
296
+ "deployedLinkReferences": {}
297
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lazy-sol/access-control",
3
- "version": "1.1.4",
3
+ "version": "1.1.5",
4
4
  "description": "Enable the modular plug and play (PnP) architecture for your dapp by incorporating the role-based access control (RBAC) into the smart contracts",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -22,10 +22,10 @@
22
22
  "author": "Basil Gorin",
23
23
  "license": "MIT",
24
24
  "devDependencies": {
25
- "@lazy-sol/a-missing-gem": "^1.0.12",
26
- "@lazy-sol/zeppelin-test-helpers": "^1.0.5",
27
- "@nomiclabs/hardhat-truffle5": "^2.0.7",
28
- "hardhat": "^2.25.0",
25
+ "@lazy-sol/a-missing-gem": "^1.0.14",
26
+ "@lazy-sol/zeppelin-test-helpers": "^1.0.6",
27
+ "@nomiclabs/hardhat-truffle5": "^2.1.0",
28
+ "hardhat": "^2.26.3",
29
29
  "hardhat-deploy": "^0.11.45",
30
30
  "hardhat-gas-reporter": "^1.0.10",
31
31
  "solidity-coverage": "^0.8.16"
@@ -34,8 +34,10 @@
34
34
  "axios": ">=1.7.5",
35
35
  "cookie": ">=0.7.0",
36
36
  "elliptic": "^6.6.0",
37
+ "form-data": "^2.5.4",
37
38
  "micromatch": "^4.0.8",
38
39
  "tar": "^6.2.1",
40
+ "tmp": "^0.2.4",
39
41
  "tough-cookie": "^4.1.3",
40
42
  "yargs-parser": "^5.0.1",
41
43
  "ws": "^8.0.0"
package/ui.html CHANGED
@@ -146,7 +146,7 @@ const CONF = {
146
146
  // due to the async nature of the app, many incoming events, it makes sense to follow
147
147
  // the state of the app by listening to all the events and updating the state
148
148
  const STATE = {
149
- // currently connected network (recognized decimal Chain ID)
149
+ // the currently connected network (recognized decimal Chain ID)
150
150
  chain_id: undefined,
151
151
  // currently connected account (accounts[0])
152
152
  A0: undefined,
@@ -158,14 +158,14 @@ const STATE = {
158
158
  update_chain_id: function(chain_id) {
159
159
  this.chain_id = chain_id? parseInt(chain_id): undefined;
160
160
  },
161
- // function to update currently connected account
161
+ // function to update the currently connected account
162
162
  update_A0: function(accounts) {
163
163
  // MetaMask is locked or not connected
164
164
  if(!accounts || !accounts.length) {
165
165
  this.A0 = undefined;
166
166
  }
167
167
  else {
168
- [this.A0] = accounts;
168
+ [this.A0] = accounts.map(web3.utils.toChecksumAddress);
169
169
  }
170
170
  },
171
171
  // function to refresh the connection state UI
@@ -223,7 +223,7 @@ function metamask_connect() {
223
223
 
224
224
  // check if MetaMask is connected
225
225
  ethereum.request({ method: 'eth_accounts' }).then(function(accounts) {
226
- // check current connected network
226
+ // check the current connected network
227
227
  ethereum.request({ method: 'eth_chainId' }).then(function(chain_id) {
228
228
  STATE.update_chain_id(chain_id);
229
229
  STATE.update_A0(accounts);
@@ -263,7 +263,7 @@ ethereum.on('disconnect', function(error) {
263
263
 
264
264
  // network switch listener
265
265
  ethereum.on('chainChanged', function(chain_id) {
266
- console.log('network has been changed', chain_id)
266
+ console.log('the network has been changed', chain_id)
267
267
  STATE.update_chain_id(chain_id);
268
268
  STATE.refresh_ui();
269
269
  reload_main_app();