{"id":13487679,"url":"https://github.com/eggjs/egg-oss","last_synced_at":"2026-01-23T18:16:19.289Z","repository":{"id":57220668,"uuid":"64011529","full_name":"eggjs/egg-oss","owner":"eggjs","description":"aliyun oss plugin for egg","archived":false,"fork":false,"pushed_at":"2023-11-25T15:45:33.000Z","size":88,"stargazers_count":91,"open_issues_count":2,"forks_count":15,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-10-08T00:33:44.331Z","etag":null,"topics":["egg","egg-oss","egg-plugin","oss","oss-client"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/eggjs.png","metadata":{"files":{"readme":"README.md","changelog":"History.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2016-07-23T10:35:21.000Z","updated_at":"2025-04-21T04:23:47.000Z","dependencies_parsed_at":"2023-11-08T11:02:45.097Z","dependency_job_id":"1448f2a3-8eed-4de3-82c9-5229a8bb060f","html_url":"https://github.com/eggjs/egg-oss","commit_stats":{"total_commits":31,"total_committers":7,"mean_commits":4.428571428571429,"dds":0.6129032258064516,"last_synced_commit":"b154da8295d2d115280addc9006f0f6a61146bf7"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/eggjs/egg-oss","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Fegg-oss","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Fegg-oss/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Fegg-oss/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Fegg-oss/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eggjs","download_url":"https://codeload.github.com/eggjs/egg-oss/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Fegg-oss/sbom","scorecard":{"id":368752,"data":{"date":"2025-08-11","repo":{"name":"github.com/eggjs/egg-oss","commit":"b154da8295d2d115280addc9006f0f6a61146bf7"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.6,"checks":[{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":2,"reason":"Found 8/28 approved changesets -- score normalized to 2","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":2,"reason":"dependency not pinned by hash detected -- score normalized to 2","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql.yml:43: update your workflow using https://app.stepsecurity.io/secureworkflow/eggjs/egg-oss/codeql.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql.yml:47: update your workflow using https://app.stepsecurity.io/secureworkflow/eggjs/egg-oss/codeql.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql.yml:61: update your workflow using https://app.stepsecurity.io/secureworkflow/eggjs/egg-oss/codeql.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql.yml:74: update your workflow using https://app.stepsecurity.io/secureworkflow/eggjs/egg-oss/codeql.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/nodejs.yml:30: update your workflow using https://app.stepsecurity.io/secureworkflow/eggjs/egg-oss/nodejs.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/nodejs.yml:33: update your workflow using https://app.stepsecurity.io/secureworkflow/eggjs/egg-oss/nodejs.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/nodejs.yml:55: update your workflow using https://app.stepsecurity.io/secureworkflow/eggjs/egg-oss/nodejs.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/release.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/eggjs/egg-oss/release.yml/master?enable=pin","Warn: npmCommand not pinned by hash: .github/workflows/nodejs.yml:39","Info:   0 out of   6 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   2 third-party GitHubAction dependencies pinned","Info:   1 out of   2 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Info: jobLevel 'actions' permission set to 'read': .github/workflows/codeql.yml:28","Info: jobLevel 'contents' permission set to 'read': .github/workflows/codeql.yml:29","Warn: no topLevel permission defined: .github/workflows/codeql.yml:1","Warn: no topLevel permission defined: .github/workflows/nodejs.yml:1","Warn: no topLevel permission defined: .github/workflows/release.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"SAST","score":7,"reason":"SAST tool detected but not run on all commits","details":["Info: SAST configuration detected: CodeQL","Warn: 0 commits out of 17 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-18T12:29:34.175Z","repository_id":57220668,"created_at":"2025-08-18T12:29:34.175Z","updated_at":"2025-08-18T12:29:34.175Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28697428,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T17:25:48.045Z","status":"ssl_error","status_checked_at":"2026-01-23T17:25:47.153Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["egg","egg-oss","egg-plugin","oss","oss-client"],"created_at":"2024-07-31T18:01:01.968Z","updated_at":"2026-01-23T18:16:19.270Z","avatar_url":"https://github.com/eggjs.png","language":"JavaScript","readme":"# egg-oss\n\n[![NPM version][npm-image]][npm-url]\n[![Node.js CI](https://github.com/eggjs/egg-oss/actions/workflows/nodejs.yml/badge.svg)](https://github.com/eggjs/egg-oss/actions/workflows/nodejs.yml)\n[![Test coverage][codecov-image]][codecov-url]\n[![npm download][download-image]][download-url]\n\n[npm-image]: https://img.shields.io/npm/v/egg-oss.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/egg-oss\n[codecov-image]: https://img.shields.io/codecov/c/github/eggjs/egg-oss.svg?style=flat-square\n[codecov-url]: https://codecov.io/github/eggjs/egg-oss?branch=master\n[download-image]: https://img.shields.io/npm/dm/egg-oss.svg?style=flat-square\n[download-url]: https://npmjs.org/package/egg-oss\n\n[OSS](https://cn.aliyun.com/product/oss) plugin for egg\n\n## Install\n\n```bash\n$ npm i egg-oss\n```\n\n## Configration\n\nTo enable oss plugin, you should change `${baseDir}/config/plugin.js`\n\n```js\n// config/plugin.js\nexports.oss = {\n  enable: true,\n  package: 'egg-oss',\n};\n```\n\nThen fill in nessary information like OSS's `bucket`, `accessKeyId`, `accessKeySecret` in `${baseDir}/config/config.{env}.js`\n\nMention, `egg-oss` support normal oss client and oss cluster client, based on [oss-client](https://github.com/node-modules/oss-client):\n\n```js\n// normal oss bucket\nexports.oss = {\n  client: {\n    accessKeyId: 'your access key',\n    accessKeySecret: 'your access secret',\n    bucket: 'your bucket name',\n    endpoint: '{https or http}://{your endpoint name}.aliyun.com',\n    timeout: '60s',\n  },\n};\n\n// cluster oss bucket\n// need to config all bucket information under cluster\nexports.oss = {\n  client: {\n    cluster: [{\n      endpoint: '{https or http}://{your endpoint name}.aliyun.com',\n      accessKeyId: 'id1',\n      accessKeySecret: 'secret1',\n    }, {\n      endpoint: '{https or http}://{your endpoint name}.aliyun.com',\n      accessKeyId: 'id2',\n      accessKeySecret: 'secret2',\n    }],\n    schedule: 'masterSlave', //default is `roundRobin`\n    timeout: '60s',\n  },\n};\n\n// if config.sts == true, oss will create STS client\nexports.oss = {\n  client: {\n    sts: true,\n    accessKeyId: 'your access key',\n    accessKeySecret: 'your access secret',\n  },\n};\n```\n\nInit in egg agent, default is `false`:\n\n```js\nexports.oss = {\n  useAgent: true,\n};\n```\n\n## Usage\n\nYou can aquire oss instance on `app` or `ctx`.\n\nThe example below will upload file to oss using [the `file` mode of egg-multipart](https://github.com/eggjs/egg-multipart#enable-file-mode-on-config).\n\n```js\nconst path = require('path');\nconst Controller = require('egg').Controller;\nconst fs = require('mz/fs');\n\n// upload a file in controller\nmodule.exports = class extends Controller {\n  async upload() {\n    const ctx = this.ctx;\n\n    const file = ctx.request.files[0];\n    const name = 'egg-oss-demo/' + path.basename(file.filename);\n    let result;\n    try {\n      result = await ctx.oss.put(name, file.filepath);\n    } finally {\n      await fs.unlink(file.filepath);\n    }\n\n    if (result) {\n      console.log('get oss object: %j', object);\n      ctx.unsafeRedirect(result.url);\n    } else {\n      ctx.body = 'please select a file to upload！';\n    }\n  }\n};\n```\n\nTo learn OSS client API, please check [oss document](https://github.com/node-modules/oss-client)。\n\n## Create one more OSS buckets\n\nSome application need to access more than one oss bucket, then you need to configure `oss.clients`, and\nyou can create new oss instance dynamicly by `app.oss.createInstance(config)`.\n\n- `${appdir}/config/config.default.js`\n\n```js\nexports.oss = {\n  clients: {\n    bucket1: {\n      bucket: 'bucket1',\n    },\n    bucket2: {\n      bucket: 'bucket2',\n    },\n  },\n  // shared by client, clients and createInstance\n  default: {\n    endpoint: '{https or http}://{your endpoint name}.aliyun.com',\n    accessKeyId: '',\n    accessKeySecret: '',\n  },\n};\n\nexports.bucket3 = {\n  bucket: 'bucket3',\n};\n```\n\n- `${appdir}/config/plugin.js`\n\n```js\nexports.oss = true;\n```\n\n- `${appdir}/app.js`\n\n```js\nmodule.exports = app =\u003e {\n  const bucket1 = app.oss.get('bucket1');\n  const bucket2 = app.oss.get('bucket2');\n  // it will merge app.config.bucket3 and app.config.oss.default\n  const bucket3 = app.oss.createInstance(app.config.bucket3);\n}\n```\n\n## Development\n\nCreate `.env` file for environment that testcase need.\n\n```ini\nALI_SDK_OSS_REGION=oss-cn-hangzhou\nALI_SDK_OSS_ENDPOINT=https://oss-cn-hangzhou.aliyuncs.com\nALI_SDK_OSS_ID=\nALI_SDK_OSS_SECRET=\nALI_SDK_OSS_BUCKET=\nALI_SDK_STS_ID=\nALI_SDK_STS_SECRET=\nALI_SDK_STS_BUCKET=\nALI_SDK_STS_ROLE=\n```\n\nAnd run `npm test`.\n\nThe key is saved in [link](https://sharelock.io/1/MJITmvvEAchnIBWfm04PdfgXJs-fzCphRTz-TiVIOMo.wKVjBx/ED9OdTKWdMbkV3OfdJNXX3xG-VductolPWQM36vIgMsfvU2_KE/1XZMzTYEoGZSrCJxERU7iThkRSbhpXB71qYPPbmNbtRHfONL2J/4LB-xlFm82ZoAopEaXriN7IE9O030x3twhCtc0o69Rl5RdXj7b/YjDPa2JHQK7MUDkHskE4AAkmDXqlwoVtbT55bLYjb6tP2uvKtb/LLk1Gdwgjq3ihB1CePk8J3rWWe_-0EwxiLrjoV2tCTgRv18u1B/_AQY3Ui4TM3kQFp_8hfBCMidToOlYgQUwRNQff_Hlc9Ygl_BY6/4vhOrHyFwBg-5_qcAp-NaMeYQ8UN2wdveYQFzdv9CiKO3_Jhdz/JEdNoDO2j9rhRzUdH_c9XaguZ3kO145VRhNxj8WJghpVcmVfJZ/GYv4V-NNF-4Zic0VTtJQ_zs9iJRqHhAxI7GOEOvbaDTzIS2DFI/N5Yc-IcK4d96een8mwzrD81PZmQRYB-X94jMTVIuuDoFrPSaPB/3ks_eN1JnFyIXhshrSIBQvCtm20nyTlgvI3CjZ6mIdZBoRVDVB/e7btgHqXtuCmBgW2FNdk_eqfXDr2LFFwXzgBp5w.fwKGWMsFGx/mNYbeP11buRg) (ask @popomore), you can change the key by run `scripts/gen_env.sh`.\n\n## Questions \u0026 Suggestions\n\nPlease open an issue [here](https://github.com/eggjs/egg/issues).\n\n## License\n\n[MIT](LICENSE)\n","funding_links":[],"categories":["Plugins","仓库"],"sub_categories":["插件"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feggjs%2Fegg-oss","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feggjs%2Fegg-oss","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feggjs%2Fegg-oss/lists"}