mirror of
https://github.com/keeweb/keeweb.git
synced 2024-06-25 07:37:46 +02:00
check plugins public keys
This commit is contained in:
parent
fae40c8c3e
commit
af2de71e5d
|
@ -465,7 +465,7 @@
|
||||||
"setPlJs": "code",
|
"setPlJs": "code",
|
||||||
"setPlCss": "styles",
|
"setPlCss": "styles",
|
||||||
"setPlLoc": "language",
|
"setPlLoc": "language",
|
||||||
"setPlCreatedBy": "created by {}",
|
"setPlCreatedBy": "Created by {}",
|
||||||
"setPlLoadTime": "took {} to load",
|
"setPlLoadTime": "took {} to load",
|
||||||
"setPlLastUpdate": "Last check for updates",
|
"setPlLastUpdate": "Last check for updates",
|
||||||
"setPlLoadError": "error loading plugin",
|
"setPlLoadError": "error loading plugin",
|
||||||
|
|
|
@ -5,6 +5,8 @@ const kdbxweb = require('kdbxweb');
|
||||||
const SignatureVerifier = {
|
const SignatureVerifier = {
|
||||||
logger: new Logger('signature-verifier'),
|
logger: new Logger('signature-verifier'),
|
||||||
|
|
||||||
|
publicKey: null,
|
||||||
|
|
||||||
verify(data, signature, pk) {
|
verify(data, signature, pk) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const algo = {name: 'RSASSA-PKCS1-v1_5', hash: {name: 'SHA-256'}};
|
const algo = {name: 'RSASSA-PKCS1-v1_5', hash: {name: 'SHA-256'}};
|
||||||
|
@ -70,9 +72,12 @@ const SignatureVerifier = {
|
||||||
},
|
},
|
||||||
|
|
||||||
getPublicKey() {
|
getPublicKey() {
|
||||||
return publicKey
|
if (!this.publicKey) {
|
||||||
.match(/-+BEGIN PUBLIC KEY-+([\s\S]+?)-+END PUBLIC KEY-+/)[1]
|
this.publicKey = publicKey
|
||||||
.replace(/\s+/g, '');
|
.match(/-+BEGIN PUBLIC KEY-+([\s\S]+?)-+END PUBLIC KEY-+/)[1]
|
||||||
|
.replace(/\s+/g, '');
|
||||||
|
}
|
||||||
|
return this.publicKey;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ const AppSettingsModel = require('../../models/app-settings-model');
|
||||||
const Comparators = require('../../util/comparators');
|
const Comparators = require('../../util/comparators');
|
||||||
const Format = require('../../util/format');
|
const Format = require('../../util/format');
|
||||||
const SettingsManager = require('../../comp/settings-manager');
|
const SettingsManager = require('../../comp/settings-manager');
|
||||||
|
const SignatureVerifier = require('../../util/signature-verifier');
|
||||||
|
|
||||||
const SettingsPluginsView = Backbone.View.extend({
|
const SettingsPluginsView = Backbone.View.extend({
|
||||||
template: require('templates/settings/settings-plugins.hbs'),
|
template: require('templates/settings/settings-plugins.hbs'),
|
||||||
|
@ -47,7 +48,8 @@ const SettingsPluginsView = Backbone.View.extend({
|
||||||
galleryLoading: PluginGallery.loading,
|
galleryLoading: PluginGallery.loading,
|
||||||
galleryLoadError: PluginGallery.loadError,
|
galleryLoadError: PluginGallery.loadError,
|
||||||
galleryPlugins: this.getGalleryPlugins(),
|
galleryPlugins: this.getGalleryPlugins(),
|
||||||
searchStr: this.searchStr
|
searchStr: this.searchStr,
|
||||||
|
publicKey: SignatureVerifier.getPublicKey()
|
||||||
});
|
});
|
||||||
if (this.searchStr) {
|
if (this.searchStr) {
|
||||||
this.showFilterResults();
|
this.showFilterResults();
|
||||||
|
|
|
@ -15,8 +15,12 @@
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="settings__plugins-plugin-desc">
|
<div class="settings__plugins-plugin-desc">
|
||||||
<a href="{{plugin.manifest.url}}" target="_blank">{{plugin.manifest.url}}</a>, v{{plugin.manifest.version}},
|
<a href="{{plugin.manifest.url}}" target="_blank">{{plugin.manifest.url}}</a>, v{{plugin.manifest.version}}.
|
||||||
{{#res 'setPlCreatedBy'}}<a href="{{plugin.manifest.author.url}}" target="_blank">{{plugin.manifest.author.name}}</a> ({{plugin.manifest.author.email}}){{/res}},
|
{{#ifeq plugin.manifest.publicKey ../publicKey}}
|
||||||
|
{{res 'setPlOfficial'}},
|
||||||
|
{{else}}
|
||||||
|
{{#res 'setPlCreatedBy'}}<a href="{{plugin.manifest.author.url}}" target="_blank">{{plugin.manifest.author.name}}</a> ({{plugin.manifest.author.email}}){{/res}},
|
||||||
|
{{/ifeq}}
|
||||||
{{#ifeq plugin.status 'active'}}
|
{{#ifeq plugin.status 'active'}}
|
||||||
{{#res 'setPlLoadTime'}}{{plugin.installTime}}ms{{/res}}
|
{{#res 'setPlLoadTime'}}{{plugin.installTime}}ms{{/res}}
|
||||||
{{else}}
|
{{else}}
|
||||||
|
@ -69,11 +73,11 @@
|
||||||
{{#if plugin.manifest.resources.loc}}<li class="settings__plugins-plugin-file"><i class="fa fa-language"></i> {{res 'setPlLoc'}}: {{plugin.manifest.locale.title}}</li>{{/if}}
|
{{#if plugin.manifest.resources.loc}}<li class="settings__plugins-plugin-file"><i class="fa fa-language"></i> {{res 'setPlLoc'}}: {{plugin.manifest.locale.title}}</li>{{/if}}
|
||||||
</ul>
|
</ul>
|
||||||
<div class="settings__plugins-gallery-plugin-author muted-color">
|
<div class="settings__plugins-gallery-plugin-author muted-color">
|
||||||
{{#if plugin.official}}
|
{{#ifeq plugin.manifest.publicKey ../publicKey}}
|
||||||
<i class="fa fa-check"></i> {{res 'setPlOfficial'}}
|
<i class="fa fa-check"></i> {{res 'setPlOfficial'}}
|
||||||
{{else}}
|
{{else}}
|
||||||
<i class="fa fa-at"></i> <a href="{{plugin.manifest.author.url}}" target="_blank">{{plugin.manifest.author.name}}</a> ({{plugin.manifest.author.email}})
|
<i class="fa fa-at"></i> <a href="{{plugin.manifest.author.url}}" target="_blank">{{plugin.manifest.author.name}}</a> ({{plugin.manifest.author.email}})
|
||||||
{{/if}}
|
{{/ifeq}}
|
||||||
</div>
|
</div>
|
||||||
<button class="settings__plugins-gallery-plugin-install-btn"
|
<button class="settings__plugins-gallery-plugin-install-btn"
|
||||||
data-plugin="{{plugin.manifest.name}}"
|
data-plugin="{{plugin.manifest.name}}"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user