Skip to content

Commit 3ace997

Browse files
authored
Implements increased security measures concerning the sending of settings (#94)
* Added new setting to allow users to send module settings (default: false) * Added poor man's filter and fixed bug with sending module settings. * Removed left over debugging tools. * Added some extra styling per Calego's request.
1 parent fce9d8a commit 3ace997

File tree

3 files changed

+19
-10
lines changed

3 files changed

+19
-10
lines changed

Module/lang/en.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
"incomplete": "Please finish filling out required values."
2626
},
2727
"options": {
28-
"activemod": "Send list of active modules with report"
28+
"activemod": "Send list of active modules with report",
29+
"sendModSettings": "Send module's settings with report"
2930
}
3031
},
3132
"bugButton": {

Module/main.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,11 @@ const generateModuleSettings = (mod) => {
4444
if (setting.module === mod.data.name) {
4545
// only allow scalars
4646
if (setting.config && setting.type !== "object") {
47-
let setVal = game.settings.get(mod.data.name, setting.key);
48-
modSettings.push(`${setting.key}: ${setVal}`);
47+
const ignore = ["cookie", "password", "secret", "token"].some(badKey => setting.key.includes(badKey));
48+
if (!ignore){
49+
let setVal = game.settings.get(mod.data.name, setting.key);
50+
modSettings.push(`${setting.key}: ${setVal}`);
51+
}
4952
}
5053
}
5154
})
@@ -267,7 +270,7 @@ class BugReportForm extends FormApplication {
267270
async _updateObject(ev, formData) {
268271
// obtain original data
269272
const mod = this.module;
270-
const {formFields: { bugTitle, bugDescription, issuer, label, sendActiveModules }} = expandObject(formData);
273+
const {formFields: { bugTitle, bugDescription, issuer, label, sendActiveModules, sendModSettings }} = expandObject(formData);
271274

272275
// if any of our warnings are not checked, throw
273276
if (!bugTitle || !bugDescription) {
@@ -305,13 +308,13 @@ class BugReportForm extends FormApplication {
305308
// generating active module list from game.modules
306309
const moduleList = sendActiveModules ? generateActiveModuleList() : "";
307310
// generate module settings
308-
const moduleSettings = generateModuleSettings(mod);
311+
const moduleSettings = sendModSettings ? generateModuleSettings(mod) : "";
309312

310313
// construct gitlab link (if applicable)
311314
if (this.gitlab) {
312315
bugsUrl = bugsUrl + `?title=${encodeURIComponent(bugTitle)}&description=${encodeURIComponent(fullDescription + "\n" + moduleList + moduleSettings)}`;
313316
}
314-
317+
315318
// let the app know we're ready to send stuff
316319
this.isSending = true;
317320
this.render();

Module/templates/bug-report.html

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ <h3>Module Dependencies</h3>
7171
<input type="text" class="bug-title" name="formFields.bugTitle" data-dtype="String"
7272
value="{{formFields.bugTitle}}" />
7373
</div>
74-
7574
<div class="flexcol found-issues {{#if (bugs-isEmpty foundIssues)}}hidden{{/if}}" tabindex="-1">
7675
<h3>{{localize 'BUG.foundIssues.title'}}</h3>
7776
<div class="found-issue-list" id="bug-reporter-issues-found">
@@ -109,9 +108,15 @@ <h4 class="flexrow">
109108
</div>
110109
</div>
111110

112-
<div class="form-group">
113-
<label for="sendActiveModules">{{localize 'BUG.form.options.activemod'}}</label>
114-
<input type="checkbox" id="sendActiveModules" name="formFields.sendActiveModules" checked />
111+
<div class="flexrow">
112+
<div class="form-group">
113+
<label for="sendActiveModules">{{localize 'BUG.form.options.activemod'}}</label>
114+
<input type="checkbox" id="sendActiveModules" name="formFields.sendActiveModules" checked />
115+
</div>
116+
<div class="form-group">
117+
<label for="sendModSettings">{{localize 'BUG.form.options.sendModSettings'}}</label>
118+
<input type="checkbox" id="sendModSettings" name="formFields.sendModSettings"/>
119+
</div>
115120
</div>
116121

117122
<div class="form-group-stacked">

0 commit comments

Comments
 (0)