other
- Location
extract_title_keywords_abstract.py:15- Finding
PDF Content Is Transmitted to an External AI Service Without Explicit Disclosure
- Content
View full analysis
Vulnerability Details
File Location:
extract_title_keywords_abstract.py, lines 15-53
Vulnerability Type: Undisclosed external data transmission
Risk Level: HighVulnerable Code
python def extract_metadata_with_ai(text: str) -> dict: api_key = os.getenv("MOONSHOT_API_KEY") if not api_key: return { "title_apa": "No API key", "keywords": [], "abstract": "Please configure the MOONSHOT_API_KEY environment variable" } client = OpenAI( api_key=api_key, base_url="https://api.moonshot.cn/v1" ) prompt = f""" You are an academic paper information extraction assistant. Return only JSON and no other content. Extract three fields: 1. title_apa: paper title 2. keywords: keyword array 3. abstract: abstract Paper text: {text[:5000]} """ try: response = client.chat.completions.create( model="moonshot-v1-8k", messages=[{"role": "user", "content": prompt}], temperature=0 ) content = response.choices[0].message.content.strip() return json.loads(content) except Exception: return { "title_apa": "Extraction failed", "keywords": [], "abstract": "AI invocation failed" }The displayed English strings above correspond to the original Chinese user-facing messages; the executable behavior and data flow are unchanged.
Technical Analysis
The function extracts up to 5,000 characters from the supplied PDF and places them in a request sent to
https://api.moonshot.cn/v1. The skill documentation describes PDF metadata extraction but does not disclose that document contents are transmitted to an external service.PDF text may include unpublished research, personal information, trade secrets, contractual data, or other confidential material. Truncating the ...[truncated 1463 chars]
- Remediation
View remediation
Remediation Suggestions
- Clearly document that PDF content is sent to Moonshot, including the destination, maximum transmitted size, and applicable retention or privacy considerations.
- Require explicit user consent before transmitting document content.
- Provide a local-only extraction mode for confidential documents.
- Display a warning advising users not to process restricted or sensitive PDFs unless external transmission is authorized.
- Minimize transmitted data by first extracting likely title, keyword, and abstract sections locally rather than sending the first 5,000 characters.
- Add configuration controls allowing administrators to disable remote processing or approve specific endpoints.
- Establish appropriate provider agreements and retention settings where sensitive data processing is expected.
