fix: Gateway 화면에서 raw 프로필 ID 노출을 제거한다
불변 profileName은 라우팅과 저장 경계에 유지하고 사용자 출력은 공통 표시명을 사용한다. 기본 인스턴스 suffix를 숨기고 비기본 인스턴스만 사람이 읽을 수 있게 구분한다.
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import { readdir, readFile } from 'node:fs/promises';
|
||||
import { join } from 'node:path';
|
||||
import { describe, it } from 'node:test';
|
||||
|
||||
const collectVueFiles = async (directory) => {
|
||||
const entries = await readdir(directory, { withFileTypes: true });
|
||||
const nested = await Promise.all(
|
||||
entries.map((entry) => {
|
||||
const path = join(directory, entry.name);
|
||||
return entry.isDirectory() ? collectVueFiles(path) : entry.name.endsWith('.vue') ? [path] : [];
|
||||
})
|
||||
);
|
||||
return nested.flat();
|
||||
};
|
||||
|
||||
describe('gateway profile display boundary', () => {
|
||||
it('keeps immutable raw profile names out of ordinary Vue copy', async () => {
|
||||
const files = await collectVueFiles(new URL('../src', import.meta.url).pathname);
|
||||
const forbidden = [
|
||||
{ pattern: /\{\{\s*(?:profile|policy|operation)\.profileName\s*\}\}/, reason: 'direct interpolation' },
|
||||
{ pattern: /서버 ID:/, reason: 'raw server ID label' },
|
||||
{ pattern: /che:default/, reason: 'raw default profile example' },
|
||||
{ pattern: /profile:scenario/, reason: 'raw profile placeholder' },
|
||||
{
|
||||
pattern: /currentScenario\s*\?\?\s*profile\.profileName/,
|
||||
reason: 'raw notification fallback',
|
||||
},
|
||||
];
|
||||
|
||||
for (const file of files) {
|
||||
const source = await readFile(file, 'utf8');
|
||||
for (const contract of forbidden) {
|
||||
assert.doesNotMatch(source, contract.pattern, `${file}: ${contract.reason}`);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user