@quenty/datastore 7.4.1 → 7.5.0

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
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [7.5.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/datastore@7.4.1...@quenty/datastore@7.5.0) (2023-01-17)
7
+
8
+
9
+ ### Features
10
+
11
+ * Add DataStoreStringUtils.isValidUTF8(str) ([d3b245a](https://github.com/Quenty/NevermoreEngine/commit/d3b245a8fbd469ec51fb973a72cefc868e94c99a))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [7.4.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/datastore@7.4.0...@quenty/datastore@7.4.1) (2023-01-03)
7
18
 
8
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/datastore",
3
- "version": "7.4.1",
3
+ "version": "7.5.0",
4
4
  "description": "Quenty's Datastore implementation for Roblox",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -38,5 +38,5 @@
38
38
  "publishConfig": {
39
39
  "access": "public"
40
40
  },
41
- "gitHead": "8f4aef032ba8bb0e3b3e576df73d921cc1ac545b"
41
+ "gitHead": "a89a3f27cad25767cd645b91cdc2a2881afeecd5"
42
42
  }
@@ -0,0 +1,30 @@
1
+ --[=[
2
+ Utility methods to validate strings which can be used to attack datastores in a string saving attack otherwise.
3
+
4
+ @class DataStoreStringUtils
5
+ ]=]
6
+
7
+ local require = require(script.Parent.loader).load(script)
8
+
9
+ local DataStoreStringUtils = {}
10
+
11
+ --[=[
12
+ Checks to see if a string can be stored in the datastore
13
+
14
+ @param str string
15
+ @return boolean
16
+ ]=]
17
+ function DataStoreStringUtils.isValidUTF8(str)
18
+ if type(str) ~= "string" then
19
+ return false, "Not a string"
20
+ end
21
+
22
+ -- https://gist.github.com/TheGreatSageEqualToHeaven/e0e1dc2698307c93f6013b9825705899?permalink_comment_id=4334757#gistcomment-4334757
23
+ if utf8.len(str) == nil then
24
+ return false, "Invalid string"
25
+ end
26
+
27
+ return true
28
+ end
29
+
30
+ return DataStoreStringUtils