You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Added AES encryption/decryption using native crypto (#15)
* add native AES file encryption
* removed update of package.json
* update package.json
* update node in travis
* update node in travis
* trying different verion of key and iv hash
* downgrading node to match minimal parse-server
* removed commented code
* add random iv for each file instead of using constant. Also removed encrypted option, will encrypt automatically if secretKey is provided
* remove unneccesary files
* Use AES 256 GCM to detect file tampering
* remove codecov from package.json
* add repo field to get rid of npm install warning
* Fix options
* switch secretKey to fileKey
* added the ability to rotate fileKeys
* add syntax highlighting to readme
* bump version
* attempt to fix coverage
* update testcase title
* clean up unused vars
* add directions for multiple instances of parse-server
* update readme
* update file names in readme
* add testcase for rotating key from oldKey to noKey leaving all files decrypted
* Add notice about previous versions of parse-server
* Update README.md
* Update README.md
* Update README.md
* Update README.md
* make createFile and getFile use streams instead of putting whole file in memory
* don't read file into memory while deleting
* clean up code
* make more consistant with GridFS adapter
* fixed formatting
* Update .travis.yml
* Remove unnecessary testcase
The test is already covered in parse-server-conformance-tests
* Update secureFiles.spec.js
* add directions for dev server to readme
* Revert version
* Update package.json
* Update .travis.yml
When using parse-server-fs-adapter across multiple parse-server instances it's important to establish "centralization" of your file storage (this is the same premise as the other file adapters, you are sending/recieving files through a dedicated link). You can accomplish this at the file storage level by Samba mounting (or any other type of mounting) your storage to each of your parse-server instances, e.g if you are using parse-server via docker (volume mount your SMB drive to `- /Volumes/SMB-Drive/MyParseApp1/files:/parse-server/files`). All parse-server instances need to be able to read and write to the same storage in order for parse-server-fs-adapter to work properly with parse-server. If the file storage isn't centralized, parse-server will have trouble locating files and you will get random behavior on client-side.
"fileKey":"someKey"//optional, but mandatory if you want to encrypt files
25
29
}
26
30
}
27
31
}
28
32
```
29
33
30
-
### passing as an instance
34
+
### Passing as an instance
35
+
***Notice: If used with parse-server versions <= 4.2.0, DO NOT PASS in `PARSE_SERVER_FILE_KEY` or `fileKey` from parse-server. Instead pass your key directly to `FSFilesAdapter` using your own environment variable or hardcoding the string. parse-server versions > 4.2.0 can pass in `PARSE_SERVER_FILE_KEY` or `fileKey`.***
36
+
37
+
```javascript
38
+
var FSFilesAdapter =require('@parse/fs-files-adapter');
"fileKey":"someKey"//optional, but mandatory if you want to encrypt files
43
+
});
31
44
45
+
var api =newParseServer({
46
+
appId:'my_app',
47
+
masterKey:'master_key',
48
+
filesAdapter: fsAdapter
49
+
})
32
50
```
51
+
52
+
### Rotating to a new fileKey
53
+
Periodically you may want to rotate your fileKey for security reasons. When this is the case, you can start up a development parse-server that has the same configuration as your production server. In the development server, initialize the file adapter with the new key and do the following in your `index.js`:
54
+
55
+
#### Files were previously unencrypted and you want to encrypt
56
+
```javascript
33
57
var FSFilesAdapter =require('@parse/fs-files-adapter');
console.log('Files rotated to newKey:' + rotated);
86
+
console.log('Files that couldn't be rotated to newKey: '+ notRotated);
87
+
```
88
+
89
+
#### Only rotate a select list of files that were previously encrypted with `oldKey` and you want to encrypt with `newKey`
90
+
This is useful if for some reason there errors and some of the files werent rotated and returned in `notRotated`. The same process as above, but pass in your `oldKey` along with the array of `fileNames` to `rotateFileKey()`.
91
+
```javascript
92
+
//This can take awhile depending on how many files and how larger they are. It will attempt to rotate the key of all files in your filesSubDirectory
0 commit comments