]> git.eshelyaron.com Git - emacs.git/commit
Support expiration of metadata by package archives scratch/package-security
authorStefan Kangas <stefan@marxist.se>
Mon, 7 Sep 2020 05:31:56 +0000 (07:31 +0200)
committerStefan Kangas <stefan@marxist.se>
Sat, 21 Nov 2020 23:38:35 +0000 (00:38 +0100)
commitbcde5f86c5a7f3a84115807520631a4f12fb6f70
tree6254f8d19ef474f965567ce7922b84ed93312a19
parent733e674af4f66ba7e9f0614b931c44484acce2b9
Support expiration of metadata by package archives

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.
doc/lispref/package.texi
etc/NEWS
lisp/calendar/iso8601.el
lisp/emacs-lisp/package.el
test/lisp/emacs-lisp/package-resources/archives/newer/archive-contents [new file with mode: 0644]
test/lisp/emacs-lisp/package-resources/archives/older/archive-contents [new file with mode: 0644]
test/lisp/emacs-lisp/package-tests.el