CVE-2021-32814 (published 2021-08-03T17:15Z)

Skytable is a NoSQL database with automated snapshots and TLS. Versions prior to 0.5.1 are vulnerable to a a directory traversal attack enabling remotely connected clients to destroy and/or manipulate critical files on the host's file system. This security bug has been patched in version 0.5.1. There are no known workarounds aside from upgrading.

Severity: HIGH
CVSS v2 base score: 9.4 (AV:N/AC:L/Au:N/C:N/I:C/A:C)
CVSS v3 base score: 8.1, HIGH (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:H)

Weakness information:
cwe_id: CWE-22
cwe_name: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
description: The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.
extended_description: 
            Many file operations are intended to take place within a restricted directory. By using special elements such as ".." and "/" separators, attackers can escape outside of the restricted location to access files or directories that are elsewhere on the system. One of the most common special elements is the "../" sequence, which in most modern operating systems is interpreted as the parent directory of the current location. This is referred to as relative path traversal. Path traversal also covers the use of absolute pathnames such as "/usr/local/bin" to access unexpected files. This is referred to as absolute path traversal.
         
         

Fix information:
repo_url: https://github.com/skytable/skytable
commit_details: repo_url: https://github.com/skytable/skytable
author: Sayan Nandan
author_date: 2021-02-15 10:25:53+05:30
msg: Add fix and tests for VE/S/00001
This commit now checks if the second value passed to MKSNAP points
to any parent/root directory before performing any action.

Signed-off-by: Sayan Nandan <nandansayan@outlook.com>
repository: repo_url: https://github.com/skytable/skytable
repo_name: skytable/skytable
description: Skytable is a modern scalable NoSQL database with BlueQL, designed for performance, scalability and flexibility. Skytable gives you spaces, models, data types, complex collections and more to build powerful experiences
repo_language: Rust
owner: skytable
file_changes: filename: .gitignore
change_type: ModificationType.MODIFY
diff: @@ -3,4 +3,5 @@
 data.bin
 /server/snapshots
 snapstore.bin
-snapstore.partmap
\ No newline at end of file
+snapstore.partmap
+/snapshots 
\ No newline at end of file

programming_language: Shell
filename: workspace.xml
change_type: ModificationType.ADD
diff: @@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="CMakeRunConfigurationManager" shouldGenerate="true" shouldDeleteObsolete="true">
+    <generated />
+  </component>
+  <component name="CMakeSettings">
+    <configurations>
+      <configuration PROFILE_NAME="Debug" CONFIG_NAME="Debug" ENABLED="true" />
+    </configurations>
+  </component>
+  <component name="CargoProjects">
+    <cargoProject FILE="$PROJECT_DIR$/Cargo.toml" />
+  </component>
+  <component name="ChangeListManager">
+    <list default="true" id="05446e12-25fb-4f56-ae52-664b69a61212" name="Default Changelist" comment="">
+      <change beforePath="$PROJECT_DIR$/server/src/main.rs" beforeDir="false" afterPath="$PROJECT_DIR$/server/src/main.rs" afterDir="false" />
+    </list>
+    <option name="SHOW_DIALOG" value="false" />
+    <option name="HIGHLIGHT_CONFLICTS" value="true" />
+    <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
+    <option name="LAST_RESOLUTION" value="IGNORE" />
+  </component>
+  <component name="ClangdSettings">
+    <option name="formatViaClangd" value="false" />
+  </component>
+  <component name="Git.Settings">
+    <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
+  </component>
+  <component name="GitSEFilterConfiguration">
+    <file-type-list>
+      <filtered-out-file-type name="LOCAL_BRANCH" />
+      <filtered-out-file-type name="REMOTE_BRANCH" />
+      <filtered-out-file-type name="TAG" />
+      <filtered-out-file-type name="COMMIT_BY_MESSAGE" />
+    </file-type-list>
+  </component>
+  <component name="MacroExpansionManager">
+    <option name="directoryName" value="k3yyr5y2" />
+  </component>
+  <component name="ProjectId" id="1mjP2LZbFlEc2swjliVmxauGK9Q" />
+  <component name="ProjectLevelVcsManager" settingsEditedManually="true" />
+  <component name="ProjectViewState">
+    <option name="hideEmptyMiddlePackages" value="true" />
+    <option name="showLibraryContents" value="true" />
+    <option name="showVisibilityIcons" value="true" />
+  </component>
+  <component name="PropertiesComponent">
+    <property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
+    <property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
+    <property name="WebServerToolWindowFactoryState" value="false" />
+    <property name="cf.first.check.clang-format" value="false" />
+    <property name="last_opened_file_path" value="$PROJECT_DIR$" />
+    <property name="nodejs_package_manager_path" value="npm" />
+    <property name="org.rust.cargo.project.model.PROJECT_DISCOVERY" value="true" />
+  </component>
+  <component name="RustProjectSettings">
+    <option name="toolchainHomeDirectory" value="$USER_HOME$/.cargo/bin" />
+  </component>
+  <component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
+  <component name="TaskManager">
+    <task active="true" id="Default" summary="Default task">
+      <changelist id="05446e12-25fb-4f56-ae52-664b69a61212" name="Default Changelist" comment="" />
+      <created>1610003825159</created>
+      <option name="number" value="Default" />
+      <option name="presentableId" value="Default" />
+      <updated>1610003825159</updated>
+      <workItem from="1610003832233" duration="85000" />
+      <workItem from="1610003959549" duration="724000" />
+    </task>
+    <servers />
+  </component>
+  <component name="TypeScriptGeneratedFilesManager">
+    <option name="version" value="3" />
+  </component>
+</project>
\ No newline at end of file

programming_language: TypeScript
filename: Cargo.lock
change_type: ModificationType.MODIFY
diff: @@ -65,9 +65,9 @@ checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de"
 
 [[package]]
 name = "bytes"
-version = "0.6.0"
+version = "1.0.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e0dcbc35f504eb6fc275a6d20e4ebcda18cf50d40ba6fabff8c711fa16cb3b16"
+checksum = "b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040"
 
 [[package]]
 name = "cc"
@@ -81,6 +81,12 @@ version = "0.1.10"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
 
+[[package]]
+name = "cfg-if"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
+
 [[package]]
 name = "chrono"
 version = "0.4.19"
@@ -121,15 +127,15 @@ dependencies = [
 
 [[package]]
 name = "devtimer"
-version = "4.0.0"
+version = "4.0.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6035b7b9244bf9637cd7ef80b5e1c54404bef92cccd34738c85c45f04ae8b244"
+checksum = "907339959a92f6b98846570500c0a567c9aecbb3871cef00561eb5d20d47b7c1"
 
 [[package]]
 name = "env_logger"
-version = "0.8.2"
+version = "0.8.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f26ecb66b4bdca6c1409b40fb255eefc2bd4f6d135dab3c3124f80ffa2a9661e"
+checksum = "17392a012ea30ef05a610aa97dfb49496e71c9f676b27879922ea5bdf60d9d3f"
 dependencies = [
  "atty",
  "humantime",
@@ -144,21 +150,15 @@ version = "1.2.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394"
 
-[[package]]
-name = "futures-core"
-version = "0.3.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "59f5fff90fd5d971f936ad674802482ba441b6f09ba5e15fd8b39145582ca399"
-
 [[package]]
 name = "getrandom"
-version = "0.1.15"
+version = "0.2.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fc587bc0ec293155d5bfa6b9891ec18a1e330c234f896ea47fbada4cadbe47e6"
+checksum = "c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8"
 dependencies = [
- "cfg-if",
+ "cfg-if 1.0.0",
  "libc",
- "wasi 0.9.0+wasi-snapshot-preview1",
+ "wasi",
 ]
 
 [[package]]
@@ -241,11 +241,11 @@ dependencies = [
 
 [[package]]
 name = "log"
-version = "0.4.11"
+version = "0.4.14"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b"
+checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710"
 dependencies = [
- "cfg-if",
+ "cfg-if 1.0.0",
 ]
 
 [[package]]
@@ -338,7 +338,7 @@ version = "0.8.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "c361aa727dd08437f2f1447be8b59a33b0edd15e0fcee698f935613d9efbca9b"
 dependencies = [
- "cfg-if",
+ "cfg-if 0.1.10",
  "cloudabi",
  "instant",
  "libc",
@@ -370,20 +370,19 @@ dependencies = [
 
 [[package]]
 name = "quote"
-version = "1.0.7"
+version = "1.0.9"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37"
+checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7"
 dependencies = [
  "proc-macro2",
 ]
 
 [[package]]
 name = "rand"
-version = "0.7.3"
+version = "0.8.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
+checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e"
 dependencies = [
- "getrandom",
  "libc",
  "rand_chacha",
  "rand_core",
@@ -392,9 +391,9 @@ dependencies = [
 
 [[package]]
 name = "rand_chacha"
-version = "0.2.2"
+version = "0.3.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402"
+checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d"
 dependencies = [
  "ppv-lite86",
  "rand_core",
@@ -402,18 +401,18 @@ dependencies = [
 
 [[package]]
 name = "rand_core"
-version = "0.5.1"
+version = "0.6.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
+checksum = "34cf66eb183df1c5876e2dcf6b13d57340741e8dc255b48e40a26de954d06ae7"
 dependencies = [
  "getrandom",
 ]
 
 [[package]]
 name = "rand_hc"
-version = "0.2.0"
+version = "0.3.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
+checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73"
 dependencies = [
  "rand_core",
 ]
@@ -426,9 +425,9 @@ checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce"
 
 [[package]]
 name = "regex"
-version = "1.4.2"
+version = "1.4.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "38cf2c13ed4745de91a5eb834e11c00bcc3709e773173b2ce4c56c9fbde04b9c"
+checksum = "d9251239e129e16308e70d853559389de218ac275b515068abc96829d05b948a"
 dependencies = [
  "aho-corasick",
  "memchr",
@@ -438,9 +437,9 @@ dependencies = [
 
 [[package]]
 name = "regex-syntax"
-version = "0.6.21"
+version = "0.6.22"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3b181ba2dcf07aaccad5448e8ead58db5b742cf85dfe035e2227f137a539a189"
+checksum = "b5eb417147ba9860a96cfe72a0b93bf88fee1744b5636ec99ab20c1aa9376581"
 
 [[package]]
 name = "ryu"
@@ -456,18 +455,18 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
 
 [[package]]
 name = "serde"
-version = "1.0.118"
+version = "1.0.123"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "06c64263859d87aa2eb554587e2d23183398d617427327cf2b3d0ed8c69e4800"
+checksum = "92d5161132722baa40d802cc70b15262b98258453e85e5d1d365c757c73869ae"
 dependencies = [
  "serde_derive",
 ]
 
 [[package]]
 name = "serde_derive"
-version = "1.0.118"
+version = "1.0.123"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c84d3526699cd55261af4b941e4e725444df67aa4f9e6a3564f18030d12672df"
+checksum = "9391c295d64fc0abb2c556bad848f33cb8296276b1ad2677d1ae1ace4f258f31"
 dependencies = [
  "proc-macro2",
  "quote",
@@ -476,9 +475,9 @@ dependencies = [
 
 [[package]]
 name = "serde_json"
-version = "1.0.60"
+version = "1.0.62"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1500e84d27fe482ed1dc791a56eddc2f230046a040fa908c08bda1d9fb615779"
+checksum = "ea1c6153794552ea7cf7cf63b1231a25de00ec90db326ba6264440fa08e31486"
 dependencies = [
  "itoa",
  "ryu",
@@ -495,12 +494,6 @@ dependencies = [
  "libc",
 ]
 
-[[package]]
-name = "slab"
-version = "0.4.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
-
 [[package]]
 name = "smallvec"
 version = "1.4.1"
@@ -513,7 +506,7 @@ version = "0.3.16"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "7fd8b795c389288baa5f355489c65e71fd48a02104600d15c4cfbc561e9e429d"
 dependencies = [
- "cfg-if",
+ "cfg-if 0.1.10",
  "libc",
  "redox_syscall",
  "winapi",
@@ -527,9 +520,9 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
 
 [[package]]
 name = "syn"
-version = "1.0.54"
+version = "1.0.60"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9a2af957a63d6bd42255c359c93d9bfdb97076bd3b820897ce55ffbfbf107f44"
+checksum = "c700597eca8a5a762beb35753ef6b94df201c81cca676604f547495a0d7f0081"
 dependencies = [
  "proc-macro2",
  "quote",
@@ -614,19 +607,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255"
 dependencies = [
  "libc",
- "wasi 0.10.0+wasi-snapshot-preview1",
+ "wasi",
  "winapi",
 ]
 
 [[package]]
 name = "tokio"
-version = "0.3.6"
+version = "1.2.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "720ba21c25078711bf456d607987d95bce90f7c3bea5abe1db587862e7a1e87c"
+checksum = "e8190d04c665ea9e6b6a0dc45523ade572c088d2e6566244c1122671dbf4ae3a"
 dependencies = [
  "autocfg",
  "bytes",
- "futures-core",
  "libc",
  "memchr",
  "mio",
@@ -635,16 +627,15 @@ dependencies = [
  "parking_lot",
  "pin-project-lite",
  "signal-hook-registry",
- "slab",
  "tokio-macros",
  "winapi",
 ]
 
 [[package]]
 name = "tokio-macros"
-version = "0.3.1"
+version = "1.1.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "21d30fdbb5dc2d8f91049691aa1a9d4d4ae422a21c334ce8936e5886d30c5c45"
+checksum = "caf7b11a536f46a809a8a9f0bb4237020f70ecbf115b842360afb127ea2fda57"
 dependencies = [
  "proc-macro2",
  "quote",
@@ -653,9 +644,9 @@ dependencies = [
 
 [[package]]
 name = "toml"
-version = "0.5.7"
+version = "0.5.8"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "75cf45bb0bef80604d001caaec0d09da99611b3c0fd39d3080468875cdb65645"
+checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa"
 dependencies = [
  "serde",
 ]
@@ -690,12 +681,6 @@ version = "0.8.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
 
-[[package]]
-name = "wasi"
-version = "0.9.0+wasi-snapshot-preview1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
-
 [[package]]
 name = "wasi"
 version = "0.10.0+wasi-snapshot-preview1"

programming_language: PowerShell
filename: Cargo.toml
change_type: ModificationType.MODIFY
diff: @@ -8,8 +8,8 @@ edition = "2018"
 
 [dependencies]
 libtdb = {path = "../libtdb"}
-tokio = {version = "0.3.6", features = ["full"]}
-bytes = "0.6.0"
-regex = "1.4.2"
+tokio = {version = "1.2.0", features = ["full"]}
+bytes = "1.0.1"
+regex = "1.4.3"
 lazy_static = "1.4.0"
 clap = {version = "2.33.3", features=["yaml"]}
\ No newline at end of file

programming_language: Lua
filename: Cargo.toml
change_type: ModificationType.MODIFY
diff: @@ -8,5 +8,5 @@ edition = "2018"
 
 [dependencies]
 lazy_static = "1.4.0"
-bytes = "0.6.0"
-termcolor = "1.1.1"
\ No newline at end of file
+bytes = "1.0.1"
+termcolor = "1.1.2"
\ No newline at end of file

programming_language: Lua
filename: Cargo.toml
change_type: ModificationType.MODIFY
diff: @@ -7,24 +7,24 @@ edition = "2018"
 # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
 
 [dependencies]
-tokio = { version = "0.3.6", features = ["full"] }
-bytes = "0.6.0"
+tokio = { version = "1.2.0", features = ["full"] }
+bytes = "1.0.1"
 libtdb = {path ="../libtdb"}
 bincode = "1.3.1"
 parking_lot = "0.11.1"
 lazy_static = "1.4.0"
-serde_derive = "1.0.117"
-serde = {version = "1.0.118", features= ["derive"]}
-toml = "0.5.7"
+serde_derive = "1.0.123"
+serde = {version = "1.0.123", features= ["derive"]}
+toml = "0.5.8"
 clap = {version = "2.33.3", features=["yaml"]}
-env_logger = "0.8.2"
-log = "0.4.11"
+env_logger = "0.8.3"
+log = "0.4.14"
 chrono = "0.4.19"
-regex = "1.4.2"
+regex = "1.4.3"
 tdb_macros = {path="../tdb-macros"}
 
 [target.'cfg(not(target_env = "msvc"))'.dependencies]
 jemallocator = "0.3.2"
 
 [dev-dependencies]
-tokio = { version = "0.3.6", features = ["test-util"] }
+tokio = { version = "1.2.0", features = ["test-util"] }

programming_language: Lua
filename: mksnap.rs
change_type: ModificationType.MODIFY
diff: @@ -28,7 +28,7 @@ use crate::resp::GroupBegin;
 use libtdb::terrapipe::RespCodes;
 use libtdb::TResult;
 use std::hint::unreachable_unchecked;
-use std::path::PathBuf;
+use std::path::{Component, PathBuf};
 
 /// Create a snapshot
 ///
@@ -106,6 +106,25 @@ pub async fn mksnap(handle: &CoreDB, con: &mut Connection, act: ActionGroup) ->
             let mut path = PathBuf::from(DIR_SNAPSHOT);
             path.push("remote");
             path.push(snapname.to_owned() + ".snapshot");
+            let illegal_snapshot = path
+                .components()
+                .filter(|dir| {
+                    // Sanitize snapshot name, to avoid directory traversal attacks
+                    // If the snapshot name has any root directory or parent directory, then
+                    // we'll allow it to pass through this adaptor.
+                    // As a result, this iterator will give us a count of the 'bad' components
+                    dir == &Component::RootDir || dir == &Component::ParentDir
+                })
+                .count()
+                != 0;
+            if illegal_snapshot {
+                con.write_response(GroupBegin(1)).await?;
+                return con
+                    .write_response(RespCodes::OtherError(Some(
+                        "err-invalid-snapshot-name".to_owned(),
+                    )))
+                    .await;
+            }
             let failed;
             {
                 match diskstore::flush_data(&path, &handle.acquire_read().get_ref()) {
@@ -131,4 +150,4 @@ pub async fn mksnap(handle: &CoreDB, con: &mut Connection, act: ActionGroup) ->
                 .await;
         }
     }
-}
+}
\ No newline at end of file

programming_language: Rust
filename: cli.yml
change_type: ModificationType.MODIFY
diff: @@ -19,10 +19,10 @@
 #
 #
 
-name: TerrabaseDB Server
+name: Skybase Server
 version: 0.5.0
 author: Sayan N. <ohsayan@outlook.com>
-about: The TerrabaseDB Database server
+about: The Skybase Database server
 args:
         - config:
                   short: c

programming_language: CoffeeScript
filename: dbnet.rs
change_type: ModificationType.MODIFY
diff: @@ -139,7 +139,7 @@ impl Listener {
         loop {
             // Take the permit first, but we won't use it right now
             // that's why we will forget it
-            self.climit.acquire().await.forget();
+            self.climit.acquire().await.unwrap().forget();
             let stream = self.accept().await?;
             let mut chandle = CHandler {
                 db: self.db.clone(),

programming_language: Rust
filename: kvengine.rs
change_type: ModificationType.MODIFY
diff: @@ -23,8 +23,7 @@
 mod __private {
     use crate::protocol::responses::fresp;
     use libtdb::terrapipe;
-    use tokio::io::AsyncReadExt;
-    use tokio::prelude::*;
+    use tokio::io::{AsyncReadExt, AsyncWriteExt};
     /// Test a HEYA query: The server should return HEY!
     async fn test_heya() {
         let heya = terrapipe::proc_query("HEYA");
@@ -82,7 +81,6 @@ mod __private {
     ) where
         T: AsRef<str>,
     {
-        use tokio::prelude::*;
         let mut query = String::from("MSET ");
         query.push_str(values_split_with_whitespace.as_ref());
         let count_bytes_len = homwany.to_string().as_bytes().len();
@@ -663,4 +661,21 @@ mod __private {
         stream.read_exact(&mut response).await.unwrap();
         assert_eq!(res_should_be, response);
     }
+    async fn test_mksnap_sanitization() {
+        let res_should_be = "#2\n*1\n#2\n&1\n!25\nerr-invalid-snapshot-name\n"
+            .to_owned()
+            .into_bytes();
+        // First check parent directory syntax
+        let query = terrapipe::proc_query("MKSNAP ../../badsnappy");
+        stream.write_all(&query).await.unwrap();
+        let mut response = vec![0; res_should_be.len()];
+        stream.read_exact(&mut response).await.unwrap();
+        assert_eq!(res_should_be, response);
+        // Now check root directory syntax
+        let query = terrapipe::proc_query("MKSNAP /var/omgcrazysnappy");
+        stream.write_all(&query).await.unwrap();
+        let mut response = vec![0; res_should_be.len()];
+        stream.read_exact(&mut response).await.unwrap();
+        assert_eq!(res_should_be, response);
+    }
 }

programming_language: Rust
filename: Cargo.toml
change_type: ModificationType.MODIFY
diff: @@ -7,9 +7,9 @@ edition = "2018"
 # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
 
 [dependencies]
-rand = "0.7.3"
-devtimer = "4.0.0"
+rand = "0.8.3"
+devtimer = "4.0.1"
 libtdb = {path="../libtdb"}
 clap = {version = "2.33.3", features=["yaml"]}
-serde = {version="1.0.118", features=["derive"]}
-serde_json = "1.0.60"
+serde = {version="1.0.123", features=["derive"]}
+serde_json = "1.0.62"

programming_language: Lua
filename: cli.yml
change_type: ModificationType.MODIFY
diff: @@ -19,12 +19,12 @@
 #
 #
 
-name: TerrabaseDB Benchmark Tool
-version: 0.5.0
+name: Skybase Benchmark Tool
+version: 0.5-hotfix.1
 author: Sayan N. <ohsayan@outlook.com>
 about: |
-        The TerrabaseDB benchmark tool can be used to benchmark TerrabaseDB installations. 
-        If you find any issues, then report one here: https://github.com/terrabasedb/terrabasedb
+        The Skybase benchmark tool can be used to benchmark Skybase installations. 
+        If you find any issues, then report one here: https://github.com/skybasedb/skybase
 args:
         - connections:
                   short: c

programming_language: CoffeeScript
filename: main.rs
change_type: ModificationType.MODIFY
diff: @@ -1,7 +1,7 @@
 /*
  * Created on Sun Sep 13 2020
  *
- * This file is a part of TerrabaseDB
+ * This file is a part of Skybase
  * Copyright (c) 2020, Sayan Nandan <ohsayan at outlook dot com>
  *
  * This program is free software: you can redistribute it and/or modify
@@ -28,7 +28,7 @@ mod benchtool {
     use devtimer::DevTime;
     use libtdb::terrapipe;
     use rand::distributions::Alphanumeric;
-    use rand::{thread_rng, Rng};
+    use rand::thread_rng;
     use serde::Serialize;
     use std::io::prelude::*;
     use std::net::{self, TcpStream};
@@ -167,7 +167,7 @@ mod benchtool {
             },
             None => host.push_str("2003"),
         }
-        let rand = thread_rng();
+        let mut rand = thread_rng();
         if let Some(matches) = matches.subcommand_matches("testkey") {
             let numkeys = matches.value_of("count").unwrap();
             if let Ok(num) = numkeys.parse::<usize>() {
@@ -175,17 +175,11 @@ mod benchtool {
                 println!("Generating keys ...");
                 let keys: Vec<String> = (0..num)
                     .into_iter()
-                    .map(|_| {
-                        let rand_string: String = rand.sample_iter(&Alphanumeric).take(8).collect();
-                        rand_string
-                    })
+                    .map(|_| ran_string(8, &mut rand))
                     .collect();
                 let values: Vec<String> = (0..num)
                     .into_iter()
-                    .map(|_| {
-                        let rand_string: String = rand.sample_iter(&Alphanumeric).take(8).collect();
-                        rand_string
-                    })
+                    .map(|_| ran_string(8, &mut rand))
                     .collect();
                 let set_packs: Vec<Vec<u8>> = (0..num)
                     .map(|idx| terrapipe::proc_query(format!("SET {} {}", keys[idx], values[idx])))
@@ -225,26 +219,18 @@ mod benchtool {
             max_queries,
             (packet_size * 2), // key size + value size
         );
-        let rand = thread_rng();
+        let mut rand = thread_rng();
         let mut dt = DevTime::new_complex();
         // Create separate connection pools for get and set operations
         let mut setpool = Netpool::new(max_connections, &host);
         let mut getpool = Netpool::new(max_connections, &host);
         let keys: Vec<String> = (0..max_queries)
             .into_iter()
-            .map(|_| {
-                let rand_string: String =
-                    rand.sample_iter(&Alphanumeric).take(packet_size).collect();
-                rand_string
-            })
+            .map(|_| ran_string(packet_size, &mut rand))
             .collect();
         let values: Vec<String> = (0..max_queries)
             .into_iter()
-            .map(|_| {
-                let rand_string: String =
-                    rand.sample_iter(&Alphanumeric).take(packet_size).collect();
-                rand_string
-            })
+            .map(|_| ran_string(packet_size, &mut rand))
             .collect();
         /*
         We create three vectors of vectors: `set_packs`, `get_packs` and `del_packs`
@@ -309,8 +295,17 @@ mod benchtool {
     fn calc(reqs: usize, time: u128) -> f64 {
         reqs as f64 / (time as f64 / 1_000_000_000 as f64)
     }
+
+    fn ran_string(len: usize, rand: impl rand::Rng) -> String {
+        let rand_string: String = rand
+            .sample_iter(&Alphanumeric)
+            .take(len)
+            .map(char::from)
+            .collect();
+        rand_string
+    }
 }
 
 fn main() {
     benchtool::runner();
-}
+}
\ No newline at end of file

programming_language: Rust
filename: Cargo.toml
change_type: ModificationType.MODIFY
diff: @@ -10,7 +10,7 @@ edition = "2018"
 proc-macro = true
 
 [dependencies]
-syn = {version = "1.0.54", features = ["full"]}
-quote = "1.0.7"
-rand = "0.7.3"
+syn = {version = "1.0.60", features = ["full"]}
+quote = "1.0.9"
+rand = "0.8.3"
 proc-macro2 = "1.0.24"

programming_language: Lua
filename: lib.rs
change_type: ModificationType.MODIFY
diff: @@ -67,7 +67,7 @@ fn parse_dbtest(mut input: syn::ItemFn, rand: u16) -> Result<TokenStream, syn::E
         let addr = crate::tests::start_test_server(#rand, Some(asyncdb.clone())).await;
         let mut stream = tokio::net::TcpStream::connect(&addr).await.unwrap();
         #body
-        stream.shutdown(::std::net::Shutdown::Write).unwrap();
+        stream.shutdown().await.unwrap();
         asyncdb.finish_db();
         drop(asyncdb);
     };
@@ -183,11 +183,11 @@ fn parse_test_module(args: TokenStream, item: TokenStream) -> TokenStream {
         over by Hyper-V, which is why we'll prevent attempts to bind to them, if
         the OS is Windows.
         */
-        let mut rand: u16 = rng.gen_range(1025, 65535);
+        let mut rand: u16 = rng.gen_range(1025..=65535);
         #[cfg(not(target_os = "windows"))]
         {
             while in_set.contains(&rand) {
-                rand = rng.gen_range(1025, 65535);
+                rand = rng.gen_range(1025..=65535);
             }
         }
         #[cfg(target_os = "windows")]
@@ -195,7 +195,7 @@ fn parse_test_module(args: TokenStream, item: TokenStream) -> TokenStream {
             in_set.insert(5357);
             in_set.insert(7680);
             while in_set.contains(&rand) || (rand >= 49670 && rand <= 50293) {
-                rand = rng.gen_range(1025, 65535);
+                rand = rng.gen_range(1025..=65535);
             }
         }
         in_set.insert(rand);

programming_language: Rust