-
Notifications
You must be signed in to change notification settings - Fork 219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Prevent GrowiPlugin from being downloaded outside the plugin directory #9712
fix: Prevent GrowiPlugin from being downloaded outside the plugin directory #9712
Conversation
|
catch (deleteErr) { | ||
logger.error(deleteErr); | ||
throw new Error(`Failed to delete plugin from GrowiPlugin documents. Original error: ${deleteErr.message}`); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ここでは GrowiPlugin のデータは消さなくてもいいかなあ
logger.error に出力して、あとは飲み込めばいいと思う
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
対応しました。
catch (err) { | ||
logger.error(err); | ||
throw new Error('Failed to constract plugin path'); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
回避したいのは deleteFolder
growiPluginsPath が不正なら、deleteFolder は実行せずその旨を logger.warn で出力。GrowiPlugin.deleteOne({ _id: pluginId });
は実行してほしい。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
これだと try-catch で catch に入らなかったら GrowiPlugin.deleteOne({ _id: pluginId });
が実行されないのでは?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
改めて条件整理
joinAndValidatePath
が valid でも invalid でも、GrowiPlugin.deleteOne
は実行するGrowiPlugin.deleteOne
が成功し、かつ(growiPluginsPath && fs.existsSync(growiPluginsPath))
なら、deleteFolder
を実行する
} | ||
} | ||
else { | ||
logger.warn(`Plugin path does not exist : ${growiPluginsPath}`); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import された plugin は、サーバーの起動時にインストールされるため。import してから、サーバー再起動の間にも、plugin を削除できるようにした。
catch (err) { | ||
logger.error(err); | ||
throw new Error('Failed to constract plugin path'); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
これだと try-catch で catch に入らなかったら GrowiPlugin.deleteOne({ _id: pluginId });
が実行されないのでは?
catch (err) { | ||
logger.error(err); | ||
throw new Error('Failed to constract plugin path'); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
改めて条件整理
joinAndValidatePath
が valid でも invalid でも、GrowiPlugin.deleteOne
は実行するGrowiPlugin.deleteOne
が成功し、かつ(growiPluginsPath && fs.existsSync(growiPluginsPath))
なら、deleteFolder
を実行する
Task