mirror of
https://github.com/grafana/grafana.git
synced 2025-07-30 21:32:22 +08:00
Plugins: Add Subresource Integrity checks (#93024)
* Plugins: Pass hashes for SRI to frontend * Add SRI hashes to frontendsettings DTOs * Add docstring * TestSriHashes * Fix typo * Changed SriHashes to ModuleHash * update loader_test compareOpts * update ModuleHash error message * Add TestModuleHash/no_module.js * Add omitEmpty to moduleHash * Add ModuleHash to api/plugins/${pluginId}/settings * moved ModuleHash field * feat(plugins): add moduleHash to bootData and plugin types * feat(plugins): if moduleHash is available apply it to systemjs importmap * Calculate ModuleHash for CDN provisioned plugins * Add ModuleHash tests for TestCalculate * adjust test case name * removed .envrc * Fix signature verification failing for internal plugins * fix tests * Add pluginsFilesystemSriChecks feature togglemk * renamed FilesystemSriChecksEnabled * refactor(plugin_loader): prefer extending type declaration over ts-error * added a couple more tests * Removed unused features * Removed unused argument from signature.DefaultCalculator call * Removed unused argument from bootstrap.DefaultConstructFunc * Moved ModuleHash to pluginassets service * update docstring * lint * Removed cdn dependency from manifest.Signature * add tests * fix extra parameters in tests * "fix" tests * removed outdated test * removed unused cdn dependency in signature.DefaultCalculator * reduce diff * Cache returned values * Add support for deeply nested plugins (more than 1 hierarchy level) * simplify cache usage * refactor TestService_ModuleHash_Cache * removed unused testdata * re-generate feature toggles * use version for module hash cache * Renamed feature toggle to pluginsSriChecks and use it for both cdn and filesystem * Removed app/types/system-integrity.d.ts * re-generate feature toggles * re-generate feature toggles * feat(plugins): put systemjs integrity hash behind feature flag --------- Co-authored-by: Jack Westbrook <jack.westbrook@gmail.com>
This commit is contained in:
32
pkg/services/pluginsintegration/pluginassets/testdata/module-hash-valid/MANIFEST.txt
vendored
Normal file
32
pkg/services/pluginsintegration/pluginassets/testdata/module-hash-valid/MANIFEST.txt
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
|
||||
-----BEGIN PGP SIGNED MESSAGE-----
|
||||
Hash: SHA512
|
||||
|
||||
{
|
||||
"manifestVersion": "2.0.0",
|
||||
"signatureType": "private",
|
||||
"signedByOrg": "giuseppeguerra",
|
||||
"signedByOrgName": "giuseppeguerra",
|
||||
"rootUrls": [
|
||||
"http://127.0.0.1:3000/"
|
||||
],
|
||||
"plugin": "test-datasource",
|
||||
"version": "1.0.0",
|
||||
"time": 1725959570435,
|
||||
"keyId": "7e4d0c6a708866e7",
|
||||
"files": {
|
||||
"module.js": "5891b5b522d5df086d0ff0b110fbd9d21bb4fc7163af34d08286a2e846f6be03",
|
||||
"plugin.json": "129fab4e0584d18c778ebdfa5fe1a68edf2e5c5aeb8290b2c68182c857cb59f8"
|
||||
}
|
||||
}
|
||||
-----BEGIN PGP SIGNATURE-----
|
||||
Version: OpenPGP.js v4.10.11
|
||||
Comment: https://openpgpjs.org
|
||||
|
||||
wrkEARMKAAYFAmbgDZIAIQkQfk0ManCIZucWIQTzOyW2kQdOhGNlcPN+TQxq
|
||||
cIhm5wbfAgkAXmKJcM8uAKb3TepYW/oyGhRLR8L6eM9mCoYwKkatITKJ6bRe
|
||||
Wnz37AMcPx0DahgfCzCXRLo4CspPJylr2JV8DagCCQCfCjHgLFhKGpBP71Y1
|
||||
mgcQ1/CJefb6B2H45G25MwUFTlSTGLDqW4QMi2kQvXnnUMjXquv2+iVd6qyz
|
||||
0Rqvpou/QQ==
|
||||
=QNmr
|
||||
-----END PGP SIGNATURE-----
|
1
pkg/services/pluginsintegration/pluginassets/testdata/module-hash-valid/module.js
vendored
Normal file
1
pkg/services/pluginsintegration/pluginassets/testdata/module-hash-valid/module.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
hello
|
15
pkg/services/pluginsintegration/pluginassets/testdata/module-hash-valid/plugin.json
vendored
Normal file
15
pkg/services/pluginsintegration/pluginassets/testdata/module-hash-valid/plugin.json
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
"type": "datasource",
|
||||
"name": "Test",
|
||||
"id": "test-datasource",
|
||||
"backend": true,
|
||||
"executable": "test",
|
||||
"state": "alpha",
|
||||
"info": {
|
||||
"version": "1.0.0",
|
||||
"description": "Test",
|
||||
"author": {
|
||||
"name": "Giuseppe Guerra"
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user