You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 01acd22
Browse filesBrowse the repository at this point in the historyBrowse files
feat(devframe): validate remote-assets package name and version
A remote source's `package` and `version` are interpolated into CDN URLs
and the on-disk cache path, so `resolveStaticAssetsSource` now rejects a
value that isn't a valid npm package name / exact semver version (new
`DF0065`) — closing off malformed URLs and cache-path traversal (e.g. a
`..` version segment).
# DF0065: Invalid Remote Assets Package Or Version
6
+
7
+
## Message
8
+
9
+
> Invalid remote-assets `{field}` "`{value}`".
10
+
11
+
## Cause
12
+
13
+
A remote-assets source's `package` and `version` are interpolated into CDN URLs (`https://cdn.jsdelivr.net/npm/<package>@<version>/…`) and into the on-disk cache path (`.remote-assets/<package>@<version>/`). To keep those safe and well-formed, the `package` must be a valid npm package name and the `version` an exact semver version — a value carrying path separators, `@`, whitespace, or traversal segments (`..`) is rejected.
14
+
15
+
## Example
16
+
17
+
```ts
18
+
defineDevframe({
19
+
cli: {
20
+
distDir: {
21
+
package: '@devframes/plugin-git-client',
22
+
version: '../etc', // ✗ not a semver version
23
+
},
24
+
},
25
+
})
26
+
```
27
+
28
+
## Fix
29
+
30
+
Use a valid npm package name and an exact version:
31
+
32
+
```ts
33
+
defineDevframe({
34
+
cli: {
35
+
distDir: {
36
+
package: '@devframes/plugin-git-client',
37
+
version: '1.2.3',
38
+
},
39
+
},
40
+
})
41
+
```
42
+
43
+
## Source
44
+
45
+
-[`packages/devframe/src/utils/remote-assets.ts`](https://github.com/devframes/devframe/blob/main/packages/devframe/src/utils/remote-assets.ts) — `resolveStaticAssetsSource()` validates a remote source before resolving it.
`Failed to materialize the remote assets of "${p.package}@${p.version}": ${p.reason}`,
167
167
fix: 'Static builds need every asset file up front. Install the assets package locally, or ensure the provider (and its file-listing API) is reachable during the build.',
fix: 'A remote-assets `package` must be a valid npm package name and `version` an exact semver version (e.g. `1.2.3`) — they are interpolated into CDN URLs and the cache path.',
readonlyfix: "Static builds need every asset file up front. Install the assets package locally, or ensure the provider (and its file-listing API) is reachable during the build.";
300
300
};
301
+
readonlyDF0065: {
302
+
readonlywhy: (p: {
303
+
field: "package"|"version";
304
+
value: string;
305
+
})=>string;
306
+
readonlyfix: "A remote-assets `package` must be a valid npm package name and `version` an exact semver version (e.g. `1.2.3`) — they are interpolated into CDN URLs and the cache path.";
0 commit comments