diff options
| author | Stefan Kangas | 2020-09-07 07:31:56 +0200 |
|---|---|---|
| committer | Stefan Kangas | 2020-11-22 00:38:35 +0100 |
| commit | bcde5f86c5a7f3a84115807520631a4f12fb6f70 (patch) | |
| tree | 6254f8d19ef474f965567ce7922b84ed93312a19 /doc/lispref | |
| parent | 733e674af4f66ba7e9f0614b931c44484acce2b9 (diff) | |
| download | emacs-scratch/package-security.tar.gz emacs-scratch/package-security.zip | |
Support expiration of metadata by package archivesscratch/package-security
Expiring package metadata is done by checking the timestamp in package
archive file. This is intended to limit the effectiveness of a replay
attack. The onus is on the package archives to implement a secure and
reasonable policy. (Debian uses 7 days before metadata expires.)
Together with package checksums, this adds sufficient protection
against metadata replay attacks. (Bug#19479)
* lisp/emacs-lisp/package.el (package-check-timestamp): New defcustom.
(bad-timestamp): New error.
(package--parse-header-from-buffer)
(package--parse-valid-until-from-buffer)
(package--parse-last-updated-from-buffer)
(package--archive-verify-timestamp)
(package--archive-verify-not-expired)
(package--compare-archive-timestamps)
(package--check-archive-timestamp): New defuns.
(package--download-one-archive): Check timestamp of the
'archive-contents' file using above functions. It is only checked if
it exists, which makes this change backwards compatible.
* lisp/calendar/iso8601.el (iso8601-parse): Add autoload cookie.
* test/lisp/emacs-lisp/package-tests.el
(package-test-parse-valid-until-from-buffer)
(package-test-parse-last-updated-from-buffer)
(package-test-archive-verify-timestamp)
(package-test-check-archive-timestamp)
(package-test-check-archive-timestamp/not-expired)
(package-test-check-archive-timestamp/expired): New tests.
* test/lisp/emacs-lisp/package-resources/archives/older/archive-contents:
* test/lisp/emacs-lisp/package-resources/archives/newer/archive-contents:
New files.
* doc/lispref/package.texi (Package Archives, Archive Web Server):
Document how to increase the security of a package archive using
checksums, signing and timestamps.
Diffstat (limited to 'doc/lispref')
| -rw-r--r-- | doc/lispref/package.texi | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/doc/lispref/package.texi b/doc/lispref/package.texi index af87479c7d2..725fecd8952 100644 --- a/doc/lispref/package.texi +++ b/doc/lispref/package.texi | |||
| @@ -332,10 +332,22 @@ installing user. (This is true for Emacs code in general, not just | |||
| 332 | for packages.) So you should ensure that your archive is | 332 | for packages.) So you should ensure that your archive is |
| 333 | well-maintained and keep the hosting system secure. | 333 | well-maintained and keep the hosting system secure. |
| 334 | 334 | ||
| 335 | One way to increase the security of your packages is to @dfn{sign} | 335 | To increase the security of your packages, you should distribute |
| 336 | them using a cryptographic key. If you have generated a | 336 | package checksums in the package metadata file |
| 337 | private/public gpg key pair, you can use gpg to sign the package like | 337 | @file{archive-contents}. You should also @dfn{sign} the package |
| 338 | this: | 338 | metadata file using a cryptographic key. Finally, it is important to |
| 339 | include creation and expiration timestamps information in that file. | ||
| 340 | |||
| 341 | Signing individual packages is also supported, but considered | ||
| 342 | obsolete. It provides less security than package checksums, signing | ||
| 343 | the @file{archive-contents} file, and creation and expiration | ||
| 344 | timestamps does when used together. More specifically, signing | ||
| 345 | individual packages does not protect against ``replay attacks''. Note | ||
| 346 | that distributing signatures for individual packages is still | ||
| 347 | recommended to support Emacs versions older than 28.1. | ||
| 348 | |||
| 349 | If you have generated a private/public gpg key pair, you can use gpg | ||
| 350 | to sign a package or the @file{archive-contents} file like this: | ||
| 339 | 351 | ||
| 340 | @c FIXME EasyPG / package-x way to do this. | 352 | @c FIXME EasyPG / package-x way to do this. |
| 341 | @example | 353 | @example |
| @@ -371,6 +383,9 @@ Return a lisp form describing the archive contents. The form is a list | |||
| 371 | of 'package-desc' structures (see @file{package.el}), except the first | 383 | of 'package-desc' structures (see @file{package.el}), except the first |
| 372 | element of the list is the archive version. | 384 | element of the list is the archive version. |
| 373 | 385 | ||
| 386 | @item archive-contents.sig | ||
| 387 | Return the signature for @file{archive-contents}. | ||
| 388 | |||
| 374 | @item <package name>-readme.txt | 389 | @item <package name>-readme.txt |
| 375 | Return the long description of the package. | 390 | Return the long description of the package. |
| 376 | 391 | ||