Security Advisories (1)
CVE-2026-5080 (2026-04-30)

Dancer::Session::Abstract versions through 1.3522 for Perl generates session ids insecurely. The session id is generated from summing the character codepoints of the absolute pathname with the process id, the epoch time and calls to the built-in rand() function to return a number between 0 and 999-billion, and concatenating that result three times. The path name might be known or guessed by an attacker, especially for applications known to be written using Dancer with standard installation locations. The epoch time can be guessed by an attacker, and may be leaked in the HTTP header. The process id comes from a small set of numbers, and workers may have sequential process ids. The built-in rand() function is seeded with 32-bits and is considered unsuitable for security applications. Predictable session ids could allow an attacker to gain access to systems.

NAME

Dancer::MIME - Singleton object to handle MimeTypes

VERSION

version 1.3522

SYNOPSIS

# retrieve object instance
my $mime = Data::MIME->instance();

# return a hash reference of user defined types
my $types = $mime->custom_types;

# return the default mime-type for unknown files
$mime->default

# set the default mime-type with Dancer::Config or Dancer, like
set default_mime_type => "text/plain";
# or directly in your config.yml file.

# add non standard mime type
$mime->add_type( foo => "text/foo" );

# add an alias to an existing type
$mime->add_alias( bar => "foo" );

# get mime type for standard or non standard types
$nonstandard_type = $mime->for_name('foo');
$standard_type    = $mime->for_name('svg');

# get mime type for a file (given the extension)
$mime_type = $mime->for_file("foo.bar");

PUBLIC API

instance

my $mime = Dancer::MIME->instance();

return the Dancer::MIME instance object.

add_type

# add nonstandard mime type
$mime->add_type( foo => "text/foo" );

Add a non standard mime type or overrides an existing one.

add_alias

# add alias to standard or previous alias
$mime->add_alias( my_jpg => 'jpg' );

Adds an alias to an existing mime type.

for_name

$mime->for_name( 'jpg' );

Retrieve the mime type for a standard or non standard mime type.

for_file

$mime->for_file( 'file.jpg' );

Retrieve the mime type for a file, based on a file extension.

custom_types

my $types = $mime->custom_types;

Retrieve the full hash table of added mime types.

name_or_type

my $type = $mime->name_or_type($thing);

Resolves the $thing into a content $type whether it's the name of a MIME type like "txt" or already a mime type like "text/plain".

AUTHORS

This module has been written and rewritten by different people from Dancer project.

LICENCE

This module is released under the same terms as Perl itself.

SEE ALSO

Dancer

AUTHOR

Dancer Core Developers

COPYRIGHT AND LICENSE

This software is copyright (c) 2010 by Alexis Sukrieh.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.