Initial curated chimera source from a8ae5b1db07fb49926c94585e2718e5130330974

This commit is contained in:
Public Source Publisher committed 2026-10-01 01:38:08 +02:00
commit c737a37f71
531 files changed
+119270

No files matched your search

@@ -0,0 +1,51 @@
'use strict';
const assert = require('node:assert/strict');
const fs = require('node:fs');
const path = require('node:path');
const test = require('node:test');
const { createConsoleProfileService } = require('../../src/services/console-profile-service');
class Settings {
constructor(values = {}) { this.values = values; }
get(key, fallback) { return Object.prototype.hasOwnProperty.call(this.values, key) ? this.values[key] : fallback; }
set(key, value) { this.values[key] = value; }
}
const secrets = { has: () => false, get: () => '', set() {} };
test('identity evidence is bounded, masked and exposed read-only without a mutation contract', () => {
const settings = new Settings({ 'console.identityEvidence': { localUsername: ' Local\u0000User ', accountId: 'abcdef1234567890', psnOnlineId: 'Player_One', linked: true, source: 'sentinel', observedAt: 1_800_000_000_000 } });
const service = createConsoleProfileService({ settings, secrets, uuid: () => 'profile-a' });
const identity = service.identity();
assert.equal(identity.local.username, 'Local User');
assert.equal(identity.local.accountIdMasked, '************7890');
assert.equal(identity.linkedPsn.onlineId, 'Player_One');
assert.equal(identity.readOnly, true);
assert.equal(identity.mutationAvailable, false);
assert.match(identity.officialOnlineIdGuidance, /^https:\/\/www\.playstation\.com\/support\//);
service.save({ id: 'profile-a', identity: { psnOnlineId: 'InjectedName', linked: true } });
assert.equal(service.identity().linkedPsn.onlineId, 'Player_One');
});
test('invalid identity fields fail closed instead of leaking unsafe values', () => {
const settings = new Settings({ 'console.identityEvidence': { localUsername: '<script>\nname', accountId: 'not-an-id', psnOnlineId: 'invalid online id!', linked: true, source: 'shell', observedAt: -1 } });
const identity = createConsoleProfileService({ settings, secrets, uuid: () => 'profile-b' }).identity();
assert.equal(identity.local.username, '<script> name');
assert.equal(identity.local.accountIdMasked, null);
assert.equal(identity.linkedPsn.onlineId, null);
assert.equal(identity.linkedPsn.linked, false);
assert.deepEqual(identity.provenance, { source: 'unknown', observedAt: null });
});
test('Settings navigator exposes the target IA and accessible read-only identity surface', () => {
const root = path.resolve(__dirname, '../..');
const navigation = fs.readFileSync(path.join(root, 'renderer/modules/navigation.js'), 'utf8');
const html = fs.readFileSync(path.join(root, 'renderer/index.html'), 'utf8');
for (const category of ['setup', 'console', 'storage', 'automation', 'integrations', 'security', 'advanced']) assert.match(navigation, new RegExp(`\\['${category}'`));
assert.doesNotMatch(navigation, /\['all', 'All'\]/);
assert.match(navigation, /let activeCategory = 'setup'/);
assert.match(html, /id="settings-console-identity-card"/);
assert.match(html, /data-i18n="settings\.identity\.readOnly"/);
assert.match(html, /playstation\.com\/support\/account\/change-psn-online-id/);
assert.doesNotMatch(html, /id="settings-identity-[^"]+"[^>]*type="text"/);
});