Security Advisories (2)
CVE-2024-58134 (2025-05-03)

Mojolicious versions from 0.999922 for Perl uses a hard coded string, or the application's class name, as a HMAC session secret by default. These predictable default secrets can be exploited to forge session cookies. An attacker who knows or guesses the secret could compute valid HMAC signatures for the session cookie, allowing them to tamper with or hijack another user's session.

CVE-2024-58135 (2025-05-03)

Mojolicious versions from 7.28 for Perl may generate weak HMAC session secrets. When creating a default app with the "mojo generate app" tool, a weak secret is written to the application's configuration file using the insecure rand() function, and used for authenticating and protecting the integrity of the application's sessions. This may allow an attacker to brute force the application's session keys.

NAME

Mojo::Asset - HTTP content storage base class

SYNOPSIS

package Mojo::Asset::MyAsset;
use Mojo::Base 'Mojo::Asset';

sub add_chunk {...}
sub contains  {...}
sub get_chunk {...}
sub move_to   {...}
sub mtime     {...}
sub size      {...}
sub slurp     {...}
sub to_file   {...}

DESCRIPTION

Mojo::Asset is an abstract base class for HTTP content storage backends, like Mojo::Asset::File and Mojo::Asset::Memory.

EVENTS

Mojo::Asset inherits all events from Mojo::EventEmitter.

ATTRIBUTES

Mojo::Asset implements the following attributes.

end_range

my $end = $asset->end_range;
$asset  = $asset->end_range(8);

Pretend file ends earlier.

start_range

my $start = $asset->start_range;
$asset    = $asset->start_range(3);

Pretend file starts later.

METHODS

Mojo::Asset inherits all methods from Mojo::EventEmitter and implements the following new ones.

add_chunk

$asset = $asset->add_chunk('foo bar baz');

Add chunk of data to asset. Meant to be overloaded in a subclass.

contains

my $position = $asset->contains('bar');

Check if asset contains a specific string. Meant to be overloaded in a subclass.

get_chunk

my $bytes = $asset->get_chunk($offset);
my $bytes = $asset->get_chunk($offset, $max);

Get chunk of data starting from a specific position, defaults to a maximum chunk size of 131072 bytes (128KiB). Meant to be overloaded in a subclass.

is_file

my $bool = $asset->is_file;

False, this is not a Mojo::Asset::File object.

is_range

my $bool = $asset->is_range;

Check if asset has a "start_range" or "end_range".

move_to

$asset = $asset->move_to('/home/sri/foo.txt');

Move asset data into a specific file. Meant to be overloaded in a subclass.

mtime

my $mtime = $asset->mtime;

Modification time of asset. Meant to be overloaded in a subclass.

size

my $size = $asset->size;

Size of asset data in bytes. Meant to be overloaded in a subclass.

slurp

my $bytes = $asset->slurp;

Read all asset data at once. Meant to be overloaded in a subclass.

to_file

my $file = $asset->to_file;

Convert asset to Mojo::Asset::File object. Meant to be overloaded in a subclass.

SEE ALSO

Mojolicious, Mojolicious::Guides, https://mojolicious.org.