#990385 apt: allow to set Valid-Until-Min/Valid-Until-Max = 0 to ignore defaults

Package:
src:apt
Source:
apt
Submitter:
Christoph Anton Mitterer
Date:
2021-06-28 11:51:02 UTC
Severity:
wishlist
#990385#5
Date:
2021-06-28 00:35:51 UTC
From:
To:
Hey there.

It would be nice if the sources.list options Valid-Until-Min/Valid-Until-Max
would allow to be set to 0 or -1 in order to ignore any set value of their
respective defaults Acquire::Min-ValidTime and Acquire::Max-ValidTime.

The idea is as follows...


One might want to set a system-wide default to not accept Release files that
are older than, say a 2 days:
  /etc/apt/apt.conf.d/99security:
    Acquire::Max-ValidTime 172800;

This assures that "at least" 2 days are enforced even if a perhaps even
tighter:
   Valid-Until-Max: 86400
is forgotten in some repo definition.

But for e.g. local repos, where the Release file isn't recreated regularly,
this is rather undesired, of course.
Aside from simply setting a very long Valid-Until-Max, it would be nice if
one could set 0, similar to Acquire::Max-ValidTime meaning of "no maximum"
(of course unless a Valid-Until is specified in the Release file).


Cheers,
Chris.

#990385#10
Date:
2021-06-28 08:20:25 UTC
From:
To:
How is this different from setting Check-Valid-Until to no? And doesn't
setting it to -1 do this already (I have not checked, but the time seems
parsed as unsigned).

Setting it to 0 means the same as not setting it, and hacking around
that would be odd, also -1 is more natural anyway.

#990385#15
Date:
2021-06-28 11:46:58 UTC
From:
To:
If one sets Check-Valid-Until it means that the Valid-Until: header i
really not checked at all.

So my use-case was about the following:
- the admin sets a ("default") maximum validity period in apt.conf,
  should it be forgotten to set something in sources.list.

- that breaks, of course, for repos which have their Release file
  rarely updated, e.g. local repos which are perhaps only updated on
  demand, or stable, which also seems to be only updated (in terms of
  Date: header) when a new point release comes out (which btw: seems
  like opening the possibility for blocking/replay attacks?)

Now I can of course set:
  Check-Valid-Until: no
on these repos, but that would also mean that the check is completely
gone... while I would just want to ignore my Acquire::Max-ValidTime
setting... and not if the Release file should in future perhaps get
some proper Valid-Until: header.

I think I had tried -1, but that didn't work.