Repository navigation
feat: add Volcano Engine TOS provider entry - #60
Merged
Merged
Conversation
Add a self-contained `tiny-oss/tos` entry implementing TOS4-HMAC-SHA256 (service `tos`, `host` + `x-tos-*` signed headers, UNSIGNED-PAYLOAD), virtual-hosted `tos-<region>.volces.com` / `tos-<region>.ivolces.com` hosts and the full operation set, including putSymlink (`x-tos-symlink-target`). Wire the tsup entry, package.json export and type tests, and pin the signer against the official @volcengine/tos-sdk in test/tos-oracle.node.ts (`pnpm test:tos-oracle`, also run by test:ci). Closes #59.
Alex1990
pushed a commit
that referenced
this pull request
Sep 18, 2026
The tiny-oss/tos entry landed in #60 but AGENTS.md lagged in three places: - the built-in-entry list omitted Volcano Engine TOS; - the entry-path example was src/cos|obs|aws|azure/index.ts; - it claimed putSymlink is OSS-only, while the TOS entry also exports it (supportsSymlink: true, x-tos-symlink-target). The README is already correct. Norms-layer change for #61; no product code, signer or workflow change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #59
loop-task: #59
Why
issue #59 asks for first-class support for Volcano Engine Torch Object Storage (TOS). TOS is S3-shaped but not covered by
tiny-oss/aws: it requires virtual-hosted addressing on a dedicated endpoint and rejects path-style, while the AWS entry's customendpointonly puts the bucket in the path whenpathStyleis true (src/aws/host.tsreturns the endpoint verbatim).What
A new, self-contained
tiny-oss/tosentry:src/tos/signature.ts—TOS4-HMAC-SHA256(servicetos): canonical request withhost+ everyx-tos-*header signed,UNSIGNED-PAYLOADbody, standard signing-key chain.src/tos/host.ts— virtual-hosted<bucket>.tos-<region>.volces.com;internal: trueselects.ivolces.com; a customendpointis treated as the endpoint domain (the bucket is still prefixed), matching@volcengine/tos-sdk.regionis always required because the credential scope embeds it.src/tos/request.ts— signs and sends one request; lower-cases header names like the SDK and emits the query string sorted exactly as signed.src/tos/signatureUrl.ts—X-Tos-*query-signed URLs (X-Tos-Expiresis a TTL in seconds,host-only signed headers).src/tos/index.ts— protocol binding and the full op set, includingputSymlink(?symlink+x-tos-symlink-target);ObjectCallbackis exported but callbacks are passed throughheaders(x-tos-callback), like COS.Packaging:
tsupentry,package.jsonexports/build:types:tos/check:types/keywords,@volcengine/tos-sdk@2.9.1devDependency,pnpm-workspace.yamltos-crc64-js: false(optional CRC build, unneeded for signing). Shared: optionalProtocol.symlinkHeadershook (OSS behavior unchanged) and callback comments/message now mention TOS.README.md/README_zh-CN.mddocument the provider.Signer verification (oracle)
pnpm test:tos-oracle(test/tos-oracle.node.ts, also run bytest:ci) drives the official@volcengine/tos-sdk@2.9.1against a local capture server and recomputes every Authorization with our signer from the captured method/path/query/headers — byte-identical forputObject(metadata, non-ASCII key),createMultipartUpload,uploadPart,listParts,listMultipartUploads,completeMultipartUpload,abortMultipartUpload,uploadPartCopy,putSymlink, with and without an STS token. Pre-signed URLs are compared againstgetPreSignedUrland the query-signing path/credential scope against the official Go SDK's published vector (ve-tos-golang-sdk tos/sign_v4_test.go, embedded as a fixed vector intest/tos-signature.spec.ts).One deliberate deviation. The JS SDK's
getPreSignedUrlputs the endpoint in the credential scope (src/methods/base.ts:region: this.opts.endpoint), which disagrees with the official Go SDK (SignV4.SignQueryuses the client region) and the standard V4 scope; the JS SDK has no test forgetPreSignedUrl.tiny-osssigns the realregion; the JS comparison neutralizes that single field withendpoint === region(every other byte is compared) and the Go vector pins the region choice. Both forms are accepted by the service.Tests
test/tos-oracle.node.ts— official-SDK oracle (pnpm test:tos-oracle, added totest:ci/test:ci:coverage).test/tos-signature.spec.ts— fixed vectors (JS header, Go query, JS signed URLs), host resolution, request building; 19 tests.test/tos.spec.ts— entry-levelput/putSymlink/uploadPartCopy/multipartUpload; 5 tests.test/test-types-tos.ts— entry types.Verification
pnpm lint— 0 errors (39 pre-existing warnings).pnpm fmt:check— all files formatted.pnpm build— exit 0; emitsdist/tiny-oss.tos.es.js+.d.ts.pnpm check:types— exit 0.pnpm test:ci— azure oracle + TOS oracle + headless vitest: 24 files passed, 255 passed / 26 skipped.Existing OSS/COS/OBS/AWS signers and their oracles are untouched. Tree-shaking confirmed:
tiny-oss.tos.es.jscarries no other provider's signing code.Note
AGENTS.md's built-in-entry list andputSymlinkwording are now slightly stale; that is the norms layer and should land as its own proposal PR rather than in this feature change.