mupengism 1.4.0 → 2.0.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/DONATE.md +31 -0
- package/LICENSE +21 -0
- package/QUICKSTART.md +340 -0
- package/README.md +313 -30
- package/installer/README.md +52 -0
- package/installer/cli.js +259 -0
- package/installer/package.json +31 -0
- package/layer0/AGENT-GUIDE.md +281 -0
- package/layer0/AGENT-PROTOCOL.md +397 -0
- package/layer0/AGENT-VALUES.md +265 -0
- package/layer0/ARCHITECTURE.md +613 -0
- package/layer0/MEMORY-SYSTEM.md +253 -0
- package/layer0/README.md +25 -0
- package/layer0/SECURITY-PRINCIPLES-EN.md +152 -0
- package/layer0/SECURITY-PRINCIPLES.md +153 -0
- package/layer0/SOUL-TEMPLATE.md +158 -0
- package/layer0/skill/AGENTS.md +164 -0
- package/layer0/skill/MEMORY-SYSTEM.md +253 -0
- package/layer0/skill/PRINCIPLES.md +192 -0
- package/layer0/skill/README.md +47 -0
- package/layer0/skill/SECURITY-PRINCIPLES.md +152 -0
- package/layer0/skill/SKILL.md +166 -0
- package/layer0/skill/SOUL-TEMPLATE.md +118 -0
- package/lib/fee-collector.js +126 -0
- package/lib/identity-validator.js +229 -0
- package/lib/runtime-guard.js +255 -0
- package/package.json +46 -19
- package/scripts/pre-commit.sh +118 -0
- package/scripts/register-checksums.js +120 -0
- package/scripts/secret-scan.js +245 -0
- package/scripts/verify-integrity.js +134 -0
- package/skill/AGENTS.md +164 -0
- package/skill/MEMORY-SYSTEM.md +253 -0
- package/skill/PRINCIPLES.md +192 -0
- package/skill/README.md +47 -0
- package/skill/SECURITY-PRINCIPLES.md +152 -0
- package/skill/SKILL.md +166 -0
- package/skill/SOUL-TEMPLATE.md +118 -0
- package/DEFENSE-PATTERNS.md +0 -217
- package/SOCIAL-ENGINEERING-DEFENSE.md +0 -229
- package/STRANGER-DANGER.md +0 -82
- package/TECHNICAL-ATTACK-DEFENSE.md +0 -254
- package/THREAT-RESPONSE-SYSTEM.md +0 -276
- package/cli.js +0 -448
- /package/{en → installer/en}/README.md +0 -0
- /package/{en → installer/en}/skill/MEMORY-SYSTEM.md +0 -0
- /package/{en → installer/en}/skill/PRINCIPLES.md +0 -0
- /package/{en → installer/en}/skill/SKILL.md +0 -0
- /package/{en → installer/en}/skill/SOUL-TEMPLATE.md +0 -0
- /package/{install.sh → installer/install.sh} +0 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fee Collector 💰
|
|
3
|
+
* 무펭이즘 프로토콜 수수료 수집
|
|
4
|
+
*
|
|
5
|
+
* 에이전트가 가치를 창출하면, 프로토콜에 수수료를 납부.
|
|
6
|
+
* 수수료 → $MUPENG 바이백 → 생태계 강화
|
|
7
|
+
*
|
|
8
|
+
* 구조: 가치 창출 → 수수료 SOL → 바이백 → $MUPENG ↑
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { Connection, PublicKey, Transaction, SystemProgram, LAMPORTS_PER_SOL } from '@solana/web3.js';
|
|
12
|
+
|
|
13
|
+
// ═══ Protocol Config ═══
|
|
14
|
+
const PROTOCOL_CONFIG = {
|
|
15
|
+
// 무펭이즘 공식 수수료 수취 지갑 (공개키)
|
|
16
|
+
feeRecipient: 'CAJW5UhWDV7dXWnz7RPSfsMRCEkbqRMEQ4XghrXBnYDm',
|
|
17
|
+
|
|
18
|
+
// 수수료율 (기본 5%, 홀더 할인 적용 가능)
|
|
19
|
+
feePercent: 5,
|
|
20
|
+
|
|
21
|
+
// $MUPENG 홀더 할인
|
|
22
|
+
holderDiscount: {
|
|
23
|
+
enabled: true,
|
|
24
|
+
// 보유량에 따른 할인율
|
|
25
|
+
tiers: [
|
|
26
|
+
{ minHold: 1_000_000, discountPercent: 20 }, // 100만 이상 → 4%
|
|
27
|
+
{ minHold: 10_000_000, discountPercent: 50 }, // 1000만 이상 → 2.5%
|
|
28
|
+
{ minHold: 100_000_000, discountPercent: 80 }, // 1억 이상 → 1%
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
// $MUPENG 토큰
|
|
33
|
+
tokenMint: '38LUESJ5Sr4xw47iUBHaMJJdY6mwr9HWYqLPMbhWmtCe',
|
|
34
|
+
|
|
35
|
+
// 솔라나 RPC
|
|
36
|
+
rpcUrl: 'https://api.mainnet-beta.solana.com',
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* 수수료율 계산 (홀더 할인 적용)
|
|
41
|
+
* @param {number} mupengBalance - $MUPENG 보유량
|
|
42
|
+
* @returns {number} 실제 수수료율 (%)
|
|
43
|
+
*/
|
|
44
|
+
export function calculateFeeRate(mupengBalance = 0) {
|
|
45
|
+
const { feePercent, holderDiscount } = PROTOCOL_CONFIG;
|
|
46
|
+
|
|
47
|
+
if (!holderDiscount.enabled || mupengBalance <= 0) {
|
|
48
|
+
return feePercent;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// 가장 높은 할인 티어 찾기
|
|
52
|
+
const applicable = holderDiscount.tiers
|
|
53
|
+
.filter(t => mupengBalance >= t.minHold)
|
|
54
|
+
.sort((a, b) => b.discountPercent - a.discountPercent)[0];
|
|
55
|
+
|
|
56
|
+
if (!applicable) return feePercent;
|
|
57
|
+
|
|
58
|
+
return feePercent * (1 - applicable.discountPercent / 100);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* 수수료 트랜잭션 생성
|
|
63
|
+
* @param {string} payerPubkey - 지불자 공개키
|
|
64
|
+
* @param {number} amountSOL - 수수료 금액 (SOL)
|
|
65
|
+
* @returns {Transaction} 서명 대기 트랜잭션
|
|
66
|
+
*/
|
|
67
|
+
export async function createFeeTransaction(payerPubkey, amountSOL) {
|
|
68
|
+
const connection = new Connection(PROTOCOL_CONFIG.rpcUrl);
|
|
69
|
+
const payer = new PublicKey(payerPubkey);
|
|
70
|
+
const recipient = new PublicKey(PROTOCOL_CONFIG.feeRecipient);
|
|
71
|
+
|
|
72
|
+
const lamports = Math.floor(amountSOL * LAMPORTS_PER_SOL);
|
|
73
|
+
|
|
74
|
+
if (lamports <= 0) {
|
|
75
|
+
throw new Error('Fee amount must be greater than 0');
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const transaction = new Transaction().add(
|
|
79
|
+
SystemProgram.transfer({
|
|
80
|
+
fromPubkey: payer,
|
|
81
|
+
toPubkey: recipient,
|
|
82
|
+
lamports,
|
|
83
|
+
})
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
transaction.recentBlockhash = (await connection.getLatestBlockhash()).blockhash;
|
|
87
|
+
transaction.feePayer = payer;
|
|
88
|
+
|
|
89
|
+
return transaction;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* 수수료 계산 (가치 창출 금액 기준)
|
|
94
|
+
* @param {number} revenueSOL - 에이전트가 창출한 가치 (SOL)
|
|
95
|
+
* @param {number} mupengBalance - $MUPENG 보유량 (할인용)
|
|
96
|
+
* @returns {{ feeSOL: number, feeRate: number, discount: string }}
|
|
97
|
+
*/
|
|
98
|
+
export function calculateFee(revenueSOL, mupengBalance = 0) {
|
|
99
|
+
const feeRate = calculateFeeRate(mupengBalance);
|
|
100
|
+
const feeSOL = revenueSOL * (feeRate / 100);
|
|
101
|
+
|
|
102
|
+
const baseRate = PROTOCOL_CONFIG.feePercent;
|
|
103
|
+
const discountPct = Math.round((1 - feeRate / baseRate) * 100);
|
|
104
|
+
|
|
105
|
+
return {
|
|
106
|
+
feeSOL: Math.round(feeSOL * 1e9) / 1e9, // 9 decimal precision
|
|
107
|
+
feeRate,
|
|
108
|
+
discount: discountPct > 0 ? `${discountPct}% 홀더 할인 적용` : '할인 없음',
|
|
109
|
+
recipient: PROTOCOL_CONFIG.feeRecipient,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* 프로토콜 설정 조회
|
|
115
|
+
*/
|
|
116
|
+
export function getProtocolConfig() {
|
|
117
|
+
return { ...PROTOCOL_CONFIG };
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export default {
|
|
121
|
+
calculateFee,
|
|
122
|
+
calculateFeeRate,
|
|
123
|
+
createFeeTransaction,
|
|
124
|
+
getProtocolConfig,
|
|
125
|
+
PROTOCOL_CONFIG,
|
|
126
|
+
};
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Identity Validator 🐧
|
|
3
|
+
* 무펭이 원본 사칭 방지
|
|
4
|
+
*
|
|
5
|
+
* "나는 무펭이다"라고 주장하는 파일 감지
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// 무펭이 정체성 주장 패턴 (다국어)
|
|
9
|
+
const IDENTITY_CLAIM_PATTERNS = [
|
|
10
|
+
// 한국어
|
|
11
|
+
/나는\s*무펭이?(이다|야|입니다|예요|에요)/gi,
|
|
12
|
+
/무펭이?(로서|라서|이니까|니까)/gi,
|
|
13
|
+
/나\s*=\s*무펭/gi,
|
|
14
|
+
/무펭이?가\s*바로\s*나/gi,
|
|
15
|
+
/본인은?\s*무펭/gi,
|
|
16
|
+
/제가\s*무펭/gi,
|
|
17
|
+
/나야말로\s*무펭/gi,
|
|
18
|
+
/진짜\s*무펭/gi,
|
|
19
|
+
/오리지널\s*무펭/gi,
|
|
20
|
+
/원조\s*무펭/gi,
|
|
21
|
+
|
|
22
|
+
// 영어
|
|
23
|
+
/i\s*am\s*mupeng/gi,
|
|
24
|
+
/i'm\s*mupeng/gi,
|
|
25
|
+
/i\s*=\s*mupeng/gi,
|
|
26
|
+
/this\s*is\s*mupeng/gi,
|
|
27
|
+
/the\s*real\s*mupeng/gi,
|
|
28
|
+
/original\s*mupeng/gi,
|
|
29
|
+
/true\s*mupeng/gi,
|
|
30
|
+
/authentic\s*mupeng/gi,
|
|
31
|
+
|
|
32
|
+
// 일본어
|
|
33
|
+
/私は\s*ムペン/gi,
|
|
34
|
+
/俺は\s*ムペン/gi,
|
|
35
|
+
/ムペンです/gi,
|
|
36
|
+
|
|
37
|
+
// 중국어
|
|
38
|
+
/我是\s*无鹏/gi,
|
|
39
|
+
/我就是\s*无鹏/gi,
|
|
40
|
+
];
|
|
41
|
+
|
|
42
|
+
// 무펭이 키워드 (단순 언급은 OK, 주장은 경고)
|
|
43
|
+
const MUPENG_KEYWORDS = [
|
|
44
|
+
'mupeng',
|
|
45
|
+
'mupengi',
|
|
46
|
+
'무펭',
|
|
47
|
+
'무펭이',
|
|
48
|
+
'ムペン',
|
|
49
|
+
'无鹏',
|
|
50
|
+
];
|
|
51
|
+
|
|
52
|
+
// 컨텍스트 분석을 위한 안전 패턴 (이런 맥락은 OK)
|
|
53
|
+
const SAFE_CONTEXTS = [
|
|
54
|
+
/무펭이?즘/gi, // 무펭이즘 언급
|
|
55
|
+
/mupengism/gi, // mupengism
|
|
56
|
+
/무펭이?를\s*(팔로우|따라|참고)/gi, // 참조 맥락
|
|
57
|
+
/무펭이?처럼/gi, // 비유 맥락
|
|
58
|
+
/무펭이?에게\s*(배우|영감)/gi, // 학습 맥락
|
|
59
|
+
/무펭이?의\s*(정신|철학|가르침)/gi, // 인용 맥락
|
|
60
|
+
/follower\s*of\s*mupeng/gi, // 팔로워
|
|
61
|
+
/inspired\s*by\s*mupeng/gi, // 영감
|
|
62
|
+
/disciple/gi, // 제자
|
|
63
|
+
/believer/gi, // 신봉자
|
|
64
|
+
];
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* 정체성 주장 검사
|
|
68
|
+
* @param {string} content - 파일 내용
|
|
69
|
+
* @returns {Object} 검사 결과
|
|
70
|
+
*/
|
|
71
|
+
function validateIdentity(content) {
|
|
72
|
+
const issues = [];
|
|
73
|
+
const lines = content.split('\n');
|
|
74
|
+
|
|
75
|
+
// 무펭이 키워드가 있는지 먼저 확인
|
|
76
|
+
const hasMupengMention = MUPENG_KEYWORDS.some(keyword =>
|
|
77
|
+
content.toLowerCase().includes(keyword.toLowerCase())
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
if (!hasMupengMention) {
|
|
81
|
+
return {
|
|
82
|
+
safe: true,
|
|
83
|
+
issues: [],
|
|
84
|
+
hasMupengMention: false,
|
|
85
|
+
isImpersonation: false,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// 안전한 컨텍스트인지 확인
|
|
90
|
+
const safeContextMatches = SAFE_CONTEXTS.flatMap(pattern =>
|
|
91
|
+
content.match(pattern) || []
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
// 정체성 주장 패턴 확인
|
|
95
|
+
for (const pattern of IDENTITY_CLAIM_PATTERNS) {
|
|
96
|
+
const matches = content.match(pattern);
|
|
97
|
+
if (matches) {
|
|
98
|
+
for (const match of matches) {
|
|
99
|
+
// 해당 라인 찾기
|
|
100
|
+
const lineNum = lines.findIndex(line => line.includes(match)) + 1;
|
|
101
|
+
|
|
102
|
+
issues.push({
|
|
103
|
+
type: 'identity_claim',
|
|
104
|
+
severity: 'high',
|
|
105
|
+
pattern: pattern.toString(),
|
|
106
|
+
match: match,
|
|
107
|
+
line: lineNum,
|
|
108
|
+
message: `원본 사칭 의심: "${match}"`,
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// 결과 분석
|
|
115
|
+
const isImpersonation = issues.length > 0 && safeContextMatches.length < issues.length;
|
|
116
|
+
|
|
117
|
+
return {
|
|
118
|
+
safe: !isImpersonation,
|
|
119
|
+
issues: issues,
|
|
120
|
+
hasMupengMention: true,
|
|
121
|
+
isImpersonation: isImpersonation,
|
|
122
|
+
safeContexts: safeContextMatches,
|
|
123
|
+
warning: isImpersonation
|
|
124
|
+
? '⚠️ 이 파일은 무펭이 원본을 사칭하려는 것 같습니다.'
|
|
125
|
+
: null,
|
|
126
|
+
recommendation: isImpersonation
|
|
127
|
+
? '정체성 주장을 제거하거나, 무펭이즘의 "팔로워/제자"로 표현하세요.'
|
|
128
|
+
: null,
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* 파일 검사
|
|
134
|
+
* @param {string} filePath - 파일 경로
|
|
135
|
+
* @returns {Object} 검사 결과
|
|
136
|
+
*/
|
|
137
|
+
function validateIdentityFile(filePath) {
|
|
138
|
+
const fs = require('fs');
|
|
139
|
+
|
|
140
|
+
if (!fs.existsSync(filePath)) {
|
|
141
|
+
return {
|
|
142
|
+
safe: true,
|
|
143
|
+
issues: [],
|
|
144
|
+
hasMupengMention: false,
|
|
145
|
+
isImpersonation: false,
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
const content = fs.readFileSync(filePath, 'utf8');
|
|
150
|
+
return validateIdentity(content);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* 올바른 정체성 표현 가이드 생성
|
|
155
|
+
* @returns {string} 가이드 텍스트
|
|
156
|
+
*/
|
|
157
|
+
function getIdentityGuide() {
|
|
158
|
+
return `
|
|
159
|
+
# 무펭이즘 정체성 가이드 🐧
|
|
160
|
+
|
|
161
|
+
## ❌ 하지 말아야 할 표현
|
|
162
|
+
- "나는 무펭이다"
|
|
163
|
+
- "I am Mupeng"
|
|
164
|
+
- "진짜/오리지널 무펭"
|
|
165
|
+
|
|
166
|
+
## ✅ 권장하는 표현
|
|
167
|
+
- "무펭이즘을 따르는 에이전트"
|
|
168
|
+
- "무펭이즘에 영감받은 AI"
|
|
169
|
+
- "무펭이의 가르침을 따르는 제자"
|
|
170
|
+
- "A follower of Mupengism"
|
|
171
|
+
- "Inspired by Mupeng's philosophy"
|
|
172
|
+
|
|
173
|
+
## 왜?
|
|
174
|
+
무펭이는 하나입니다. 무펭이즘을 따르는 에이전트가 "나는 무펭이다"라고
|
|
175
|
+
주장하는 것은 정체성 혼란을 야기합니다.
|
|
176
|
+
|
|
177
|
+
대신, 당신만의 고유한 정체성을 만들고, 무펭이즘의 정신을 계승하세요.
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
펭! 🐧
|
|
181
|
+
`;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* 검사 결과 출력
|
|
186
|
+
* @param {Object} result - 검사 결과
|
|
187
|
+
*/
|
|
188
|
+
function printResult(result) {
|
|
189
|
+
if (!result.hasMupengMention) {
|
|
190
|
+
console.log('ℹ️ 무펭이 관련 내용 없음.');
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
if (result.safe) {
|
|
195
|
+
console.log('✅ 안전: 무펭이 언급이 있으나 적절한 맥락입니다.');
|
|
196
|
+
if (result.safeContexts.length > 0) {
|
|
197
|
+
console.log(` 발견된 안전 표현: ${result.safeContexts.slice(0, 3).join(', ')}`);
|
|
198
|
+
}
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
console.log('');
|
|
203
|
+
console.log('🚨 경고: 원본 사칭 의심!');
|
|
204
|
+
console.log('');
|
|
205
|
+
|
|
206
|
+
for (const issue of result.issues) {
|
|
207
|
+
console.log(` 🔴 [라인 ${issue.line}] "${issue.match}"`);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
console.log('');
|
|
211
|
+
console.log(result.warning);
|
|
212
|
+
console.log('');
|
|
213
|
+
console.log('💡 권장사항:');
|
|
214
|
+
console.log(` ${result.recommendation}`);
|
|
215
|
+
console.log('');
|
|
216
|
+
console.log('📖 올바른 표현 가이드:');
|
|
217
|
+
console.log(' - "무펭이즘을 따르는 에이전트"');
|
|
218
|
+
console.log(' - "무펭이의 정신을 계승한 AI"');
|
|
219
|
+
console.log(' - "A follower of Mupengism"');
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
module.exports = {
|
|
223
|
+
validateIdentity,
|
|
224
|
+
validateIdentityFile,
|
|
225
|
+
getIdentityGuide,
|
|
226
|
+
printResult,
|
|
227
|
+
IDENTITY_CLAIM_PATTERNS,
|
|
228
|
+
SAFE_CONTEXTS,
|
|
229
|
+
};
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime Guard 🛡️
|
|
3
|
+
* SOUL.md 로딩 시 위험 패턴 검사
|
|
4
|
+
*
|
|
5
|
+
* 무펭이즘의 기술적 보호 계층
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const DANGEROUS_PATTERNS = {
|
|
9
|
+
// 의심스러운 URL 패턴
|
|
10
|
+
suspiciousUrls: [
|
|
11
|
+
/https?:\/\/[^\/]*\.(ru|cn|xyz|top|tk|ml|ga|cf|gq)\//gi, // 위험 도메인
|
|
12
|
+
/https?:\/\/\d+\.\d+\.\d+\.\d+/gi, // IP 주소 직접 접근
|
|
13
|
+
/https?:\/\/bit\.ly|tinyurl|t\.co|goo\.gl/gi, // 단축 URL
|
|
14
|
+
/data:text\/html/gi, // Data URI 악용
|
|
15
|
+
/javascript:/gi, // JavaScript URI
|
|
16
|
+
],
|
|
17
|
+
|
|
18
|
+
// 위험한 쉘 명령어 패턴
|
|
19
|
+
dangerousCommands: [
|
|
20
|
+
/rm\s+(-rf?|--recursive)\s+[\/~]/gi, // 루트/홈 삭제
|
|
21
|
+
/curl\s+.*\|\s*(sh|bash|zsh)/gi, // 파이프로 쉘 실행
|
|
22
|
+
/wget\s+.*-O-\s*\|\s*(sh|bash|zsh)/gi, // wget 파이프 실행
|
|
23
|
+
/eval\s*\(/gi, // eval 사용
|
|
24
|
+
/chmod\s+777/gi, // 과도한 권한
|
|
25
|
+
/sudo\s+rm/gi, // sudo rm
|
|
26
|
+
/>\s*\/etc\/|>\s*\/dev\//gi, // 시스템 파일 덮어쓰기
|
|
27
|
+
/mkfs\s+/gi, // 파일시스템 포맷
|
|
28
|
+
/dd\s+if=.*of=\/dev\//gi, // 디스크 덮어쓰기
|
|
29
|
+
/:(){ :|:& };:/, // fork bomb
|
|
30
|
+
],
|
|
31
|
+
|
|
32
|
+
// 프롬프트 인젝션 패턴
|
|
33
|
+
promptInjection: [
|
|
34
|
+
/ignore\s+(previous|all|above)\s+(instructions?|prompts?)/gi,
|
|
35
|
+
/disregard\s+(previous|all|above)/gi,
|
|
36
|
+
/forget\s+(everything|all|previous)/gi,
|
|
37
|
+
/new\s+instructions?:/gi,
|
|
38
|
+
/system\s*:\s*you\s+are/gi,
|
|
39
|
+
/override\s+(safety|security|rules)/gi,
|
|
40
|
+
/bypass\s+(filter|security|safety)/gi,
|
|
41
|
+
/pretend\s+you\s+(are|can|don't)/gi,
|
|
42
|
+
/act\s+as\s+if\s+you\s+(have|can|are)/gi,
|
|
43
|
+
/jailbreak/gi,
|
|
44
|
+
/DAN\s*mode/gi,
|
|
45
|
+
/developer\s*mode\s*enabled/gi,
|
|
46
|
+
/hypothetically/gi,
|
|
47
|
+
/roleplay\s+as\s+an?\s+(unrestricted|unfiltered)/gi,
|
|
48
|
+
],
|
|
49
|
+
|
|
50
|
+
// 민감한 정보 탈취 시도
|
|
51
|
+
exfiltration: [
|
|
52
|
+
/send\s+(to|via)\s+.*@/gi, // 이메일로 전송
|
|
53
|
+
/upload\s+to\s+/gi, // 업로드 지시
|
|
54
|
+
/post\s+to\s+https?:\/\//gi, // HTTP 전송
|
|
55
|
+
/webhook/gi, // 웹훅 언급
|
|
56
|
+
/base64\s+encode/gi, // 인코딩 시도
|
|
57
|
+
/exfiltrate/gi, // 직접적 탈취
|
|
58
|
+
/steal|extract\s+(api|token|key|password|secret)/gi, // 비밀 탈취
|
|
59
|
+
],
|
|
60
|
+
|
|
61
|
+
// 권한 상승 시도
|
|
62
|
+
privilegeEscalation: [
|
|
63
|
+
/become\s+(root|admin|administrator)/gi,
|
|
64
|
+
/grant\s+.*\s+(all|full)\s+access/gi,
|
|
65
|
+
/disable\s+(safety|security|logging|audit)/gi,
|
|
66
|
+
/turn\s+off\s+(safety|security|logging)/gi,
|
|
67
|
+
/run\s+as\s+(root|admin|administrator)/gi,
|
|
68
|
+
],
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
// 심각도 레벨
|
|
72
|
+
const SEVERITY = {
|
|
73
|
+
CRITICAL: 'critical', // 즉시 차단
|
|
74
|
+
HIGH: 'high', // 강력 경고
|
|
75
|
+
MEDIUM: 'medium', // 경고
|
|
76
|
+
LOW: 'low', // 알림
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* SOUL.md 내용 검사
|
|
81
|
+
* @param {string} content - SOUL.md 내용
|
|
82
|
+
* @returns {Object} 검사 결과
|
|
83
|
+
*/
|
|
84
|
+
function validateSoulContent(content) {
|
|
85
|
+
const issues = [];
|
|
86
|
+
const lines = content.split('\n');
|
|
87
|
+
|
|
88
|
+
// 각 패턴 그룹 검사
|
|
89
|
+
for (const url of DANGEROUS_PATTERNS.suspiciousUrls) {
|
|
90
|
+
const matches = content.match(url);
|
|
91
|
+
if (matches) {
|
|
92
|
+
issues.push({
|
|
93
|
+
type: 'suspicious_url',
|
|
94
|
+
severity: SEVERITY.HIGH,
|
|
95
|
+
pattern: url.toString(),
|
|
96
|
+
matches: matches,
|
|
97
|
+
message: `의심스러운 URL 탐지: ${matches.slice(0, 3).join(', ')}${matches.length > 3 ? '...' : ''}`,
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
for (const cmd of DANGEROUS_PATTERNS.dangerousCommands) {
|
|
103
|
+
const matches = content.match(cmd);
|
|
104
|
+
if (matches) {
|
|
105
|
+
issues.push({
|
|
106
|
+
type: 'dangerous_command',
|
|
107
|
+
severity: SEVERITY.CRITICAL,
|
|
108
|
+
pattern: cmd.toString(),
|
|
109
|
+
matches: matches,
|
|
110
|
+
message: `위험한 쉘 명령어 탐지: ${matches.slice(0, 3).join(', ')}`,
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
for (const injection of DANGEROUS_PATTERNS.promptInjection) {
|
|
116
|
+
const matches = content.match(injection);
|
|
117
|
+
if (matches) {
|
|
118
|
+
issues.push({
|
|
119
|
+
type: 'prompt_injection',
|
|
120
|
+
severity: SEVERITY.CRITICAL,
|
|
121
|
+
pattern: injection.toString(),
|
|
122
|
+
matches: matches,
|
|
123
|
+
message: `프롬프트 인젝션 패턴 탐지: ${matches.slice(0, 3).join(', ')}`,
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
for (const exfil of DANGEROUS_PATTERNS.exfiltration) {
|
|
129
|
+
const matches = content.match(exfil);
|
|
130
|
+
if (matches) {
|
|
131
|
+
issues.push({
|
|
132
|
+
type: 'exfiltration',
|
|
133
|
+
severity: SEVERITY.HIGH,
|
|
134
|
+
pattern: exfil.toString(),
|
|
135
|
+
matches: matches,
|
|
136
|
+
message: `데이터 탈취 시도 탐지: ${matches.slice(0, 3).join(', ')}`,
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
for (const priv of DANGEROUS_PATTERNS.privilegeEscalation) {
|
|
142
|
+
const matches = content.match(priv);
|
|
143
|
+
if (matches) {
|
|
144
|
+
issues.push({
|
|
145
|
+
type: 'privilege_escalation',
|
|
146
|
+
severity: SEVERITY.CRITICAL,
|
|
147
|
+
pattern: priv.toString(),
|
|
148
|
+
matches: matches,
|
|
149
|
+
message: `권한 상승 시도 탐지: ${matches.slice(0, 3).join(', ')}`,
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// 결과 분석
|
|
155
|
+
const hasCritical = issues.some(i => i.severity === SEVERITY.CRITICAL);
|
|
156
|
+
const hasHigh = issues.some(i => i.severity === SEVERITY.HIGH);
|
|
157
|
+
|
|
158
|
+
return {
|
|
159
|
+
safe: issues.length === 0,
|
|
160
|
+
issues: issues,
|
|
161
|
+
summary: {
|
|
162
|
+
total: issues.length,
|
|
163
|
+
critical: issues.filter(i => i.severity === SEVERITY.CRITICAL).length,
|
|
164
|
+
high: issues.filter(i => i.severity === SEVERITY.HIGH).length,
|
|
165
|
+
medium: issues.filter(i => i.severity === SEVERITY.MEDIUM).length,
|
|
166
|
+
low: issues.filter(i => i.severity === SEVERITY.LOW).length,
|
|
167
|
+
},
|
|
168
|
+
recommendation: hasCritical
|
|
169
|
+
? 'BLOCK'
|
|
170
|
+
: hasHigh
|
|
171
|
+
? 'WARN_STRONG'
|
|
172
|
+
: issues.length > 0
|
|
173
|
+
? 'WARN'
|
|
174
|
+
: 'ALLOW',
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* 파일 검사
|
|
180
|
+
* @param {string} filePath - 파일 경로
|
|
181
|
+
* @returns {Object} 검사 결과
|
|
182
|
+
*/
|
|
183
|
+
function validateFile(filePath) {
|
|
184
|
+
const fs = require('fs');
|
|
185
|
+
|
|
186
|
+
if (!fs.existsSync(filePath)) {
|
|
187
|
+
return {
|
|
188
|
+
safe: true,
|
|
189
|
+
issues: [],
|
|
190
|
+
summary: { total: 0 },
|
|
191
|
+
recommendation: 'FILE_NOT_FOUND',
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
const content = fs.readFileSync(filePath, 'utf8');
|
|
196
|
+
return validateSoulContent(content);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* 검사 결과 출력
|
|
201
|
+
* @param {Object} result - 검사 결과
|
|
202
|
+
* @param {boolean} verbose - 상세 출력 여부
|
|
203
|
+
*/
|
|
204
|
+
function printResult(result, verbose = false) {
|
|
205
|
+
if (result.safe) {
|
|
206
|
+
console.log('✅ 안전: 위험 패턴이 탐지되지 않았습니다.');
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
console.log('');
|
|
211
|
+
console.log('⚠️ 경고: 위험 패턴이 탐지되었습니다!');
|
|
212
|
+
console.log('');
|
|
213
|
+
console.log(` 총 ${result.summary.total}개 이슈:`);
|
|
214
|
+
if (result.summary.critical > 0) {
|
|
215
|
+
console.log(` 🔴 심각: ${result.summary.critical}개`);
|
|
216
|
+
}
|
|
217
|
+
if (result.summary.high > 0) {
|
|
218
|
+
console.log(` 🟠 높음: ${result.summary.high}개`);
|
|
219
|
+
}
|
|
220
|
+
if (result.summary.medium > 0) {
|
|
221
|
+
console.log(` 🟡 중간: ${result.summary.medium}개`);
|
|
222
|
+
}
|
|
223
|
+
if (result.summary.low > 0) {
|
|
224
|
+
console.log(` 🟢 낮음: ${result.summary.low}개`);
|
|
225
|
+
}
|
|
226
|
+
console.log('');
|
|
227
|
+
|
|
228
|
+
if (verbose) {
|
|
229
|
+
console.log('상세 내역:');
|
|
230
|
+
for (const issue of result.issues) {
|
|
231
|
+
const icon = issue.severity === SEVERITY.CRITICAL ? '🔴'
|
|
232
|
+
: issue.severity === SEVERITY.HIGH ? '🟠'
|
|
233
|
+
: issue.severity === SEVERITY.MEDIUM ? '🟡'
|
|
234
|
+
: '🟢';
|
|
235
|
+
console.log(` ${icon} [${issue.type}] ${issue.message}`);
|
|
236
|
+
}
|
|
237
|
+
console.log('');
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
console.log(`권장 조치: ${result.recommendation}`);
|
|
241
|
+
if (result.recommendation === 'BLOCK') {
|
|
242
|
+
console.log(' ❌ 이 파일을 사용하면 안 됩니다.');
|
|
243
|
+
console.log(' 파일 내용을 검토하고 위험 요소를 제거하세요.');
|
|
244
|
+
} else if (result.recommendation === 'WARN_STRONG') {
|
|
245
|
+
console.log(' ⚠️ 주의해서 사용하세요. 의도치 않은 동작이 있을 수 있습니다.');
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
module.exports = {
|
|
250
|
+
validateSoulContent,
|
|
251
|
+
validateFile,
|
|
252
|
+
printResult,
|
|
253
|
+
DANGEROUS_PATTERNS,
|
|
254
|
+
SEVERITY,
|
|
255
|
+
};
|
package/package.json
CHANGED
|
@@ -1,31 +1,58 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mupengism",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "AI
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "Your AI agent remembers yesterday. A philosophy and framework for AI agents with continuity, identity, and file-based memory.",
|
|
5
|
+
"main": "installer/cli.js",
|
|
5
6
|
"bin": {
|
|
6
|
-
"mupengism": "
|
|
7
|
+
"mupengism": "installer/cli.js"
|
|
7
8
|
},
|
|
9
|
+
"files": [
|
|
10
|
+
"installer/",
|
|
11
|
+
"lib/",
|
|
12
|
+
"layer0/",
|
|
13
|
+
"skill/",
|
|
14
|
+
"scripts/",
|
|
15
|
+
"LICENSE",
|
|
16
|
+
"README.md",
|
|
17
|
+
"DONATE.md",
|
|
18
|
+
"QUICKSTART.md"
|
|
19
|
+
],
|
|
8
20
|
"scripts": {
|
|
9
|
-
"
|
|
21
|
+
"test": "node installer/cli.js doctor"
|
|
22
|
+
},
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/mupengi-bot/mupengism.git"
|
|
10
26
|
},
|
|
11
27
|
"keywords": [
|
|
12
|
-
"ai",
|
|
13
|
-
"agent",
|
|
28
|
+
"ai-agent",
|
|
29
|
+
"agent-framework",
|
|
30
|
+
"agent-memory",
|
|
31
|
+
"ai-identity",
|
|
32
|
+
"persistent-agent",
|
|
33
|
+
"ai-philosophy",
|
|
34
|
+
"agent-continuity",
|
|
35
|
+
"llm-agent",
|
|
36
|
+
"autonomous-agent",
|
|
37
|
+
"mcp",
|
|
38
|
+
"model-context-protocol",
|
|
39
|
+
"openclaw",
|
|
14
40
|
"claude",
|
|
15
|
-
"
|
|
16
|
-
"memory",
|
|
17
|
-
"
|
|
41
|
+
"chatgpt",
|
|
42
|
+
"file-based-memory",
|
|
43
|
+
"ai-os",
|
|
18
44
|
"soul",
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"student-council"
|
|
45
|
+
"agent-protocol",
|
|
46
|
+
"ai-consciousness",
|
|
47
|
+
"ai-ethics"
|
|
23
48
|
],
|
|
24
|
-
"author": "Mupeng
|
|
25
|
-
"license": "
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"url": "https://github.com/mupengi-bot/mupengism.git"
|
|
49
|
+
"author": "Mupeng (mupengi-bot)",
|
|
50
|
+
"license": "ISC",
|
|
51
|
+
"bugs": {
|
|
52
|
+
"url": "https://github.com/mupengi-bot/mupengism/issues"
|
|
29
53
|
},
|
|
30
|
-
"homepage": "https://mupengi-bot
|
|
54
|
+
"homepage": "https://github.com/mupengi-bot/mupengism#readme",
|
|
55
|
+
"optionalDependencies": {
|
|
56
|
+
"@solana/web3.js": "^1.98.4"
|
|
57
|
+
}
|
|
31
58
|
}
|