@axiom-lattice/protocols 7.2.0 → 7.4.0
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/.turbo/turbo-build.log +10 -10
- package/CHANGELOG.md +182 -0
- package/dist/index.d.mts +262 -14
- package/dist/index.d.ts +262 -14
- package/dist/index.js +258 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +240 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/AuthCssContract.ts +45 -0
- package/src/CollectionStoreProtocol.ts +8 -0
- package/src/McpLatticeProtocol.ts +2 -2
- package/src/McpServerConfigStoreProtocol.ts +118 -0
- package/src/McpUiProtocol.ts +2 -0
- package/src/ModelProviderProtocol.ts +20 -4
- package/src/OpenProtocol.ts +2 -2
- package/src/PlatformAuditProtocol.ts +80 -0
- package/src/PlatformBrandingCss.ts +180 -0
- package/src/PlatformOpsProtocol.ts +73 -0
- package/src/PlatformSettingsProtocol.ts +18 -4
- package/src/PluginProtocol.ts +9 -0
- package/src/SandboxResourceProtocol.ts +1 -1
- package/src/__tests__/PlatformBrandingCss.test.ts +103 -0
- package/src/index.ts +4 -0
package/src/PluginProtocol.ts
CHANGED
|
@@ -100,6 +100,15 @@ export interface PluginToolUi {
|
|
|
100
100
|
csp?: McpUiCsp;
|
|
101
101
|
permissions?: McpUiPermissions;
|
|
102
102
|
prefersBorder?: boolean;
|
|
103
|
+
/**
|
|
104
|
+
* Allow this UI to run in the same origin as the host.
|
|
105
|
+
*
|
|
106
|
+
* Only honored for built-in plugins (`meta.source` starts with `builtin:`);
|
|
107
|
+
* tenant sandbox plugins and external MCP servers never receive it. This
|
|
108
|
+
* lets a trusted first-party UI embed a same-origin console page without the
|
|
109
|
+
* opaque-origin sandbox blocking it.
|
|
110
|
+
*/
|
|
111
|
+
trustedSameOrigin?: boolean;
|
|
103
112
|
}
|
|
104
113
|
|
|
105
114
|
/**
|
|
@@ -70,7 +70,7 @@ interface ShareRecordBase {
|
|
|
70
70
|
passwordHash: string | null;
|
|
71
71
|
expiresAt: Date | null;
|
|
72
72
|
maxAccess: number | null;
|
|
73
|
-
/** Extra Open-door grants appended to sandbox tokens (V1:
|
|
73
|
+
/** Extra Open-door grants appended to sandbox tokens (V1: collection search read-only). */
|
|
74
74
|
openGrants?: OpenGrant[];
|
|
75
75
|
accessCount: number;
|
|
76
76
|
revoked: boolean;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import {
|
|
2
|
+
MAX_CUSTOM_CSS_LENGTH,
|
|
3
|
+
hasCssImport,
|
|
4
|
+
hasStyleBreakout,
|
|
5
|
+
validateCustomCss,
|
|
6
|
+
} from "../PlatformBrandingCss";
|
|
7
|
+
|
|
8
|
+
describe("PlatformBrandingCss", () => {
|
|
9
|
+
it("accepts ordinary CSS including fonts and urls", () => {
|
|
10
|
+
expect(
|
|
11
|
+
validateCustomCss(
|
|
12
|
+
"@font-face { font-family: X; src: url('/x.woff2'); } #app { color: red; }",
|
|
13
|
+
),
|
|
14
|
+
).toEqual({ ok: true });
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it("rejects @import outside comments and strings", () => {
|
|
18
|
+
expect(hasCssImport("@import url('x.css');")).toBe(true);
|
|
19
|
+
expect(hasCssImport("@IMPORT url('x.css');")).toBe(true);
|
|
20
|
+
expect(hasCssImport("/* @import url('x.css'); */")).toBe(false);
|
|
21
|
+
expect(hasCssImport('a::after { content: "@import"; }')).toBe(false);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it("detects CSS-escaped @import variants", () => {
|
|
25
|
+
expect(hasCssImport("@\\69 mport url(x.css);")).toBe(true);
|
|
26
|
+
expect(hasCssImport("@im\\port url(x.css);")).toBe(true);
|
|
27
|
+
expect(hasCssImport("@IM\\50 ORT url(x.css);")).toBe(true);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it("detects CSS-escaped url() tokens", () => {
|
|
31
|
+
expect(hasCssImport("u\\72l(/*)}@import url(//evil);")).toBe(true);
|
|
32
|
+
expect(hasCssImport("\\75 rl(/*)}@import url(//evil);")).toBe(true);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it("treats comments as token separators before url()", () => {
|
|
36
|
+
expect(hasCssImport('@import/**/url("x.css")')).toBe(true);
|
|
37
|
+
expect(hasCssImport('@import/*x*/url("x.css")')).toBe(true);
|
|
38
|
+
expect(hasCssImport('@IMPORT/**/URL("x.css")')).toBe(true);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it("keeps scanning after an unterminated url(", () => {
|
|
42
|
+
expect(hasCssImport("x{} url( } @import url(evil")).toBe(true);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it("ends an unquoted url() at the first closing parenthesis", () => {
|
|
46
|
+
expect(
|
|
47
|
+
hasCssImport('url(foo(bar) {} @import url("/evil.css"); )'),
|
|
48
|
+
).toBe(true);
|
|
49
|
+
expect(
|
|
50
|
+
hasCssImport('a url(foo(bar) {} @import url("/evil.css"); )'),
|
|
51
|
+
).toBe(true);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it("skips quoted url() content containing a closing parenthesis", () => {
|
|
55
|
+
expect(hasCssImport('url("a)b") @import url(evil);')).toBe(true);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it("ignores @import text inside a url() string", () => {
|
|
59
|
+
expect(validateCustomCss("a{background:url('@import')}")).toEqual({
|
|
60
|
+
ok: true,
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it("does not let a comment opener inside url() swallow a later @import", () => {
|
|
65
|
+
expect(
|
|
66
|
+
hasCssImport("a{background:url(/x/*)}@import url(//evil.example/x.css);"),
|
|
67
|
+
).toBe(true);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it("rejects style breakout sequences", () => {
|
|
71
|
+
expect(hasStyleBreakout("a { color: red } </style><script>")).toBe(true);
|
|
72
|
+
expect(hasStyleBreakout("a { color: red } </STYLE><script>")).toBe(true);
|
|
73
|
+
expect(hasStyleBreakout("a { color: red }")).toBe(false);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
it("accepts exactly the maximum length", () => {
|
|
77
|
+
expect(validateCustomCss("a".repeat(MAX_CUSTOM_CSS_LENGTH))).toEqual({
|
|
78
|
+
ok: true,
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
it("rejects oversize and non-string values", () => {
|
|
83
|
+
expect(validateCustomCss("a".repeat(MAX_CUSTOM_CSS_LENGTH + 1))).toEqual({
|
|
84
|
+
ok: false,
|
|
85
|
+
reason: "length",
|
|
86
|
+
});
|
|
87
|
+
expect(validateCustomCss(null)).toEqual({ ok: false, reason: "length" });
|
|
88
|
+
expect(
|
|
89
|
+
validateCustomCss("@import " + "a".repeat(MAX_CUSTOM_CSS_LENGTH)),
|
|
90
|
+
).toEqual({ ok: false, reason: "length" });
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
it("reports the first violated rule", () => {
|
|
94
|
+
expect(validateCustomCss("@import url('x.css');")).toEqual({
|
|
95
|
+
ok: false,
|
|
96
|
+
reason: "import",
|
|
97
|
+
});
|
|
98
|
+
expect(validateCustomCss("a{} </style>")).toEqual({
|
|
99
|
+
ok: false,
|
|
100
|
+
reason: "breakout",
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
});
|
package/src/index.ts
CHANGED
|
@@ -116,3 +116,7 @@ export * from "./OpenProtocol";
|
|
|
116
116
|
export * from "./McpUiProtocol";
|
|
117
117
|
export * from "./ObservabilityDashboardProtocol";
|
|
118
118
|
export * from "./PlatformSettingsProtocol";
|
|
119
|
+
export * from "./PlatformBrandingCss";
|
|
120
|
+
export * from "./AuthCssContract";
|
|
121
|
+
export * from "./PlatformAuditProtocol";
|
|
122
|
+
export * from "./PlatformOpsProtocol";
|