Skip to content

osy 0.19.7

Choose a tag to compare

@osysharp-publisher osysharp-publisher released this 12 Nov 17:26

This release makes the rules on outbound hosts cover the Host header of a call as well as its address, refuses a request header that carries a line break or another control character, and lets an organisation keep an outbound host for one package. A few things that passed before are now refused; each has its fix beside it. To upgrade, run osy upgrade, then osy update in a project.

Breaking changes

  • A Host header that names another host must pass the same rules as the address. An outbound call (Http.Get/Post/Put/Patch/Delete, Http.Stream, Http.StreamEvents, Http.GetToFile, Http.PutFile, Http.PostToSecrets) that sets a Host header different from the host in its URL is sent only if the named host passes too: the organisation's blocked and allowed hosts, the app's own rules and, for a package, the hosts the app granted it. Before, only the URL's host was checked. The two hosts are compared by the name a host resolves as, so a Host header equal to the URL's host (in any case, with a trailing dot, in its Unicode or xn-- form, with a port) changes nothing, and an app with no host rules in an organisation with none may still set a different one. Who can be newly refused: an app or a kit that sets a Host header different from its URL's host while its rules do not allow the named host. Fix: allow the named host as well, or stop setting the header.
  • A request header with a line break or another control character is refused. A header whose name or value contains a line break or another control character is refused and nothing is sent. A tab, and text outside ASCII, are treated as before. Fix: remove the character from the value before the call.
  • More than one Host header, an empty one, or one that is not a host is refused, whatever rules are set. A Host header is a host name or an address, with or without :port. The refusal says what was wrong and does not repeat the value. Fix: set one Host header, holding a host, or none.
  • A secret goes only where its secretIn line allows, the Host header included. When a call that sends a secret in a query parameter or body field names a different host in its Host header, the secret's line must cover the named host as well as the URL's host. Fix: declare the secret for the named host too, or stop setting the header.
  • A Host header counts against a rate limit. The host named in a Host header counts against that host's per-minute rule as well as the URL's. Fix: none needed unless the named host's limit is reached; then raise it or send fewer calls.
  • A stored rule with an asterisk that is not the plain * matches nothing. A rule already stored as *.example.com or ﹡.example.com (full-width or small asterisk) is no longer read as a wildcard: as an allow it allows no host, and as a block it blocks none. Such a rule has been refused when set since 0.19.6. Fix: rewrite a rule stored earlier with the plain *. This replaces 0.19.6's "one already stored is compared as the wildcard".

Fixes

  • The .egress file check refuses what the server refuses. A non-plain asterisk, a second * behind the *. prefix and a name over 253 characters are reported by the file's own check, in osy compile, osy egress and a deploy, instead of the server rejecting the rules afterwards.

Organisation policy

  • A host for one package. An organisation's egress.hosts rule can name a host for one package: snowflake.example.com@Acme.Snowflake. Only code of the package named so reaches that host, from the server, and only where the app grants the package the host. The app's own code and every other package are refused it, also when they name the host in a Host header.
  • The name is all that is checked. The package is matched by its full name, exactly. An app that composes its own package under that name reaches the host.
  • What counts as the package's code. Code of the app that the package calls back into is the app's and is refused the host. A function of the package that sends to an address its caller hands it still sends as the package, so the app reaches the host through such a function. A workflow the package declares is the package's code and reaches the host.
  • Such a host is never added to a page's policy by a grant. A browser grant that covers it is dropped for every package, the named one included.
  • Such a host is not an allowed host. It does not by itself limit the organisation's apps to a list. A blocked host stays blocked for the named package too, and -host@Package is not accepted.
  • Two packages. The same host named for two packages is accepted, and both reach it. Two different patterns that cover the same host and name different packages are refused when the policy is saved.
  • Upgrade the platform first. Every platform that runs the organisation's apps must have this release before a version with such an entry is approved. An older platform cannot read the entry and refuses every outbound call of the organisation's apps until it can.
  • GET /api/egress says more. The answer gains onlyVia, the hosts kept for one package with the package's name. Each package grant gains onlyThrough, the packages its host is kept for when that is why it is refused, and why on a browser grant that is not admitted because it covers such a host. A caught PolicyRefused gains OnlyThrough, which is empty when the entries shut the host to everyone.
  • A machine account is told by its address as well as its registration. An account at the machine accounts' address that is not registered as a machine is now refused approving a policy while the organisation does not let machines approve. Before, it approved as a person. While machines may approve, its approval is recorded as a machine's and stops counting when machines are turned off.

Not covered

  • X-Forwarded-Host, Forwarded, X-Host and X-Original-Host are passed on unchanged and are not checked against the rules. The port in a Host header is not checked.