configuration/strings/nginx.strings.ts

configuration/strings/nginx.strings.ts is a file in Project Scripts. 41 lines of code and 13 definitions.

import {
    ENGINE_DIRECTIVE,
    IMPORT_DIRECTIVE,
    POLICY_HEADER,
    PRIVATE_REFERRERS,
    REFERRER_HEADER,
    REQUIRED_ENGINE,
    TERMINATOR,
} from "#configuration/constants/nginx.constants";

export const commentsHeld = function commentsHeld(count: number): string {
    return `[config-comments] ${String(count)} server configuration file(s) carry no comment\n`;
};

export const commentsHeading = function commentsHeading(count: number): string {
    return `[config-comments] ${String(count)} comment line(s) in the server configuration:`;
};

export const COMMENT_REMEDY =
    "  A configuration file states directives only. Delete the comment, and record a non-obvious reason in the server member's manifest.";

export const engineHeld = function engineHeld(count: number): string {
    return `[config-engine] ${String(count)} server configuration file(s) checked, and every one that imports an njs script selects ${REQUIRED_ENGINE}\n`;
};

export const engineHeading = function engineHeading(count: number): string {
    return `[config-engine] ${String(count)} server configuration file(s) do not select the script engine:`;
};

export const ENGINE_MISSING = `imports an njs script and declares no ${ENGINE_DIRECTIVE}`;

export const otherEngine = function otherEngine(engine: string): string {
    return `declares ${ENGINE_DIRECTIVE} ${engine}`;
};

export const headersHeld = function headersHeld(count: number): string {
    return `[config-headers] ${String(count)} server configuration file(s) checked, and every policy header names closed sources and a private referrer policy\n`;
};

export const headersHeading = function headersHeading(count: number): string {
    return `[config-headers] ${String(count)} policy header value(s) open the page to other origins:`;
};

export const openSource = function openSource(source: string): string {
    return `${POLICY_HEADER} allows the source ${source}`;
};

export const openReferrer = function openReferrer(value: string): string {
    return `${REFERRER_HEADER} is ${value}`;
};

export const HEADERS_REMEDY = `  Name each origin a ${POLICY_HEADER} directive loads from, with no scheme alone, wildcard or unsafe keyword, and set ${REFERRER_HEADER} to ${[...PRIVATE_REFERRERS].join(" or ")}.`;

export const ENGINE_REMEDY = `  The njs scripts are written and tested against a full ECMAScript engine, and the default njs engine lacks built-ins such as Map. Add the directive "${ENGINE_DIRECTIVE} ${REQUIRED_ENGINE}${TERMINATOR}" beside the ${IMPORT_DIRECTIVE}.`;