@bymax-one/nest-storage 1.0.3 → 1.0.4
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 +21 -1
- package/README.md +8 -1
- package/dist/server/index.cjs +8 -2
- package/dist/server/index.mjs +8 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,25 @@ 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.4] - 2026-08-04
|
|
12
|
+
|
|
13
|
+
### Security
|
|
14
|
+
|
|
15
|
+
- The AWS credentials are no longer disclosed when a service that holds the resolved
|
|
16
|
+
options is serialized. `credentials` moves from a plain field on the resolved options
|
|
17
|
+
object to a non-enumerable accessor, so `JSON.stringify`, object spread, `util.inspect`
|
|
18
|
+
and `util.inspect` with `showHidden` all omit it. The resolved options are injected into
|
|
19
|
+
`StorageService`, `SignedUrlService`, `ValidationService` and `FileScannerService`, so
|
|
20
|
+
the long-lived `accessKeyId`, `secretAccessKey` and `sessionToken` were previously
|
|
21
|
+
emitted in plaintext by anything that rendered one of them incidentally — a structured
|
|
22
|
+
logger formatting its arguments, an error reporter capturing the scope of a throw.
|
|
23
|
+
Plain `JSON.stringify` happened not to disclose them only because it throws on the S3
|
|
24
|
+
client's circular graph, which is an accident rather than a defence: the circular-safe
|
|
25
|
+
stringifier that pino and winston use disclosed them, as did `util.inspect`.
|
|
26
|
+
|
|
27
|
+
Reading on purpose is unchanged. `options.credentials.accessKeyId` and its siblings
|
|
28
|
+
resolve exactly as before, and no public type changed.
|
|
29
|
+
|
|
11
30
|
## [1.0.3] - 2026-08-04
|
|
12
31
|
|
|
13
32
|
Documentation only. `dist/` is byte-identical to the one 1.0.2 published — verified by
|
|
@@ -188,4 +207,5 @@ have regressed from. They are kept because the reasoning is worth having.
|
|
|
188
207
|
[1.0.1]: https://github.com/bymaxone/nest-storage/compare/v1.0.0...v1.0.1
|
|
189
208
|
[1.0.2]: https://github.com/bymaxone/nest-storage/compare/v1.0.1...v1.0.2
|
|
190
209
|
[1.0.3]: https://github.com/bymaxone/nest-storage/compare/v1.0.2...v1.0.3
|
|
191
|
-
[
|
|
210
|
+
[1.0.4]: https://github.com/bymaxone/nest-storage/compare/v1.0.3...v1.0.4
|
|
211
|
+
[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 |
|
package/dist/server/index.cjs
CHANGED
|
@@ -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
|
-
|
|
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) {
|
package/dist/server/index.mjs
CHANGED
|
@@ -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
|
-
|
|
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
|
+
"version": "1.0.4",
|
|
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",
|