json: Do not put FILE_NAME into the verify result.

* src/gpgme-json.c (verify_result_to_json): Remove "file_name".
--

Having the file name in the verify result may lead developers to
assume that the file name is covered by the signature.  This is not
the case and can easily be checked by hex-editing a signed message.
We better don't output it at all.

The same is true for the is_mime flag but that is anyway only an
advisory and I can't see damage from a faulty one.

Note that we keep file_name in gpgme's output for ABI stability and
because some tools want to display meta information even if they are
subject to tampering.  This is similar to the non-encrypted subject in
mails.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2018-08-27 11:42:27 +02:00
parent 702566b36c
commit 53c5b9a265
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B

View File

@ -1138,7 +1138,6 @@ verify_result_to_json (gpgme_verify_result_t verify_result)
{
cjson_t result = xjson_CreateObject ();
xjson_AddStringToObject0 (result, "file_name", verify_result->file_name);
xjson_AddBoolToObject (result, "is_mime", verify_result->is_mime);
if (verify_result->signatures)
@ -2107,8 +2106,8 @@ static const char hlp_verify[] =
"data: The verified data. This may be base64 encoded.\n"
"base64: Boolean indicating whether data is base64 encoded.\n"
"info: An object with verification information (gpgme_verify_result_t).\n"
" file_name: Optional string of the plaintext file name.\n"
" is_mime: Boolean that is true if the messages claims it is MIME.\n"
" Note that this flag is not covered by the signature.)\n"
" signatures: Array of signatures\n"
" summary: Object containing summary information.\n"
" Boolean values: (Check gpgme_sigsum_t doc for meaning)\n"