NAME

Koha::QA::Security::Nonce - Check for missing nonce attributes in script/link tags

SYNOPSIS

use Koha::QA::Security::Nonce;

# With a file
my $checker = Koha::QA::Security::Nonce->new({file => $file_path});

# Or with content directly
my $checker = Koha::QA::Security::Nonce->new({content => $template_content});

my $is_valid = $checker->check;
my @errors = $checker->errors;

DESCRIPTION

This module checks Template Toolkit files for script and link tags that are missing nonce attributes.

METHODS

new

my $checker = Koha::QA::Security::Nonce->new({file => $file_path});

Creates a new Nonce checker instance.

check

my $is_valid = $checker->check;

Checks the file for missing nonce attributes.

errors

my @errors = $checker->errors;

Returns array of error hashrefs, each containing: - file: the file path - line: the line number - script: the script/link tag content - error: the error type (missing_nonce_attribute)

AUTHORS

Koha Development Team

COPYRIGHT

Copyright 2024-2026 Koha Development Team

LICENSE

This file is part of Koha.

Koha is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.