{"id":16132898,"url":"https://github.com/vvbbnn00/onedrive-index","last_synced_at":"2025-08-28T23:49:18.273Z","repository":{"id":184524955,"uuid":"670020917","full_name":"vvbbnn00/onedrive-index","owner":"vvbbnn00","description":"☁ OneDrive public directory listing, based on onedrive-vercel-index, the secondary development Onedrive project fixes security vulnerabilities and improves performance, and provides Docker environment deployment solutions. 基于onedrive-vercel-index，修复安全漏洞并提升性能的二次开发Onedrive项目，提供Docker环境部署方案。","archived":false,"fork":false,"pushed_at":"2025-06-16T12:58:58.000Z","size":4370,"stargazers_count":21,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-16T13:26:58.673Z","etag":null,"topics":["docker","nextjs","onedrive","onedrive-index","onedrive-vercel-index","react"],"latest_commit_sha":null,"homepage":"https://naruse.io","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vvbbnn00.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-24T05:56:35.000Z","updated_at":"2025-06-16T12:58:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"c7824600-6382-4ee9-80a7-1aef078b5347","html_url":"https://github.com/vvbbnn00/onedrive-index","commit_stats":null,"previous_names":["vvbbnn00/onedrive-docker-index"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/vvbbnn00/onedrive-index","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vvbbnn00%2Fonedrive-index","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vvbbnn00%2Fonedrive-index/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vvbbnn00%2Fonedrive-index/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vvbbnn00%2Fonedrive-index/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vvbbnn00","download_url":"https://codeload.github.com/vvbbnn00/onedrive-index/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vvbbnn00%2Fonedrive-index/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272582514,"owners_count":24959421,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-28T02:00:10.768Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","nextjs","onedrive","onedrive-index","onedrive-vercel-index","react"],"created_at":"2024-10-09T22:35:07.638Z","updated_at":"2025-08-28T23:49:18.262Z","avatar_url":"https://github.com/vvbbnn00.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Onedrive Docker Index\n\n中文 | [English](./README_en.md)\n\n## 🤔 这是什么？\n本项目是基于[ondrive-vercel-index](https://github.com/spencerwooo/onedrive-vercel-index)的二次开发项目。由于原项目已经处于`Archive`状态，因此，本项目的主要目的是修复原项目中存在的较为严重的安全漏洞（详见[安全问题修复](#-安全问题修复))、并对界面与性能进行优化，与此同时，也提供了`Docker`环境的部署方案。本项目继承了原项目所有的功能特性，您可以参照[原项目的帮助文档](https://ovi.swo.moe/zh/docs/getting-started)来进行自定义操作。\n\n很惭愧，作为一个**超业余前后端开发者**，我的编程水平远不及参与原项目开发的各位大佬，因此无法对二开后的项目质量做出保证；同时，因为本项目的创建初衷是为了搭建我自己的个人站点，因此，其中存在许多定制化的内容，若有需要，您可以自行调整。您可以在后文的[定制您的站点](#-定制您的站点)部分找到帮助。\n\n## ❓ 它与`onedrive-vercel-index`有何不同？\n\n- 修复了若干严重的[安全问题](#-安全问题修复)\n- 提供了Docker部署方案\n- 提高Redis缓存利用率，提升网站性能\n- 界面显示优化（支持自定义背景图片等）\n- 提升用户安全性\n- ...\n\n## 🎉 快速上手\n\n虽说快速上手，但本项目的实际操作流程，相较于原项目，确实繁琐不少。\n\n### Step 1\n`Clone`这个项目到您的服务器，并获取您自己的`ClientID`与`ClientSecret`。\n\n获取方法参考[原项目教程](https://ovi.swo.moe/zh/docs/advanced)。\n\n**不过，与原教程不同的是，获取的`ClientSecret`无需加密！请在Step 2中直接填写未经加密的`ClientID`与`ClientSecret`！**\n\n\n### Step 2\n在项目根目录创建`.env`文件，文件需要填写的内容如下：\n```env\nNODE_ENV=production  # 部署环境，默认为production模式，无需更改\nNEXT_PUBLIC_USER_PRINCIPLE_NAME=Your Onedrive Username  # 您的Onedrive账号，作绑定用\nKV_PREFIX=GALBOX  # Redis存储的前缀，可根据自己情况修改\nREDIS_URL=redis://redis:6379  # 正常情况下无需修改，若您需要使用外部的Redis服务，则需要填写\n\nMS_AUTH_TYPE=certificate # 认证方式，可以为clientSecret，或者certificate\n\n; 由于clientSecret的有效期最长为2年，推荐使用certificate认证方式\nMS_CLIENT_ID=Your Client ID  # 您的 Application (client) ID，必填\nMS_CLIENT_SECRET=Your Client Secret  # 您的ClientSecret，当使用clientSecret认证方式时，必填\n\n; 关于证书认证，可以参考：https://learn.microsoft.com/zh-cn/entra/identity-platform/certificate-credentials\nMS_TENANT_ID=Your Tenant ID  # 您的Directory (tenant) ID，当使用certificate认证方式时，必填\nMS_CLIENT_CERTIFICATE_THUMBPRINT=Base 64 Thumbprint  # 证书的Base 64 Thumbprint，当使用certificate认证方式时，必填\nMS_CLIENT_PRIVATE_KEY_BASE64=Base 64 Private Key  # PEM格式的私钥证书二次Base64编码后的内容，当使用certificate认证方式时，必填1\n\nSECRET_KEY=Your Secret Key  # AES加密用的Secret Key，它是绝对保密的\nPROTECTED_ROUTES=[\"/protectedRoutes/\"]  # 受保护的路径，您可以根据自己的情况修改，需要是JSON格式\n```\n**注意`ClientSecret`是未经加密的！**\n\n### Step 3\n\n根据不同的系统，选择相应的指令，运行指令构建并启动镜像。\n\n**Linux系统：**\n```shell\nchmod +x ./build.sh\n./build.sh\n```\n\n**Windows系统：**\n```shell\n./build.bat\n```\n\n### Step 4\n项目已经构建完成，端口为`20011`，不过我们更推荐您使用Nginx反向代理的方式提供服务。下面是一个反向代理的示例配置：\n```conf\n#PROXY-START/\n\nlocation ^~ /\n{\n    proxy_pass http://127.0.0.1:20011;\n    proxy_set_header Host $host;\n    proxy_set_header X-Real-IP $remote_addr;\n    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n    proxy_set_header REMOTE-HOST $remote_addr;\n    proxy_set_header Upgrade $http_upgrade;\n    proxy_set_header Connection $connection_upgrade;\n    proxy_http_version 1.1;\n    proxy_cache_bypass 'Od-Protected-Token';\n}\n\n#PROXY-END/\n```\n\n### Step 5\n接下来的步骤与原教程完全一致，[点击查看](https://ovi.swo.moe/zh/docs/getting-started#%E8%BF%9B%E8%A1%8C%E8%AE%A4%E8%AF%81)。\n\n\n🎉大功告成！\n\n\n## ❗ 安全问题修复\n\n\u003e **请勿利用下文的任何漏洞对任何服务器发起攻击！**\n\n本项目针对`onedrive-vercel-index`中存在的部分较为严重的安全问题进行了修复，为了保证用户的数据安全，下面仅对漏洞做简单的描述，不提供任何漏洞复现指导。\n\n### 1、[CRITICAL] 受保护的路径文件读取漏洞\n在`/api/item`中，传入的参数`id`未经检查，可以通过该漏洞获取受保护的文件夹或文件ID、也可以获取受保护的文件内容。\n\n### 2、SECRET_KEY泄露\n而在`/onedrive-vercel-index-oauth/step-2/`、`/onedrive-vercel-index-oauth/step-3/`中，存在前端引用`/utils/oAuthHandler.ts`文件，这会直接导致`SECRET_KEY`的泄露。\n\n### 3、后端鉴权漏洞\n在`/onedrive-vercel-index-oauth/step-3/`中，存在一步操作，是将获取到的`access_token`和`refresh_token`提交给服务器，保存至`redis`。\n\n分析程序代码可知，程序首先判断了登陆账号的用户名是否与设置的一致，若一致，则发送至服务器。然而，整个过程都是在前端完成的，而在后端代码中，不存在校验。也就是说，存在恶意提交覆盖原有`token`的风险。\n\n\n## ⚠ 注意事项\n\n由于经过二次开发，项目与先前项目已有不同，故存在以下需要注意的内容。\n\n### protectedRoutes\n\n如果您需要设置`protectedRoutes`，请务必设置**完整的**路径，即一定要包含末尾的`/`。例如`/protectedRoutes/`\n\n\n## 🏞 定制您的站点\n\n原项目的**全部**定制参数在本项目中依旧适用（具体参照[此处](https://ovi.swo.moe/zh/docs/custom-configs)）\n\n### 自定义背景图片\n\n通过更改`/app/public/bg.webp`来实现，若您需要修改图片的路径，可在`/app/src/styles/globals.css`中修改。\n```css\nbody {\n  background-image: url('/bg.webp');  /* 修改此处，/bg.webp对应/app/public/bg.webp，以此类推 */\n  background-size: cover;\n  background-repeat: no-repeat;\n  background-color: #f2f2f2;\n  background-attachment: fixed;\n}\n```\n\n### 修改站点图标\n\n您可以通过[该站点](https://www.favicon-generator.org/)生成一系列的图标用以替换。\n\n该部分的代码实现位于`/app/src/pages/_document.tsx`\n\n\n## ☁ Cloudflare 部署建议\n\n若您使用了Cloudflare服务，可以添加规则如下的缓存规则来提高站点的访问速度（当该规则满足，则**缓存**响应内容）：\n\n```text\n(not starts_with(http.request.uri.path, \"/api/\")) and (not any(lower(http.request.headers.names[*])[*] eq \"od-protected-token\"))\n```\n\n\n## 🔐 安全政策\n\n请参照[SECURITY.md](./SECURITY.md)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvvbbnn00%2Fonedrive-index","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvvbbnn00%2Fonedrive-index","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvvbbnn00%2Fonedrive-index/lists"}