ROOTPLOIT
Server: LiteSpeed
System: Linux in-mum-web1878.main-hosting.eu 5.14.0-570.21.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jun 11 07:22:35 EDT 2025 x86_64
User: u435929562 (435929562)
PHP: 7.4.33
Disabled: system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
Upload Files
File: //opt/go/pkg/mod/go.mongodb.org/[email protected]/testdata/gridfs/download.json
{
  "description": "gridfs-download",
  "schemaVersion": "1.0",
  "createEntities": [
    {
      "client": {
        "id": "client0"
      }
    },
    {
      "database": {
        "id": "database0",
        "client": "client0",
        "databaseName": "gridfs-tests"
      }
    },
    {
      "bucket": {
        "id": "bucket0",
        "database": "database0"
      }
    },
    {
      "collection": {
        "id": "bucket0_files_collection",
        "database": "database0",
        "collectionName": "fs.files"
      }
    },
    {
      "collection": {
        "id": "bucket0_chunks_collection",
        "database": "database0",
        "collectionName": "fs.chunks"
      }
    }
  ],
  "initialData": [
    {
      "collectionName": "fs.files",
      "databaseName": "gridfs-tests",
      "documents": [
        {
          "_id": {
            "$oid": "000000000000000000000001"
          },
          "length": 0,
          "chunkSize": 4,
          "uploadDate": {
            "$date": "1970-01-01T00:00:00.000Z"
          },
          "md5": "d41d8cd98f00b204e9800998ecf8427e",
          "filename": "length-0",
          "contentType": "application/octet-stream",
          "aliases": [],
          "metadata": {}
        },
        {
          "_id": {
            "$oid": "000000000000000000000002"
          },
          "length": 0,
          "chunkSize": 4,
          "uploadDate": {
            "$date": "1970-01-01T00:00:00.000Z"
          },
          "md5": "d41d8cd98f00b204e9800998ecf8427e",
          "filename": "length-0-with-empty-chunk",
          "contentType": "application/octet-stream",
          "aliases": [],
          "metadata": {}
        },
        {
          "_id": {
            "$oid": "000000000000000000000003"
          },
          "length": 2,
          "chunkSize": 4,
          "uploadDate": {
            "$date": "1970-01-01T00:00:00.000Z"
          },
          "md5": "c700ed4fdb1d27055aa3faa2c2432283",
          "filename": "length-2",
          "contentType": "application/octet-stream",
          "aliases": [],
          "metadata": {}
        },
        {
          "_id": {
            "$oid": "000000000000000000000004"
          },
          "length": 8,
          "chunkSize": 4,
          "uploadDate": {
            "$date": "1970-01-01T00:00:00.000Z"
          },
          "md5": "dd254cdc958e53abaa67da9f797125f5",
          "filename": "length-8",
          "contentType": "application/octet-stream",
          "aliases": [],
          "metadata": {}
        },
        {
          "_id": {
            "$oid": "000000000000000000000005"
          },
          "length": 10,
          "chunkSize": 4,
          "uploadDate": {
            "$date": "1970-01-01T00:00:00.000Z"
          },
          "md5": "57d83cd477bfb1ccd975ab33d827a92b",
          "filename": "length-10",
          "contentType": "application/octet-stream",
          "aliases": [],
          "metadata": {}
        },
        {
          "_id": {
            "$oid": "000000000000000000000006"
          },
          "length": 2,
          "chunkSize": 4,
          "uploadDate": {
            "$date": "1970-01-01T00:00:00.000Z"
          },
          "md5": "c700ed4fdb1d27055aa3faa2c2432283",
          "contentType": "application/octet-stream",
          "aliases": [],
          "metadata": {}
        }
      ]
    },
    {
      "collectionName": "fs.chunks",
      "databaseName": "gridfs-tests",
      "documents": [
        {
          "_id": {
            "$oid": "000000000000000000000001"
          },
          "files_id": {
            "$oid": "000000000000000000000002"
          },
          "n": 0,
          "data": {
            "$binary": {
              "base64": "",
              "subType": "00"
            }
          }
        },
        {
          "_id": {
            "$oid": "000000000000000000000002"
          },
          "files_id": {
            "$oid": "000000000000000000000003"
          },
          "n": 0,
          "data": {
            "$binary": {
              "base64": "ESI=",
              "subType": "00"
            }
          }
        },
        {
          "_id": {
            "$oid": "000000000000000000000003"
          },
          "files_id": {
            "$oid": "000000000000000000000004"
          },
          "n": 0,
          "data": {
            "$binary": {
              "base64": "ESIzRA==",
              "subType": "00"
            }
          }
        },
        {
          "_id": {
            "$oid": "000000000000000000000004"
          },
          "files_id": {
            "$oid": "000000000000000000000004"
          },
          "n": 1,
          "data": {
            "$binary": {
              "base64": "VWZ3iA==",
              "subType": "00"
            }
          }
        },
        {
          "_id": {
            "$oid": "000000000000000000000005"
          },
          "files_id": {
            "$oid": "000000000000000000000005"
          },
          "n": 0,
          "data": {
            "$binary": {
              "base64": "ESIzRA==",
              "subType": "00"
            }
          }
        },
        {
          "_id": {
            "$oid": "000000000000000000000006"
          },
          "files_id": {
            "$oid": "000000000000000000000005"
          },
          "n": 1,
          "data": {
            "$binary": {
              "base64": "VWZ3iA==",
              "subType": "00"
            }
          }
        },
        {
          "_id": {
            "$oid": "000000000000000000000007"
          },
          "files_id": {
            "$oid": "000000000000000000000005"
          },
          "n": 2,
          "data": {
            "$binary": {
              "base64": "mao=",
              "subType": "00"
            }
          }
        },
        {
          "_id": {
            "$oid": "000000000000000000000008"
          },
          "files_id": {
            "$oid": "000000000000000000000006"
          },
          "n": 0,
          "data": {
            "$binary": {
              "base64": "ESI=",
              "subType": "00"
            }
          }
        }
      ]
    }
  ],
  "tests": [
    {
      "description": "download when length is zero",
      "operations": [
        {
          "name": "download",
          "object": "bucket0",
          "arguments": {
            "id": {
              "$oid": "000000000000000000000001"
            }
          },
          "expectResult": {
            "$$matchesHexBytes": ""
          }
        }
      ]
    },
    {
      "description": "download when length is zero and there is one empty chunk",
      "operations": [
        {
          "name": "download",
          "object": "bucket0",
          "arguments": {
            "id": {
              "$oid": "000000000000000000000002"
            }
          },
          "expectResult": {
            "$$matchesHexBytes": ""
          }
        }
      ]
    },
    {
      "description": "download when there is one chunk",
      "operations": [
        {
          "name": "download",
          "object": "bucket0",
          "arguments": {
            "id": {
              "$oid": "000000000000000000000003"
            }
          },
          "expectResult": {
            "$$matchesHexBytes": "1122"
          }
        }
      ]
    },
    {
      "description": "download when there are two chunks",
      "operations": [
        {
          "name": "download",
          "object": "bucket0",
          "arguments": {
            "id": {
              "$oid": "000000000000000000000004"
            }
          },
          "expectResult": {
            "$$matchesHexBytes": "1122334455667788"
          }
        }
      ]
    },
    {
      "description": "download when there are three chunks",
      "operations": [
        {
          "name": "download",
          "object": "bucket0",
          "arguments": {
            "id": {
              "$oid": "000000000000000000000005"
            }
          },
          "expectResult": {
            "$$matchesHexBytes": "112233445566778899aa"
          }
        }
      ]
    },
    {
      "description": "download when files entry does not exist",
      "operations": [
        {
          "name": "download",
          "object": "bucket0",
          "arguments": {
            "id": {
              "$oid": "000000000000000000000000"
            }
          },
          "expectError": {
            "isError": true
          }
        }
      ]
    },
    {
      "description": "download when an intermediate chunk is missing",
      "operations": [
        {
          "name": "deleteOne",
          "object": "bucket0_chunks_collection",
          "arguments": {
            "filter": {
              "files_id": {
                "$oid": "000000000000000000000005"
              },
              "n": 1
            }
          },
          "expectResult": {
            "deletedCount": 1
          }
        },
        {
          "name": "download",
          "object": "bucket0",
          "arguments": {
            "id": {
              "$oid": "000000000000000000000005"
            }
          },
          "expectError": {
            "isError": true
          }
        }
      ]
    },
    {
      "description": "download when final chunk is missing",
      "operations": [
        {
          "name": "deleteOne",
          "object": "bucket0_chunks_collection",
          "arguments": {
            "filter": {
              "files_id": {
                "$oid": "000000000000000000000005"
              },
              "n": 2
            }
          },
          "expectResult": {
            "deletedCount": 1
          }
        },
        {
          "name": "download",
          "object": "bucket0",
          "arguments": {
            "id": {
              "$oid": "000000000000000000000005"
            }
          },
          "expectError": {
            "isError": true
          }
        }
      ]
    },
    {
      "description": "download when an intermediate chunk is the wrong size",
      "operations": [
        {
          "name": "bulkWrite",
          "object": "bucket0_chunks_collection",
          "arguments": {
            "requests": [
              {
                "updateOne": {
                  "filter": {
                    "files_id": {
                      "$oid": "000000000000000000000005"
                    },
                    "n": 1
                  },
                  "update": {
                    "$set": {
                      "data": {
                        "$binary": {
                          "base64": "VWZ3",
                          "subType": "00"
                        }
                      }
                    }
                  }
                }
              },
              {
                "updateOne": {
                  "filter": {
                    "files_id": {
                      "$oid": "000000000000000000000005"
                    },
                    "n": 2
                  },
                  "update": {
                    "$set": {
                      "data": {
                        "$binary": {
                          "base64": "iJmq",
                          "subType": "00"
                        }
                      }
                    }
                  }
                }
              }
            ]
          },
          "expectResult": {
            "matchedCount": 2,
            "modifiedCount": 2
          }
        },
        {
          "name": "download",
          "object": "bucket0",
          "arguments": {
            "id": {
              "$oid": "000000000000000000000005"
            }
          },
          "expectError": {
            "isError": true
          }
        }
      ]
    },
    {
      "description": "download when final chunk is the wrong size",
      "operations": [
        {
          "name": "updateOne",
          "object": "bucket0_chunks_collection",
          "arguments": {
            "filter": {
              "files_id": {
                "$oid": "000000000000000000000005"
              },
              "n": 2
            },
            "update": {
              "$set": {
                "data": {
                  "$binary": {
                    "base64": "mQ==",
                    "subType": "00"
                  }
                }
              }
            }
          },
          "expectResult": {
            "matchedCount": 1,
            "modifiedCount": 1
          }
        },
        {
          "name": "download",
          "object": "bucket0",
          "arguments": {
            "id": {
              "$oid": "000000000000000000000005"
            }
          },
          "expectError": {
            "isError": true
          }
        }
      ]
    },
    {
      "description": "download legacy file with no name",
      "operations": [
        {
          "name": "download",
          "object": "bucket0",
          "arguments": {
            "id": {
              "$oid": "000000000000000000000006"
            }
          },
          "expectResult": {
            "$$matchesHexBytes": "1122"
          }
        }
      ]
    }
  ]
}