Amber 2.0.0-beta.7
Amber 2.0.0-beta.7 makes the fixes that AgentC applications carried on a
fork part of Amber itself, so those applications can depend on an official
release again. It also routes .md paths to the routes that declare them,
bounds request parameter parsing, and reads credentials from a systemd-style
credentials directory.
What changed
-
A path ending in an extension reaches the route that declares it
(#1431). Beta.6 added.mdto the response extensions it removes before
matching, so/projects/7/insights/overview.mdwas matched as
/projects/7/insights/overviewand could land on a laterget "/*"
catch-all. A route that spells the extension in its own path, such as
get "/projects/:project_id/insights/overview.md"or
get "/guides/setup(.md)", now answers first. A path that no route
declares still has its extension removed, so/users/1.jsonmatches
/users/:id. A route's request constraint is asked once per request,
and a constraint that readsrequest.paramssees that route's
parameters. -
The request body stays readable after Amber parses a form (#1429). A
controller behind the CSRF pipe can readrequest.bodyagain; the bytes
are handed back from the bounded parse. A multipart body is restored up
toparams.max_multipart_restore_bytes(8 MiB by default,0turns it
off) when itsContent-Lengthis declared and within that limit and
params.max_multipart_body_bytes; any other multipart body stays drained. -
Upload tempfiles are deleted when the request finishes (#1429). To
keep an upload, callAmber::Router::File#move_to(path)during the
action, or#retain!to keep the tempfile at#pathand delete it
yourself, for example after a background job. -
Custom config sections load as raw YAML (#1430). Amber no longer
deserializes a custom section through everyYAML::Serializabletype, so
an application whose Grant models have UUID columns compiles with custom
config again.AppConfig#customreads a section as the requested type or
returns its registered default; an unregistered key raises
Amber::Exceptions::ConfigurationError. -
Settings load at first use (#1424).
require "amber"no longer reads
settings, so a section registered inconfig/initializersreads its YAML
value, andconfig/application.crcan still setAmber.pathand
Amber.env. Amber colors its own log lines fromlogging.colorizeand
leaves the globalColorize.enabledflag alone. -
Request parameters are bounded (#1419). Counts, nesting depth, key
and value sizes, body sizes, array indices and padding, multipart parts,
uploads and WebSocket messages each have a limit in the newparams:
section ofconfig/environments/<env>.yml(orAMBER_PARAMS_<KEY>). An
HTTP request beyond a limit is answered with400 Bad Request; a
WebSocket message overmax_websocket_message_bytes(2 MiB) closes the
connection with code 1009. The defaults and every limit are listed in
CHANGELOG.md. -
Credentials directory (#1423).
Amber::Configuration.register_credentials
reads a systemd-style credentials directory, one file per credential, into
a typed section. The application passes the directory, usually from
CREDENTIALS_DIRECTORY, before settings load:if credentials_directory = ENV["CREDENTIALS_DIRECTORY"]? Amber::Configuration.register_credentials(:credentials, AppCredentials, credentials_directory) else Amber::Configuration.register(:credentials, AppCredentials) end
AMBER_{SECTION}_{KEY}overrides now reach registered custom sections. -
A GREEN build (#1421): no compiler warnings. The ecosystem agent
context now names Micrate, Gemma and Mica (#1417).
Fork fixes now in Amber
| Fix | Fork commit | Upstream |
|---|---|---|
| Restore the request body after form parsing | 8c71a57c
| #1429 |
| Delete upload tempfiles at request teardown | 0fbd8eba
| #1429 |
| Read custom config as raw YAML | bc0d62c6
| #1430 |
| Answer 404 before checking a route's constraint when no route matches | valid_route? guard
| already in Amber (7224cb57)
|
An application can drop its fork pin and depend on this release.
Upgrade
Change the version:
dependencies:
amber:
github: amberframework/amber
version: 2.0.0-beta.7Then check three things:
- Uploads you keep. An action that keeps an uploaded file past the
request calls#move_toor#retain!; otherwise the tempfile is gone
when the response is sent. - Large requests. A form, JSON body or upload larger than the defaults
(8 MiB form and document bodies, 64 MiB files, 128 MiB multipart bodies)
needs its limit raised inparams:. - Custom config readers. Code that called
Amber::Configuration.load_custom_from_yamlreads sections with
Amber.settings.custom(:name, Type)instead.
Beta.6 also stopped sending Keep-Alive response headers (deb16f8e); a
spec that expects them needs updating.
Release
The tag is v2.0.0-beta.7. The GitHub release for the tag states the tagged
commit hash, its tree hash, and the sha256 of the source tarball attached to
the release (scripts/release_checksums.sh v2.0.0-beta.7 produces all three).
A file cannot carry its own tarball's hash, so they live in the release.
Verify this release
Commit: 21deeec92b9253e9fc7252f994fc3465da0ffd4f
Tree: d7af4f30415f80e633c49c2d1ff0c32ac6ac7c1a
Tarball: amber-2.0.0-beta.7.tar.gz (git archive --format=tar.gz --prefix=amber-2.0.0-beta.7/ 21deeec92b9253e9fc7252f994fc3465da0ffd4f)
Tarball sha256: 988a556bd1bf85b6b7e2a24cbe80559b558694ed1ec1333fa5164f7059a0bddb