security: add .gitignore for credentials and remove eval() on remote content - #61
Open
kanasimi wants to merge 1 commit into
Open
security: add .gitignore for credentials and remove eval() on remote content#61kanasimi wants to merge 1 commit into
kanasimi wants to merge 1 commit into
Conversation
…content - Add .gitignore so the private 'wiki configuration.js' (real bot passwords, per README setup) and node_modules are never committed. - Replace eval() of remotely-fetched JMA page content in the tropical cyclone importer with a regex extraction of the typhoon id list, eliminating a remote-code-execution risk while preserving behavior. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the two critical issues found in a security scan of the repo (a collection of standalone MediaWiki bot scripts — no web server, so no CORS/auth/debug-endpoint surface).
1. No
.gitignore→ credential-leak risk (highest impact). The README setup tells users to copywiki configuration.sample.jstowiki configuration.jsand fill in real bot usernames/passwords, andwiki loader.jsdoesrequire('./wiki configuration.js'). With no.gitignore, that secret file (andnode_modules/) can easily be committed. Added a.gitignorethat excludeswiki configuration.js,.env*,node_modules/, and common runtime artifacts. Verified no currently-tracked files are ignored, and the pattern does not match the legitimately-committedspecial page configuration.js.2.
eval()on remotely-fetched content → remote code execution.routine/20190629.import_tropical_cyclone_images.jsdid:on the response from
jma.go.jp. A manipulated/compromised response would run arbitrary code on the bot host. Replaced with a regex that extracts thetyphoonList[i]="id"assignments — same resulting array, no code execution:Findings not changed here (no code touched)
eval(html.between('='))inroutine/20180511.headline.js(parser_東方日報): same RCE class, but the remote payload is JS object literals of unknown shape, so a safe rewrite risks breaking parsing. Recommend converting to a bounded parser; flagged for owner review.cejs/wikiapi/gh-updater="latest"inpackage.json): supply-chain risk; recommend pinning to reviewed versions.task/process_dump.js(parameterizedINSERT;DROP/CREATEuse a constant table name),eval()over an internal counter intraversal_pages.js, andchild_processcalls (array args / constant URLs / dead code) in the Tool-Labs importer scripts. No hardcoded secrets found in the tree or history.Link to Devin session: https://app.devin.ai/sessions/d9897a4abe2746b9ad05a27ad08a402f
Requested by: @kanasimi