Skip to content

report-log — Log Field Inventory

บทนี้ (branch: master) รวบรวม ทุก field ที่พบในรูปแบบ request-log ของ vtrc-api ตามที่ commit ไว้ใน repo นี้ และชนิด PII ที่รั่ว — ค่าจริงถูก redact ในเอกสารนี้


1. Line envelope (นอก JSON)

Fieldตัวอย่างรูปแบบCitation
timestamp4/20/2023, 12:00:05 AM (locale th-TH ตาม TIME_ZONE ของ API)request_2023-04-20.log:1; writer wlog.js:19
level[INFO]request_2023-04-20.log:1

ในชุดไฟล์ที่ commit ไว้ การ grep [ERROR] / [WARNING] ใน report-log/ ไม่พบในระดับ request files ที่ตรวจ — response errors อยู่ใน response_*.log ของ API host ซึ่งไม่มีใน repo นี้


2. JSON top-level (ทุกบรรทัด request)

FieldAlways?ความหมายProducer citation
queryใช่ชื่อ operation หรือ full GraphQL string ที่ compress whitespacelogging.js:66
headersใช่สำเนา HTTP headers ของ requestlogging.js:68
fromใช่{ appId, userId } จาก Apollo contextlogging.js:69
variablesบางบรรทัดGraphQL variables object เมื่อ client ส่งแยกจาก query textlogging.js:67

3. from object

FieldTypeหมายเหตุCitation
appIdUUIDmap จาก device registry ของ vtrc-apirequest_2023-04-20.log:1
userIdUUID หรือ nullnull เมื่อยังไม่ authenticateตัวอย่าง null ใน request_2023-02-17.log (บรรทัดที่มี userId null)

4. headers keys ที่พบใน sample

จากการสุ่มอ่านไฟล์วันที่ 2023-02-17 / 03-20 / 04-20 พบ key ต่อไปนี้ (ไม่ครบทุกบรรทัดทุกวัน แต่เป็นชุดที่ปรากฏจริง):

accept, accept-encoding, accept-language, apikey, authorization, cache-control, connection, content-length, content-type, cookie, dnt, from, host, if-none-match, origin, postman-token, pragma, purpose, referer, save-data, sec-ch-ua, sec-ch-ua-mobile, sec-ch-ua-platform, sec-fetch-dest, sec-fetch-mode, sec-fetch-site, sec-gpc, sec-purpose, user-agent, x-forwarded-for, x-real-ip, x-requested-with

Header ที่เกี่ยวกับ security / PII

Headerใน log เป็นอย่างไรCitation
authorization_REPLACED_ (redact สำเร็จ)request_2023-04-20.log:1
apikeyค่าจริงของ device key (redact พลาดเพราะ case apiKey vs apikey)request_2023-04-20.log:1; logging.js:8
x-real-ip / x-forwarded-forIP จริงของผู้ใช้request_2023-04-20.log:1
hostvtrcapi.redcross.or.threquest_2023-04-20.log:1
user-agentระบุ client (เช่น VTRC/1 CFNetwork/... สำหรับ mobile)request_2023-04-20.log:1

5. variables — keys ที่พบใน sample

เมื่อ client ส่ง parameterized GraphQL จะมี object variables ตัวอย่าง keys ที่พบในชุด sample (ไม่ใช่ทุก key ทุกวัน):

address, adminCanPass, affiliation, age, apiKey, appVersion, approveStatus, approvers, attachFiles, birthDate, citizenId, clientType, confirmPassword, confirmNewPassword, department, description, docGroupId, email-related fields (sparse), empCode, empFirstName, empLastName, endDate, file, firstName, hospitalId, identityCard, lastName, leaveDay, leaveType, newPassword, oldPassword, organization, password, phoneNumber, postId, refreshToken, startDate, telNo, token, verificationCode, year, …

(รายการยาวเต็มจาก audit sample อยู่ใน research notes ของรอบนี้ — เอกสารเล่มนี้เน้นชนิดที่มีผลกระทบ PII)

Redaction ใน variables

เมื่อชื่อ key ตรงรายการใน replaceVariables ค่าจะเป็น _REPLACED_ — ตัวอย่าง:

"variables":{"oldPassword":"_REPLACED_","newPassword":"_REPLACED_","confirmNewPassword":"_REPLACED_"}

(พบใน request_2023-04-19.log ตาม audit)


6. PII / secrets ที่ฝังใน query string (ไม่ถูก redact)

นี่คือช่องโหว่หลักของ request-log format — argument ถูก serialize เข้า query โดยตรง

ชนิดข้อมูลPattern ใน queryตัวอย่าง citation (ค่า redact ในเอกสาร)
เลขบัตรประชาชน 13 หลักsendVerifyCode(citizenId:"...")request_2023-02-17.log (หลายบรรทัด; pattern ที่ app.js:10 ตั้งใจนับ)
วันเกิดbirthDate:"YYYY-MM-DD" ใน sendVerifyCodeบรรทัดเดียวกับ citizenId
รหัสพนักงานempCode:"..."บรรทัดเดียวกับ citizenId
รหัสผ่าน loginlogin(... password:"..." ...)request_2023-04-20.log (หลายบรรทัด)
รหัสผ่านเปลี่ยนchangePassword(oldPassword:... inlineไฟล์ช่วงเมษายน 2023
JWT / refreshrefreshToken(refreshToken:...,token:...)request_2023-04-20.log
FCM device tokenupdateDeviceToken / updatePublicDeviceTokenrequest_2023-02-17.log
identityCard ใน slipfetchSlip / fetchSlipPayDate / fetchSalaryCertrequest_2023-04-20.log
captcha blobcheckRequestCaptcha(csId:...)request_2023-02-17.log

ตัวอย่างรูปแบบ (ค่าแทนด้วย placeholder):

sendVerifyCode(citizenId:"[REDACTED_13]",birthDate:"[REDACTED_DATE]",
  organization:"3F3BF3AD-...",requestFor:CREATE_ACCOUNT,
  empCode:"[REDACTED_EMP]",sendMethod:SMS)

7. users.json fields

Fieldโครงสร้างCitation
(root)string[] ของ UUIDusers.json
count9,486parse JSON

ไฟล์นี้เองคือรายชื่อผู้ใช้ (identifier) ที่ commit ใน git — จัดเป็น PII ระดับ identifier แม้ไม่มีชื่อ-นามสกุลในไฟล์


8. Output record ของ setData (เมื่อรัน script)

FieldความหมายCitation
menustring จาก menu[count]app.js:132
userUUIDapp.js:132
typeJM / JW / OM / OWapp.js:132-141
datedateStart ณ รอบนั้นapp.js:132

CSV ที่เคยออกแบบไว้ (comment): {date},{menu},{user},{type} (app.js:225)


9. สรุปความรุนแรงของ field inventory

หมวดอยู่ใน committed logs?Redact โดย vtrc-api?
Bearer JWT ใน headerไม่ (เป็น _REPLACED_)ใช่
Device apikey ใน headerใช่ เต็มไม่ (case mismatch)
Client IPใช่ไม่
userId UUIDใช่ไม่
password ใน variablesเป็น _REPLACED_ใช่
password ใน query textใช่ plaintextไม่
citizenId ใน query textใช่ plaintextไม่
Email ใน log bodyไม่พบ @... จากการ grep รอบ audit

สำหรับ remediation ดู 04-scorecard — ลำดับแรกคือลบ/sanitize git history ของไฟล์ request_*.log และแก้ redaction ใน vtrc-api ให้ครอบคลุม inline query + header apikey