feat(plugins): move game resources behind marketplace
This commit is contained in:
@@ -37,9 +37,14 @@ const MARKETPLACE_ARTIFACT_MARKERS = Object.freeze({
|
||||
packageTrust: Object.freeze([
|
||||
'makelore-plugin-release.v1',
|
||||
'skill_only',
|
||||
'platform_hosted',
|
||||
'plugin_signature_invalid',
|
||||
'signing key is not trusted',
|
||||
]),
|
||||
hostedRuntime: Object.freeze([
|
||||
'makelore.game-resource',
|
||||
'/api/plugins/v1/hosted/game-resource/generations',
|
||||
]),
|
||||
mainRoutes: Object.freeze([
|
||||
'/api/coding/plugin-marketplace',
|
||||
'plugin-marketplace\\/install\\/',
|
||||
@@ -56,6 +61,13 @@ const MARKETPLACE_ARTIFACT_MARKERS = Object.freeze({
|
||||
'我的插件',
|
||||
]),
|
||||
});
|
||||
const FORBIDDEN_MEOWA_ARTIFACT_MARKERS = Object.freeze([
|
||||
'MEOWA_API_KEY',
|
||||
'MEOWA_API_URL',
|
||||
'MEOWA_GAME_ASSETS_SHARED_SECRET',
|
||||
'/api/coding/meowa-game-assets',
|
||||
'https://api.meowa.ai',
|
||||
]);
|
||||
const CODE_OWNED_PLUGIN_SIGNING_KEYS_SOURCE_MARKER = 'makelore.plugin-trust.code-owned.v1';
|
||||
const PI_AI_PROVIDER_PREFIX = 'pi-runtime/node_modules/@earendil-works/pi-ai/dist/providers/';
|
||||
const PI_AI_PROVIDER_ASAR_PREFIX = 'app.asar/node_modules/@earendil-works/pi-ai/dist/providers/';
|
||||
@@ -297,6 +309,12 @@ export function verifyMarketplaceClientArtifact(appAsarContents, productionTrust
|
||||
if (missing.length > 0) {
|
||||
throw new Error(`Packaged app.asar does not contain Marketplace contract markers: ${missing.join(', ')}`);
|
||||
}
|
||||
const forbidden = FORBIDDEN_MEOWA_ARTIFACT_MARKERS.filter((marker) => (
|
||||
appAsarContents.includes(Buffer.from(marker))
|
||||
));
|
||||
if (forbidden.length > 0) {
|
||||
throw new Error(`Packaged app.asar still contains legacy Meowa client authority: ${forbidden.join(', ')}`);
|
||||
}
|
||||
const hasEmptyCodeOwnedTrust = /(?:CODE_OWNED_PLUGIN_SIGNING_KEYS\s*=\s*)?Object\.freeze\(\s*\{\}\s*(?:as\s+[^)]*)?\)/u.test(productionTrustSource);
|
||||
if (!hasEmptyCodeOwnedTrust
|
||||
|| !productionTrustSource.includes(CODE_OWNED_PLUGIN_SIGNING_KEYS_SOURCE_MARKER)
|
||||
@@ -307,6 +325,8 @@ export function verifyMarketplaceClientArtifact(appAsarContents, productionTrust
|
||||
}
|
||||
return {
|
||||
schema2SkillOnly: true,
|
||||
schema2PlatformHosted: true,
|
||||
legacyMeowaClientAuthorityAbsent: true,
|
||||
productionTrust: 'official-key-absent-fail-closed',
|
||||
libraryInstallAndEffectiveRoutes: true,
|
||||
rendererAssets: true,
|
||||
|
||||
Reference in New Issue
Block a user