Package: apt
Version: 3.0.3
Severity: minor
The sqv method checks each signature against next year's policy first
(methods/sqv.cc, VerifyGetSigners). It builds that date as
strprintf(yearAheadDate, "%d-%d-%d", tm->tm_year + 1900 + 1, tm->tm_mon
+ 1, tm->tm_mday);
On 29 February this gives 29 February of a year that does not have one.
sqv refuses the argument:
$ sqv ... --policy-as-of 2029-2-29 ...
error: invalid value '2029-2-29' for '--policy-as-of <TIMESTAMP>':
Malformed timestamp: 2029-2-29.
and exits 2. The method treats any failure of the year-ahead run as the
policy rejecting the signature, runs sqv again at today's policy, and
warns. So on 29 February every repository gets
W: .../InRelease: Policy will reject signature within a year, see
--audit for details
with the error above as its audit reason, and the year-ahead check does
not happen that day.
I reproduced it with apt-get update on a local file:// repository
signed by an ed25519 key, under a clock set to 2028-02-29 (an
LD_PRELOAD shim on clock_gettime/gettimeofday/time, inherited by the
method and sqv). With the clock at 2028-02-28 or 2028-03-01 there is no
warning, and with APT::Key::GPGVCommand set there is none on 29 February
either. The code is the same on main.
Two things would avoid it: computing the date with a calendar, or
passing "+1y", which sqv accepts as an offset (--policy-as-of +1y
exits 0 here). Separately: sqv's exit 2 is a usage error, and the
method reports it as a policy rejection.
--
Christian Ramos
Director general · Norte Software
[email protected] +52
9671456444 <https://wa.me/529671456444>
nortesoftware.dev
SAN CRISTÓBAL DE LAS CASAS · CHIAPAS