Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-daemon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-daemon
Commits
df918256
Commit
df918256
authored
1 year ago
by
Xavier Jouslin de Noray
Committed by
Sébastien Blin
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Plugin Update: verify public key if the plugin already install
Change-Id: Ia3b3ec41994117af228a1ef595208fee165b0d3b
parent
dea87f57
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/plugin/jamipluginmanager.cpp
+26
-0
26 additions, 0 deletions
src/plugin/jamipluginmanager.cpp
src/plugin/jamipluginmanager.h
+7
-0
7 additions, 0 deletions
src/plugin/jamipluginmanager.h
with
33 additions
and
0 deletions
src/plugin/jamipluginmanager.cpp
+
26
−
0
View file @
df918256
...
...
@@ -126,6 +126,30 @@ JamiPluginManager::getInstalledPlugins()
return
pluginsPaths
;
}
bool
JamiPluginManager
::
checkPluginCertificatePublicKey
(
const
std
::
string
&
oldJplPath
,
const
std
::
string
&
newJplPath
)
{
std
::
map
<
std
::
string
,
std
::
string
>
oldDetails
=
PluginUtils
::
parseManifestFile
(
PluginUtils
::
manifestPath
(
oldJplPath
),
oldJplPath
);
if
(
oldDetails
.
empty
()
||
!
std
::
filesystem
::
is_regular_file
(
oldJplPath
+
DIR_SEPARATOR_CH
+
oldDetails
[
"id"
]
+
".crt"
)
||
!
std
::
filesystem
::
is_regular_file
(
newJplPath
)
)
return
false
;
try
{
auto
oldCert
=
PluginUtils
::
readPluginCertificate
(
oldJplPath
,
oldDetails
[
"id"
]);
auto
newCert
=
PluginUtils
::
readPluginCertificateFromArchive
(
newJplPath
);
if
(
!
oldCert
||
!
newCert
)
{
return
false
;
}
return
oldCert
->
getPublicKey
()
==
newCert
->
getPublicKey
();
}
catch
(
const
std
::
exception
&
e
)
{
JAMI_ERR
()
<<
e
.
what
();
return
false
;
}
return
true
;
}
bool
JamiPluginManager
::
checkPluginCertificateValidity
(
dht
::
crypto
::
Certificate
*
cert
)
{
...
...
@@ -256,6 +280,8 @@ JamiPluginManager::installPlugin(const std::string& jplPath, bool force)
}
else
{
std
::
string
installedVersion
=
alreadyInstalledManifestMap
.
at
(
"version"
);
if
(
version
>
installedVersion
)
{
if
(
!
checkPluginCertificatePublicKey
(
destinationDir
,
jplPath
))
return
CERTIFICATE_VERIFICATION_FAILED
;
r
=
uninstallPlugin
(
destinationDir
);
if
(
r
==
SUCCESS
)
{
archiver
::
uncompressArchive
(
jplPath
,
...
...
This diff is collapsed.
Click to expand it.
src/plugin/jamipluginmanager.h
+
7
−
0
View file @
df918256
...
...
@@ -79,6 +79,13 @@ public:
*/
bool
checkPluginCertificateValidity
(
dht
::
crypto
::
Certificate
*
cert
);
/**
* @brief check if the if the public key of the certificate is the same as the public key in the new plugin
* @param oldJplPath, newJplPath
* return true if valid
*/
bool
checkPluginCertificatePublicKey
(
const
std
::
string
&
oldJplPath
,
const
std
::
string
&
newJplPath
);
/**
* @brief check if all file are present in the signature file
* @param jplPath
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment