Skip to content

feat(web): add declarative community skins - #3340

Open
sdfsfsk wants to merge 1 commit into
MoonshotAI:mainfrom
sdfsfsk:feat/community-web-skins
Open

feat(web): add declarative community skins#3340
sdfsfsk wants to merge 1 commit into
MoonshotAI:mainfrom
sdfsfsk:feat/community-web-skins

Conversation

@sdfsfsk

@sdfsfsk sdfsfsk commented Aug 28, 2026

Copy link
Copy Markdown

Summary

  • add a code-free webSkin.tokens contribution to Kimi plugin manifests
  • validate a versioned light/dark design-token document and reject mixed agent-runtime capabilities
  • generate a deterministic same-origin stylesheet for enabled skins and inject it after the bundled Web stylesheet without modifying the code-app bundle
  • document the authoring contract in English and Chinese

Security

  • accepts only allowlisted Kimi token names and bounded values
  • rejects CSS escapes, comments, !important, unknown functions, image/network-loading constructs, executable content, and arbitrary CSS
  • limits token files to 64 KB, 256 tokens, and 256 UTF-8 bytes per value
  • serves generated CSS with no-store, nosniff, and same-origin resource policy headers

Verification

  • pnpm --filter @moonshot-ai/agent-core-v2 typecheck
  • pnpm --filter @moonshot-ai/kap-server typecheck
  • focused plugin manifest tests: 11 passed
  • focused skin and Web asset tests: 9 passed
  • pnpm lint
  • pnpm --filter @moonshot-ai/kimi-code build
  • installed and visually verified a public example skin through the GitHub plugin flow

Example skin: https://github.com/sdfsfsk/kimi-code-skin-moonlight

@changeset-bot

changeset-bot Bot commented Aug 28, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 7d5e8ff

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7d5e8ff691

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +213 to +215
if (
manifest.webSkin !== undefined &&
(hasRuntimeCapabilities(manifest) || hasDeclaredRuntimeCapabilities(raw))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Enforce runtime isolation for every webSkin declaration

When webSkin is malformed, references a missing file, or contains invalid tokens, readWebSkin returns undefined, so this condition skips the runtime-capability check. A plugin declaring that invalid skin alongside a system prompt, hook, MCP server, or Skill therefore remains in the ok state and executes those capabilities, violating the promised security boundary for code-free skins. Base the exclusivity check on the raw presence of webSkin, even when its contents fail validation.

Useful? React with 👍 / 👎.

Comment on lines +442 to +450
function hasUnsafeWebSkinTokenValue(value: string): boolean {
if (
/[;{}@\\\u0000-\u001F\u007F]/u.test(value) ||
/javascript\s*:|!\s*important|\/\*|\*\//iu.test(value)
) {
return true;
}
for (const match of value.matchAll(/([A-Za-z][A-Za-z0-9-]*)\s*\(/gu)) {
if (!WEB_SKIN_SAFE_FUNCTION_NAMES.has((match[1] ?? '').toLowerCase())) return true;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reject syntactically malformed CSS token values

When a value contains only allowlisted text but has unbalanced CSS syntax—for example an unmatched quote or calc(—this validator accepts it and compileWebSkinTokens writes it verbatim. The browser then discards the declaration, and an unterminated string or function can consume subsequent generated blocks, allowing one enabled skin to prevent later tokens or skins from applying. Validate balanced strings, functions, and delimiters rather than checking function names alone.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant