<commit_before>package core

import (
	"fmt"
	"html/template"
	"io"
	"os"
	"strings"
)

type Header struct {
	Name  string
	Value string
}

func (h Header) IsInsecure() bool {
	switch strings.ToLower(h.Name) {
	case "server", "x-powered-by":
		return true
	case "access-control-allow-origin":
		if h.Value == "*" {
			return true
		}
	case "x-xss-protection":
		if !strings.HasPrefix(h.Value, "1") {
			return true
		}
	}
	return false
}

func (h Header) IsSecure() bool {
	switch strings.ToLower(h.Name) {
	case "content-security-policy", "content-security-policy-report-only":
		return true
	case "strict-transport-security":
		return true
	case "x-frame-options":
		return true
	case "referrer-policy":
		return true
	case "public-key-pins":
		return true
	case "x-permitted-cross-domain-policies":
		if strings.ToLower(h.Value) == "master-only" {
			return true
		}
	case "x-content-type-options":
		if strings.ToLower(h.Value) == "nosniff" {
			return true
		}
	case "x-xss-protection":
		if strings.HasPrefix(h.Value, "1") {
			return true
		}
	}
	return false
}

type Page struct {
	URL            string
	Status         string
	Headers        []Header
	HeadersPath    string
	BodyPath       string
	ScreenshotPath string
	HasScreenshot  bool
	Tags           []Tag
	Notes          []Note
}

const (
	Template = `
<!doctype html>
<html lang="en">
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
		<link rel="stylesheet" href="https://bootswatch.com/4/darkly/bootstrap.min.css" integrity="<KEY>" crossorigin="anonymous">
		<title>AQUATONE REPORT</title><commit_msg>Remove SRI attribute from external CSS file in HTML report<commit_after>package core

import (
	"fmt"
	"html/template"
	"io"
	"os"
	"strings"
)

type Header struct {
	Name  string
	Value string
}

func (h Header) IsInsecure() bool {
	switch strings.ToLower(h.Name) {
	case "server", "x-powered-by":
		return true
	case "access-control-allow-origin":
		if h.Value == "*" {
			return true
		}
	case "x-xss-protection":
		if !strings.HasPrefix(h.Value, "1") {
			return true
		}
	}
	return false
}

func (h Header) IsSecure() bool {
	switch strings.ToLower(h.Name) {
	case "content-security-policy", "content-security-policy-report-only":
		return true
	case "strict-transport-security":
		return true
	case "x-frame-options":
		return true
	case "referrer-policy":
		return true
	case "public-key-pins":
		return true
	case "x-permitted-cross-domain-policies":
		if strings.ToLower(h.Value) == "master-only" {
			return true
		}
	case "x-content-type-options":
		if strings.ToLower(h.Value) == "nosniff" {
			return true
		}
	case "x-xss-protection":
		if strings.HasPrefix(h.Value, "1") {
			return true
		}
	}
	return false
}

type Page struct {
	URL            string
	Status         string
	Headers        []Header
	HeadersPath    string
	BodyPath       string
	ScreenshotPath string
	HasScreenshot  bool
	Tags           []Tag
	Notes          []Note
}

const (
	Template = `
<!doctype html>
<html lang="en">
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
		<link rel="stylesheet" href="https://bootswatch.com/4/darkly/bootstrap.min.css" crossorigin="anonymous">
		<title>AQUATONE REPORT</title>
{'fraction_non_alphanumeric': 0.13846153846153847, 'fraction_numerical': 0.0030165912518853697, 'mean_word_length': 3.3689064558629775, 'pattern_counts': {'":': 22, '<': 20, '<?xml version=': 0, '>': 20, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4248776', 'n_tokens_mistral': 1265, 'n_tokens_neox': 1188, 'n_words': 277}