evot-agent 0.2.1 → 0.2.2
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/package.json +1 -1
- package/src/browse.js +24 -1
- package/src/install.js +3 -1
package/package.json
CHANGED
package/src/browse.js
CHANGED
|
@@ -102,12 +102,26 @@ export async function runBrowseJob(job) {
|
|
|
102
102
|
return finalText.trim();
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
+
/**
|
|
106
|
+
* 마커 도메인이 평범한 호스트네임 형태인지 검증한다.
|
|
107
|
+
* 신뢰 불가한 페이지가 모델을 속여 가짜 도메인을 주입 → 재로그인 안내로 피싱 URL을
|
|
108
|
+
* 흘리는 것을 막는다(경로·포트·IP·인접 점 차단).
|
|
109
|
+
*/
|
|
110
|
+
function isSafeDomain(d) {
|
|
111
|
+
return (
|
|
112
|
+
typeof d === "string" &&
|
|
113
|
+
/^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+$/i.test(d) &&
|
|
114
|
+
!d.includes("..") &&
|
|
115
|
+
/\.[a-z]{2,}$/i.test(d)
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
|
|
105
119
|
/**
|
|
106
120
|
* 잡 실패를 셀/텔레그램에 남길 사용자용 텍스트로 조립한다.
|
|
107
121
|
* loginDomain(세션만료 마커)이 있으면 재로그인 절차를 안내한다.
|
|
108
122
|
*/
|
|
109
123
|
export function describeJobFailure(err) {
|
|
110
|
-
if (err?.loginDomain) {
|
|
124
|
+
if (err?.loginDomain && isSafeDomain(err.loginDomain)) {
|
|
111
125
|
return [
|
|
112
126
|
`The web agent is signed out of ${err.loginDomain}, so this task could not be completed.`,
|
|
113
127
|
"",
|
|
@@ -116,5 +130,14 @@ export function describeJobFailure(err) {
|
|
|
116
130
|
"sign in once in the window that opens, then ask the Vot to retry this task.",
|
|
117
131
|
].join("\n");
|
|
118
132
|
}
|
|
133
|
+
if (err?.loginDomain) {
|
|
134
|
+
// 도메인이 의심스러우면 URL을 그대로 흘리지 않고 유저가 직접 지정하게 안내.
|
|
135
|
+
return [
|
|
136
|
+
"The web agent hit a login wall it could not pass, so this task could not be completed.",
|
|
137
|
+
"",
|
|
138
|
+
"To fix it, on the connected computer run `evot-agent login <site-url>`",
|
|
139
|
+
"with the site you want to collect from, sign in once, then ask the Vot to retry.",
|
|
140
|
+
].join("\n");
|
|
141
|
+
}
|
|
119
142
|
return `The web agent could not complete this task.\n\nReason: ${err?.message ?? "unknown"}`;
|
|
120
143
|
}
|
package/src/install.js
CHANGED