@bymax-one/nest-storage 1.0.3 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -8,6 +8,39 @@ The format follows [Keep a Changelog 1.1.0](https://keepachangelog.com/en/1.1.0/
8
8
 
9
9
  ## [Unreleased]
10
10
 
11
+ ## [1.0.5] - 2026-08-06
12
+
13
+ **Published-artifact change, not a behavioural one.** `dist/` differs from `1.0.4` — this
14
+ bundler preserves comments and the source gained mutation-suppression notes — but no runtime
15
+ path changed. Measured by building both revisions and diffing the output.
16
+
17
+ ### Tests
18
+
19
+ - `configurable: false` on the withheld credentials accessor had nothing asserting it. That flag
20
+ is the guarantee behind every serialization assertion already in the suite: a configurable
21
+ accessor can be redefined back into a plain enumerable value by anything holding the object.
22
+ It is load-bearing in this package specifically — the sibling cache and queue packages freeze
23
+ their resolved options, which makes every property non-configurable anyway; this one does not.
24
+
25
+ ## [1.0.4] - 2026-08-04
26
+
27
+ ### Security
28
+
29
+ - The AWS credentials are no longer disclosed when a service that holds the resolved
30
+ options is serialized. `credentials` moves from a plain field on the resolved options
31
+ object to a non-enumerable accessor, so `JSON.stringify`, object spread, `util.inspect`
32
+ and `util.inspect` with `showHidden` all omit it. The resolved options are injected into
33
+ `StorageService`, `SignedUrlService`, `ValidationService` and `FileScannerService`, so
34
+ the long-lived `accessKeyId`, `secretAccessKey` and `sessionToken` were previously
35
+ emitted in plaintext by anything that rendered one of them incidentally — a structured
36
+ logger formatting its arguments, an error reporter capturing the scope of a throw.
37
+ Plain `JSON.stringify` happened not to disclose them only because it throws on the S3
38
+ client's circular graph, which is an accident rather than a defence: the circular-safe
39
+ stringifier that pino and winston use disclosed them, as did `util.inspect`.
40
+
41
+ Reading on purpose is unchanged. `options.credentials.accessKeyId` and its siblings
42
+ resolve exactly as before, and no public type changed.
43
+
11
44
  ## [1.0.3] - 2026-08-04
12
45
 
13
46
  Documentation only. `dist/` is byte-identical to the one 1.0.2 published — verified by
@@ -188,4 +221,6 @@ have regressed from. They are kept because the reasoning is worth having.
188
221
  [1.0.1]: https://github.com/bymaxone/nest-storage/compare/v1.0.0...v1.0.1
189
222
  [1.0.2]: https://github.com/bymaxone/nest-storage/compare/v1.0.1...v1.0.2
190
223
  [1.0.3]: https://github.com/bymaxone/nest-storage/compare/v1.0.2...v1.0.3
191
- [Unreleased]: https://github.com/bymaxone/nest-storage/compare/v1.0.3...HEAD
224
+ [1.0.5]: https://github.com/bymaxone/nest-storage/compare/v1.0.4...v1.0.5
225
+ [1.0.4]: https://github.com/bymaxone/nest-storage/compare/v1.0.3...v1.0.4
226
+ [Unreleased]: https://github.com/bymaxone/nest-storage/compare/v1.0.4...HEAD
package/README.md CHANGED
@@ -760,6 +760,13 @@ with an expiry, not like a link.
760
760
  They arrive through module options and are handed to the SDK. This library never reads
761
761
  `process.env`, never logs them, and never places them — or a signed URL — in an exception.
762
762
 
763
+ They are also not reachable by serializing the objects that hold them. The resolved
764
+ options are injected into every service, so `credentials` is attached as a non-enumerable
765
+ accessor: `JSON.stringify`, object spread, `util.inspect` and `util.inspect` with
766
+ `showHidden` all omit it. Those are the paths taken by code that renders a provider it was
767
+ handed incidentally — a structured logger formatting its arguments, an error reporter
768
+ capturing the scope of a throw. Reading on purpose is unchanged.
769
+
763
770
  ### Error payloads carry the operation, and that includes the key
764
771
 
765
772
  What `aws-error-mapper` puts in `details` is the provider's error code and message, the
@@ -789,7 +796,7 @@ that must survive a compromised client belongs in IAM policies or separate bucke
789
796
  | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
790
797
  | Object keys | Guarded and normalized in one place; `..`, leading `/`, null bytes and empty keys refused |
791
798
  | Multi-tenancy | `keyPrefix` prepended after normalization, so it cannot be escaped by the key |
792
- | Credentials | Injected options only; never read from `process.env`, never logged, never in an exception |
799
+ | Credentials | Injected options only; never read from `process.env`, never logged, never in an exception; held in a non-enumerable accessor, so serializing a service omits them |
793
800
  | Error payloads | Provider code and message, HTTP status, request id, and the operation context (`op`, `bucket`, `key`/`prefix`) — never credentials, never a signed URL |
794
801
  | Presign lifetime | TTL clamped, SigV4's 7-day ceiling enforced locally |
795
802
  | Encryption | Server-side (AES256 / `aws:kms`) configurable globally or per upload |
@@ -153,7 +153,7 @@ function validateOptions(options) {
153
153
  var SLASH = "/";
154
154
  function trimTrailingSlashes(value) {
155
155
  let end = value.length;
156
- while (end > 0 && value[end - 1] === SLASH) {
156
+ while (value[end - 1] === SLASH) {
157
157
  end -= 1;
158
158
  }
159
159
  return end === value.length ? value : value.slice(0, end);
@@ -192,11 +192,11 @@ var DEFAULT_IDEMPOTENCY_CACHE_TTL_MS = 864e5;
192
192
  function applyDefaults(options) {
193
193
  const hasCredentials = Boolean(options.credentials.accessKeyId) && Boolean(options.credentials.secretAccessKey);
194
194
  const publicBaseUrl = options.publicBaseUrl ?? `${trimTrailingSlashes(options.endpoint)}/${options.bucket}`;
195
- return {
195
+ const credentials = { ...options.credentials };
196
+ const resolved = {
196
197
  endpoint: options.endpoint,
197
198
  region: options.region,
198
199
  bucket: options.bucket,
199
- credentials: { ...options.credentials },
200
200
  forcePathStyle: options.forcePathStyle ?? DEFAULT_FORCE_PATH_STYLE,
201
201
  publicBaseUrl,
202
202
  ...options.cdnBaseUrl !== void 0 ? { cdnBaseUrl: options.cdnBaseUrl } : {},
@@ -216,6 +216,12 @@ function applyDefaults(options) {
216
216
  requestTimeoutMs: options.requestTimeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS,
217
217
  hasCredentials
218
218
  };
219
+ Object.defineProperty(resolved, "credentials", {
220
+ get: () => credentials,
221
+ enumerable: false,
222
+ configurable: false
223
+ });
224
+ return resolved;
219
225
  }
220
226
  var S3ClientProvider = class {
221
227
  constructor(options) {
@@ -151,7 +151,7 @@ function validateOptions(options) {
151
151
  var SLASH = "/";
152
152
  function trimTrailingSlashes(value) {
153
153
  let end = value.length;
154
- while (end > 0 && value[end - 1] === SLASH) {
154
+ while (value[end - 1] === SLASH) {
155
155
  end -= 1;
156
156
  }
157
157
  return end === value.length ? value : value.slice(0, end);
@@ -190,11 +190,11 @@ var DEFAULT_IDEMPOTENCY_CACHE_TTL_MS = 864e5;
190
190
  function applyDefaults(options) {
191
191
  const hasCredentials = Boolean(options.credentials.accessKeyId) && Boolean(options.credentials.secretAccessKey);
192
192
  const publicBaseUrl = options.publicBaseUrl ?? `${trimTrailingSlashes(options.endpoint)}/${options.bucket}`;
193
- return {
193
+ const credentials = { ...options.credentials };
194
+ const resolved = {
194
195
  endpoint: options.endpoint,
195
196
  region: options.region,
196
197
  bucket: options.bucket,
197
- credentials: { ...options.credentials },
198
198
  forcePathStyle: options.forcePathStyle ?? DEFAULT_FORCE_PATH_STYLE,
199
199
  publicBaseUrl,
200
200
  ...options.cdnBaseUrl !== void 0 ? { cdnBaseUrl: options.cdnBaseUrl } : {},
@@ -214,6 +214,12 @@ function applyDefaults(options) {
214
214
  requestTimeoutMs: options.requestTimeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS,
215
215
  hasCredentials
216
216
  };
217
+ Object.defineProperty(resolved, "credentials", {
218
+ get: () => credentials,
219
+ enumerable: false,
220
+ configurable: false
221
+ });
222
+ return resolved;
217
223
  }
218
224
  var S3ClientProvider = class {
219
225
  constructor(options) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bymax-one/nest-storage",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "Provider-agnostic S3-compatible object storage for NestJS. Works with AWS S3, DigitalOcean Spaces, Cloudflare R2, Backblaze B2, MinIO, Wasabi.",
5
5
  "author": "Bymax One <support@bymax.one>",
6
6
  "license": "MIT",
@@ -125,20 +125,6 @@
125
125
  "typescript": "^5.9.3",
126
126
  "typescript-eslint": "^8.65.0"
127
127
  },
128
- "pnpm": {
129
- "overrides": {
130
- "brace-expansion@1": "^1.1.17",
131
- "brace-expansion@2": "^2.1.3",
132
- "brace-expansion@5": "^5.0.8",
133
- "esbuild": "0.28.1",
134
- "fast-uri": "^3.1.4",
135
- "multer": "2.2.0",
136
- "protobufjs": "^7.6.5",
137
- "qs": "6.15.2",
138
- "undici": "^8.9.0",
139
- "uuid": "11.1.1"
140
- }
141
- },
142
128
  "keywords": [
143
129
  "nestjs",
144
130
  "storage",
@@ -153,7 +139,7 @@
153
139
  "presigned-url",
154
140
  "multipart-upload"
155
141
  ],
156
- "packageManager": "pnpm@10.8.1",
142
+ "packageManager": "pnpm@11.20.0",
157
143
  "engines": {
158
144
  "node": ">=24.0.0"
159
145
  },