refactor: csp gen (#4163)

Generator for CSP.
pull/4235/head^2
James Elliott 2022-10-22 22:19:32 +11:00 committed by GitHub
parent 2c1250c1fd
commit 00ab279336
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
36 changed files with 642 additions and 191 deletions

View File

@ -30,7 +30,19 @@ func newCodeCmd() *cobra.Command {
DisableAutoGenTag: true,
}
cmd.AddCommand(newCodeKeysCmd(), newCodeScriptsCmd())
cmd.AddCommand(newCodeKeysCmd(), newCodeServerCmd(), newCodeScriptsCmd())
return cmd
}
func newCodeServerCmd() *cobra.Command {
cmd := &cobra.Command{
Use: cmdUseServer,
Short: "Generate the Authelia server files",
RunE: codeServerRunE,
DisableAutoGenTag: true,
}
return cmd
}
@ -59,6 +71,38 @@ func newCodeKeysCmd() *cobra.Command {
return cmd
}
func codeServerRunE(cmd *cobra.Command, args []string) (err error) {
data := TemplateCSP{
PlaceholderNONCE: codeCSPNonce,
TemplateDefault: buildCSP(codeCSPProductionDefaultSrc, codeCSPValuesCommon, codeCSPValuesProduction),
TemplateDevelopment: buildCSP(codeCSPDevelopmentDefaultSrc, codeCSPValuesCommon, codeCSPValuesDevelopment),
}
var outputPath string
if outputPath, err = getPFlagPath(cmd.Flags(), cmdFlagRoot, cmdFlagFileServerGenerated); err != nil {
return err
}
var f *os.File
if f, err = os.Create(outputPath); err != nil {
return fmt.Errorf("failed to create file '%s': %w", outputPath, err)
}
if err = tmplServer.Execute(f, data); err != nil {
_ = f.Close()
return fmt.Errorf("failed to write output file '%s': %w", outputPath, err)
}
if err = f.Close(); err != nil {
return fmt.Errorf("failed to close output file '%s': %w", outputPath, err)
}
return nil
}
func codeScriptsRunE(cmd *cobra.Command, args []string) (err error) {
var (
root, pathScriptsGen string
@ -129,11 +173,6 @@ func codeScriptsRunE(cmd *cobra.Command, args []string) (err error) {
return nil
}
// GitHubTagsJSON represents the JSON struct for the GitHub Tags API.
type GitHubTagsJSON struct {
Name string `json:"name"`
}
func codeKeysRunE(cmd *cobra.Command, args []string) (err error) {
var (
pathCodeConfigKeys, root string

View File

@ -13,7 +13,7 @@ func newDocsCmd() *cobra.Command {
DisableAutoGenTag: true,
}
cmd.AddCommand(newDocsCLICmd(), newDocsDateCmd(), newDocsKeysCmd())
cmd.AddCommand(newDocsCLICmd(), newDocsDataCmd(), newDocsDateCmd())
return cmd
}

View File

@ -27,45 +27,39 @@ func newDocsCLICmd() *cobra.Command {
}
func docsCLIRunE(cmd *cobra.Command, args []string) (err error) {
var root, pathDocsCLIReference string
var outputPath string
if root, err = cmd.Flags().GetString(cmdFlagRoot); err != nil {
if outputPath, err = getPFlagPath(cmd.Flags(), cmdFlagRoot, cmdFlagDocs, cmdFlagDocsContent, cmdFlagDocsCLIReference); err != nil {
return err
}
if pathDocsCLIReference, err = cmd.Flags().GetString(cmdFlagDocsCLIReference); err != nil {
return err
}
fullPathDocsCLIReference := filepath.Join(root, pathDocsCLIReference)
if err = os.MkdirAll(fullPathDocsCLIReference, 0775); err != nil {
if err = os.MkdirAll(outputPath, 0775); err != nil {
if !os.IsExist(err) {
return err
}
}
if err = genCLIDoc(commands.NewRootCmd(), filepath.Join(fullPathDocsCLIReference, "authelia")); err != nil {
if err = genCLIDoc(commands.NewRootCmd(), filepath.Join(outputPath, "authelia")); err != nil {
return err
}
if err = genCLIDocWriteIndex(fullPathDocsCLIReference, "authelia"); err != nil {
if err = genCLIDocWriteIndex(outputPath, "authelia"); err != nil {
return err
}
if err = genCLIDoc(cmdscripts.NewRootCmd(), filepath.Join(fullPathDocsCLIReference, "authelia-scripts")); err != nil {
if err = genCLIDoc(cmdscripts.NewRootCmd(), filepath.Join(outputPath, "authelia-scripts")); err != nil {
return err
}
if err = genCLIDocWriteIndex(fullPathDocsCLIReference, "authelia-scripts"); err != nil {
if err = genCLIDocWriteIndex(outputPath, "authelia-scripts"); err != nil {
return err
}
if err = genCLIDoc(newRootCmd(), filepath.Join(fullPathDocsCLIReference, cmdUseRoot)); err != nil {
if err = genCLIDoc(newRootCmd(), filepath.Join(outputPath, cmdUseRoot)); err != nil {
return err
}
if err = genCLIDocWriteIndex(fullPathDocsCLIReference, cmdUseRoot); err != nil {
if err = genCLIDocWriteIndex(outputPath, cmdUseRoot); err != nil {
return err
}

View File

@ -0,0 +1,132 @@
package main
import (
"encoding/json"
"fmt"
"os"
"reflect"
"strings"
"github.com/spf13/cobra"
"github.com/authelia/authelia/v4/internal/configuration"
"github.com/authelia/authelia/v4/internal/configuration/schema"
)
func newDocsDataCmd() *cobra.Command {
cmd := &cobra.Command{
Use: cmdUseDocsData,
Short: "Generate docs data files",
RunE: rootSubCommandsRunE,
DisableAutoGenTag: true,
}
cmd.AddCommand(newDocsDataMiscCmd(), newDocsDataKeysCmd())
return cmd
}
func newDocsDataMiscCmd() *cobra.Command {
cmd := &cobra.Command{
Use: cmdUseDocsDataMisc,
Short: "Generate docs data file misc.json",
RunE: docsDataMiscRunE,
DisableAutoGenTag: true,
}
return cmd
}
func docsDataMiscRunE(cmd *cobra.Command, args []string) (err error) {
data := DocsDataMisc{
CSP: TemplateCSP{
PlaceholderNONCE: codeCSPNonce,
TemplateDefault: buildCSP(codeCSPProductionDefaultSrc, codeCSPValuesCommon, codeCSPValuesProduction),
TemplateDevelopment: buildCSP(codeCSPDevelopmentDefaultSrc, codeCSPValuesCommon, codeCSPValuesDevelopment),
},
}
data.CSP.TemplateDefault = strings.ReplaceAll(data.CSP.TemplateDefault, "%s", codeCSPNonce)
data.CSP.TemplateDevelopment = strings.ReplaceAll(data.CSP.TemplateDevelopment, "%s", codeCSPNonce)
var (
outputPath string
dataJSON []byte
)
if outputPath, err = getPFlagPath(cmd.Flags(), cmdFlagRoot, cmdFlagDocs, cmdFlagDocsData, cmdFlagDocsDataMisc); err != nil {
return err
}
if dataJSON, err = json.Marshal(data); err != nil {
return err
}
if err = os.WriteFile(outputPath, dataJSON, 0600); err != nil {
return fmt.Errorf("failed to write file '%s': %w", outputPath, err)
}
return nil
}
func newDocsDataKeysCmd() *cobra.Command {
cmd := &cobra.Command{
Use: cmdUseKeys,
Short: "Generate the docs data file for configuration keys",
RunE: docsKeysRunE,
DisableAutoGenTag: true,
}
return cmd
}
func docsKeysRunE(cmd *cobra.Command, args []string) (err error) {
//nolint:prealloc
var (
data []ConfigurationKey
)
keys := readTags("", reflect.TypeOf(schema.Configuration{}))
for _, key := range keys {
if strings.Contains(key, "[]") {
continue
}
ck := ConfigurationKey{
Path: key,
Secret: configuration.IsSecretKey(key),
}
switch {
case ck.Secret:
ck.Env = configuration.ToEnvironmentSecretKey(key, configuration.DefaultEnvPrefix, configuration.DefaultEnvDelimiter)
default:
ck.Env = configuration.ToEnvironmentKey(key, configuration.DefaultEnvPrefix, configuration.DefaultEnvDelimiter)
}
data = append(data, ck)
}
var (
dataJSON []byte
outputPath string
)
if outputPath, err = getPFlagPath(cmd.Flags(), cmdFlagRoot, cmdFlagDocs, cmdFlagDocsData, cmdFlagDocsDataKeys); err != nil {
return err
}
if dataJSON, err = json.Marshal(data); err != nil {
return err
}
if err = os.WriteFile(outputPath, dataJSON, 0600); err != nil {
return fmt.Errorf("failed to write file '%s': %w", outputPath, err)
}
return nil
}

View File

@ -32,14 +32,10 @@ func newDocsDateCmd() *cobra.Command {
func docsDateRunE(cmd *cobra.Command, args []string) (err error) {
var (
root, pathDocsContent, cwd, commitUtil, commitSince, commitFilter string
pathDocsContent, cwd, commitUtil, commitSince, commitFilter string
)
if root, err = cmd.Flags().GetString(cmdFlagRoot); err != nil {
return err
}
if pathDocsContent, err = cmd.Flags().GetString(cmdFlagDocsContent); err != nil {
if pathDocsContent, err = getPFlagPath(cmd.Flags(), cmdFlagRoot, cmdFlagDocs, cmdFlagDocsContent); err != nil {
return err
}
@ -59,7 +55,7 @@ func docsDateRunE(cmd *cobra.Command, args []string) (err error) {
commitFilter = fmt.Sprintf("%s...%s", commitUtil, commitSince)
}
return filepath.Walk(filepath.Join(root, pathDocsContent), func(path string, info fs.FileInfo, err error) error {
return filepath.Walk(pathDocsContent, func(path string, info fs.FileInfo, err error) error {
if err != nil {
return err
}

View File

@ -1,81 +0,0 @@
package main
import (
"encoding/json"
"fmt"
"os"
"path/filepath"
"reflect"
"strings"
"github.com/spf13/cobra"
"github.com/authelia/authelia/v4/internal/configuration"
"github.com/authelia/authelia/v4/internal/configuration/schema"
)
func newDocsKeysCmd() *cobra.Command {
cmd := &cobra.Command{
Use: cmdUseKeys,
Short: "Generate the docs data file for configuration keys",
RunE: docsKeysRunE,
DisableAutoGenTag: true,
}
return cmd
}
func docsKeysRunE(cmd *cobra.Command, args []string) (err error) {
//nolint:prealloc
var (
pathDocsConfigKeys, root string
data []ConfigurationKey
)
keys := readTags("", reflect.TypeOf(schema.Configuration{}))
for _, key := range keys {
if strings.Contains(key, "[]") {
continue
}
ck := ConfigurationKey{
Path: key,
Secret: configuration.IsSecretKey(key),
}
switch {
case ck.Secret:
ck.Env = configuration.ToEnvironmentSecretKey(key, configuration.DefaultEnvPrefix, configuration.DefaultEnvDelimiter)
default:
ck.Env = configuration.ToEnvironmentKey(key, configuration.DefaultEnvPrefix, configuration.DefaultEnvDelimiter)
}
data = append(data, ck)
}
var (
dataJSON []byte
)
if root, err = cmd.Flags().GetString(cmdFlagRoot); err != nil {
return err
}
if pathDocsConfigKeys, err = cmd.Flags().GetString(cmdFlagFileDocsKeys); err != nil {
return err
}
fullPathDocsConfigKeys := filepath.Join(root, pathDocsConfigKeys)
if dataJSON, err = json.Marshal(data); err != nil {
return err
}
if err = os.WriteFile(fullPathDocsConfigKeys, dataJSON, 0600); err != nil {
return fmt.Errorf("failed to write file '%s': %w", fullPathDocsConfigKeys, err)
}
return nil
}

View File

@ -46,7 +46,7 @@ func localesRunE(cmd *cobra.Command, args []string) (err error) {
return err
}
if pathDocsDataLanguages, err = cmd.Flags().GetString(cmdFlagDocsDataLanguages); err != nil {
if pathDocsDataLanguages, err = getPFlagPath(cmd.Flags(), cmdFlagRoot, cmdFlagDocs, cmdFlagDocsData, cmdFlagDocsDataLanguages); err != nil {
return err
}

View File

@ -33,12 +33,16 @@ func newRootCmd() *cobra.Command {
cmd.PersistentFlags().String(cmdFlagDirLocales, dirLocales, "The locales directory in relation to the root")
cmd.PersistentFlags().String(cmdFlagFileWebI18N, fileWebI18NIndex, "The i18n typescript configuration file in relation to the root")
cmd.PersistentFlags().String(cmdFlagDocsDataLanguages, fileDocsDataLanguages, "The languages docs data file in relation to the docs data folder")
cmd.PersistentFlags().String(cmdFlagDocsDataMisc, fileDocsDataMisc, "The misc docs data file in relation to the docs data folder")
cmd.PersistentFlags().String(cmdFlagDocsCLIReference, dirDocsCLIReference, "The directory to store the markdown in")
cmd.PersistentFlags().String(cmdFlagDocs, dirDocs, "The directory with the docs")
cmd.PersistentFlags().String(cmdFlagDocsContent, dirDocsContent, "The directory with the docs content")
cmd.PersistentFlags().String(cmdFlagDocsData, dirDocsData, "The directory with the docs data")
cmd.PersistentFlags().String(cmdFlagFileConfigKeys, fileCodeConfigKeys, "Sets the path of the keys file")
cmd.PersistentFlags().String(cmdFlagFileDocsKeys, fileDocsConfigKeys, "Sets the path of the docs keys file")
cmd.PersistentFlags().String(cmdFlagDocsDataKeys, fileDocsDataConfigKeys, "Sets the path of the docs keys file")
cmd.PersistentFlags().String(cmdFlagPackageConfigKeys, pkgConfigSchema, "Sets the package name of the keys file")
cmd.PersistentFlags().String(cmdFlagFileScriptsGen, fileScriptsGen, "Sets the path of the authelia-scripts gen file")
cmd.PersistentFlags().String(cmdFlagFileServerGenerated, fileServerGenerated, "Sets the path of the server generated file")
cmd.PersistentFlags().String(cmdFlagPackageScriptsGen, pkgScriptsGen, "Sets the package name of the authelia-scripts gen file")
cmd.PersistentFlags().String(cmdFlagFileConfigCommitLint, fileCICommitLintConfig, "The commit lint javascript configuration file in relation to the root")
cmd.PersistentFlags().String(cmdFlagFileDocsCommitMsgGuidelines, fileDocsCommitMessageGuidelines, "The commit message guidelines documentation file in relation to the root")

View File

@ -12,14 +12,18 @@ const (
fileDocsCommitMessageGuidelines = "docs/content/en/contributing/guidelines/commit-message.md"
fileDocsConfigKeys = "docs/data/configkeys.json"
fileCodeConfigKeys = "internal/configuration/schema/keys.go"
fileScriptsGen = "cmd/authelia-scripts/cmd/gen.go"
fileCodeConfigKeys = "internal/configuration/schema/keys.go"
fileServerGenerated = "internal/server/gen.go"
fileScriptsGen = "cmd/authelia-scripts/cmd/gen.go"
dirDocsContent = "docs/content"
dirDocsCLIReference = dirDocsContent + "/en/reference/cli"
dirDocs = "docs"
dirDocsContent = "content"
dirDocsData = "data"
dirDocsCLIReference = "en/reference/cli"
fileDocsDataLanguages = "docs/data/languages.json"
fileDocsDataLanguages = "languages.json"
fileDocsDataMisc = "misc.json"
fileDocsDataConfigKeys = "configkeys.json"
fileGitHubIssueTemplateFR = ".github/ISSUE_TEMPLATE/feature-request.yml"
fileGitHubIssueTemplateBR = ".github/ISSUE_TEMPLATE/bug-report.yml"
@ -48,6 +52,8 @@ const (
cmdUseDocs = "docs"
cmdUseDocsDate = "date"
cmdUseDocsCLI = "cli"
cmdUseDocsData = "data"
cmdUseDocsDataMisc = "misc"
cmdUseGitHub = "github"
cmdUseGitHubIssueTemplates = "issue-templates"
cmdUseGitHubIssueTemplatesFR = "feature-request"
@ -57,6 +63,7 @@ const (
cmdUseCode = "code"
cmdUseCodeScripts = "scripts"
cmdUseKeys = "keys"
cmdUseServer = "server"
)
const (
@ -66,11 +73,15 @@ const (
cmdFlagDirLocales = "dir.locales"
cmdFlagDocsCLIReference = "dir.docs.cli-reference"
cmdFlagDocsContent = "dir.docs.content"
cmdFlagDocsData = "dir.docs.data"
cmdFlagDocs = "dir.docs"
cmdFlagDocsDataLanguages = "file.docs.data.languages"
cmdFlagDocsDataMisc = "file.docs.data.misc"
cmdFlagDocsDataKeys = "file.docs.data.keys"
cmdFlagCwd = "cwd"
cmdFlagFileConfigKeys = "file.configuration-keys"
cmdFlagFileDocsKeys = "file.docs-keys"
cmdFlagFileScriptsGen = "file.scripts.gen"
cmdFlagFileServerGenerated = "file.server.generated"
cmdFlagFileConfigCommitLint = "file.commit-lint-config"
cmdFlagFileDocsCommitMsgGuidelines = "file.docs-commit-msg-guidelines"
cmdFlagFileWebI18N = "file.web-i18n"
@ -79,3 +90,24 @@ const (
cmdFlagPackageConfigKeys = "package.configuration.keys"
cmdFlagPackageScriptsGen = "package.scripts.gen"
)
const (
codeCSPProductionDefaultSrc = "'self'"
codeCSPDevelopmentDefaultSrc = "'self' 'unsafe-eval'"
codeCSPNonce = "${NONCE}"
)
var (
codeCSPValuesCommon = []CSPValue{
{Name: "default-src", Value: ""},
{Name: "frame-src", Value: "'none'"},
{Name: "object-src", Value: "'none'"},
{Name: "style-src", Value: "'self' 'nonce-%s'"},
{Name: "frame-ancestors", Value: "'none'"},
{Name: "base-uri", Value: "'self'"},
}
codeCSPValuesProduction = []CSPValue{}
codeCSPValuesDevelopment = []CSPValue{}
)

View File

@ -0,0 +1,48 @@
package main
import (
"fmt"
"path/filepath"
"strings"
"github.com/spf13/pflag"
)
func getPFlagPath(flags *pflag.FlagSet, flagNames ...string) (fullPath string, err error) {
if len(flagNames) == 0 {
return "", fmt.Errorf("no flag names")
}
var p string
for i, flagName := range flagNames {
if p, err = flags.GetString(flagName); err != nil {
return "", fmt.Errorf("failed to lookup flag '%s': %w", flagName, err)
}
if i == 0 {
fullPath = p
} else {
fullPath = filepath.Join(fullPath, p)
}
}
return fullPath, nil
}
func buildCSP(defaultSrc string, ruleSets ...[]CSPValue) string {
var rules []string
for _, ruleSet := range ruleSets {
for _, rule := range ruleSet {
switch rule.Name {
case "default-src":
rules = append(rules, fmt.Sprintf("%s %s", rule.Name, defaultSrc))
default:
rules = append(rules, fmt.Sprintf("%s %s", rule.Name, rule.Value))
}
}
}
return strings.Join(rules, "; ")
}

View File

@ -24,6 +24,7 @@ var (
tmplDotCommitLintRC = template.Must(newTMPL("dot_commitlintrc.js"))
tmplDocsCommitMessageGuidelines = template.Must(newTMPL("docs-contributing-development-commitmsg.md"))
tmplScriptsGen = template.Must(newTMPL("cmd-authelia-scripts-gen.go"))
tmplServer = template.Must(newTMPL("server_gen.go"))
)
func fmJoinX(elems []string, sep string, n int, p string) string {

View File

@ -0,0 +1,13 @@
// Code generated by go generate. DO NOT EDIT.
//
// Run the following command to generate this file:
// go run ./cmd/authelia-gen code server
//
package server
const (
placeholderCSPNonce = "{{ .PlaceholderNONCE }}"
tmplCSPDefault = "{{ .TemplateDefault }}"
tmplCSPDevelopment = "{{ .TemplateDevelopment }}"
)

View File

@ -25,6 +25,23 @@ type tmplScriptsGEnData struct {
VersionSwaggerUI string
}
// GitHubTagsJSON represents the JSON struct for the GitHub Tags API.
type GitHubTagsJSON struct {
Name string `json:"name"`
}
// DocsDataMisc represents the docs misc data schema.
type DocsDataMisc struct {
CSP TemplateCSP `json:"csp"`
}
// TemplateCSP represents the CSP template vars.
type TemplateCSP struct {
TemplateDefault string `json:"default"`
TemplateDevelopment string `json:"development"`
PlaceholderNONCE string `json:"nonce"`
}
// ConfigurationKey is the docs json model for the Authelia configuration keys.
type ConfigurationKey struct {
Path string `json:"path"`
@ -121,3 +138,8 @@ var labelTypeDescriptions = [...]string{
func (t labelType) String() string {
return fmt.Sprintf("%s/%s", labelAreaPrefixType, labelTypeDescriptions[t])
}
type CSPValue struct {
Name string
Value string
}

View File

@ -161,11 +161,11 @@ or intermediate certificates. If no item is provided mutual TLS is disabled.
{{< confkey type="string" required="no" >}}
This customizes the value of the Content-Security-Policy header. It will replace all instances of `${NONCE}` with the
nonce value of the Authelia react bundle. This is an advanced option to customize and you should do sufficient research
about how browsers utilize and understand this header before attempting to customize it.
This customizes the value of the Content-Security-Policy header. It will replace all instances of the below placeholder
with the nonce value of the Authelia react bundle. This is an advanced option to customize and you should do sufficient
research about how browsers utilize and understand this header before attempting to customize it.
For example, the default CSP template is `default-src 'self'; frame-src 'none'; object-src 'none'; style-src 'self' 'nonce-${NONCE}'; frame-ancestors 'none'; base-uri 'self'`.
{{< csp >}}
### buffers

View File

@ -24,8 +24,10 @@ authelia-gen [flags]
```
-C, --cwd string Sets the CWD for git commands
--dir.docs.cli-reference string The directory to store the markdown in (default "docs/content/en/reference/cli")
--dir.docs.content string The directory with the docs content (default "docs/content")
--dir.docs string The directory with the docs (default "docs")
--dir.docs.cli-reference string The directory to store the markdown in (default "en/reference/cli")
--dir.docs.content string The directory with the docs content (default "content")
--dir.docs.data string The directory with the docs data (default "data")
--dir.locales string The locales directory in relation to the root (default "internal/server/locales")
-d, --dir.root string The repository root (default "./")
-X, --exclude strings Sets the names of excluded generators
@ -33,10 +35,12 @@ authelia-gen [flags]
--file.commit-lint-config string The commit lint javascript configuration file in relation to the root (default "web/.commitlintrc.js")
--file.configuration-keys string Sets the path of the keys file (default "internal/configuration/schema/keys.go")
--file.docs-commit-msg-guidelines string The commit message guidelines documentation file in relation to the root (default "docs/content/en/contributing/guidelines/commit-message.md")
--file.docs-keys string Sets the path of the docs keys file (default "docs/data/configkeys.json")
--file.docs.data.languages string The languages docs data file in relation to the docs data folder (default "docs/data/languages.json")
--file.docs.data.keys string Sets the path of the docs keys file (default "configkeys.json")
--file.docs.data.languages string The languages docs data file in relation to the docs data folder (default "languages.json")
--file.docs.data.misc string The misc docs data file in relation to the docs data folder (default "misc.json")
--file.feature-request string Sets the path of the feature request issue template file (default ".github/ISSUE_TEMPLATE/feature-request.yml")
--file.scripts.gen string Sets the path of the authelia-scripts gen file (default "cmd/authelia-scripts/cmd/gen.go")
--file.server.generated string Sets the path of the server generated file (default "internal/server/gen.go")
--file.web-i18n string The i18n typescript configuration file in relation to the root (default "web/src/i18n/index.ts")
-h, --help help for authelia-gen
--package.configuration.keys string Sets the package name of the keys file (default "schema")

View File

@ -30,8 +30,10 @@ authelia-gen code [flags]
```
-C, --cwd string Sets the CWD for git commands
--dir.docs.cli-reference string The directory to store the markdown in (default "docs/content/en/reference/cli")
--dir.docs.content string The directory with the docs content (default "docs/content")
--dir.docs string The directory with the docs (default "docs")
--dir.docs.cli-reference string The directory to store the markdown in (default "en/reference/cli")
--dir.docs.content string The directory with the docs content (default "content")
--dir.docs.data string The directory with the docs data (default "data")
--dir.locales string The locales directory in relation to the root (default "internal/server/locales")
-d, --dir.root string The repository root (default "./")
-X, --exclude strings Sets the names of excluded generators
@ -39,10 +41,12 @@ authelia-gen code [flags]
--file.commit-lint-config string The commit lint javascript configuration file in relation to the root (default "web/.commitlintrc.js")
--file.configuration-keys string Sets the path of the keys file (default "internal/configuration/schema/keys.go")
--file.docs-commit-msg-guidelines string The commit message guidelines documentation file in relation to the root (default "docs/content/en/contributing/guidelines/commit-message.md")
--file.docs-keys string Sets the path of the docs keys file (default "docs/data/configkeys.json")
--file.docs.data.languages string The languages docs data file in relation to the docs data folder (default "docs/data/languages.json")
--file.docs.data.keys string Sets the path of the docs keys file (default "configkeys.json")
--file.docs.data.languages string The languages docs data file in relation to the docs data folder (default "languages.json")
--file.docs.data.misc string The misc docs data file in relation to the docs data folder (default "misc.json")
--file.feature-request string Sets the path of the feature request issue template file (default ".github/ISSUE_TEMPLATE/feature-request.yml")
--file.scripts.gen string Sets the path of the authelia-scripts gen file (default "cmd/authelia-scripts/cmd/gen.go")
--file.server.generated string Sets the path of the server generated file (default "internal/server/gen.go")
--file.web-i18n string The i18n typescript configuration file in relation to the root (default "web/src/i18n/index.ts")
--package.configuration.keys string Sets the package name of the keys file (default "schema")
--package.scripts.gen string Sets the package name of the authelia-scripts gen file (default "cmd")
@ -54,4 +58,5 @@ authelia-gen code [flags]
* [authelia-gen](authelia-gen.md) - Authelia's generator tooling
* [authelia-gen code keys](authelia-gen_code_keys.md) - Generate the list of valid configuration keys
* [authelia-gen code scripts](authelia-gen_code_scripts.md) - Generate the generated portion of the authelia-scripts command
* [authelia-gen code server](authelia-gen_code_server.md) - Generate the Authelia server files

View File

@ -30,8 +30,10 @@ authelia-gen code keys [flags]
```
-C, --cwd string Sets the CWD for git commands
--dir.docs.cli-reference string The directory to store the markdown in (default "docs/content/en/reference/cli")
--dir.docs.content string The directory with the docs content (default "docs/content")
--dir.docs string The directory with the docs (default "docs")
--dir.docs.cli-reference string The directory to store the markdown in (default "en/reference/cli")
--dir.docs.content string The directory with the docs content (default "content")
--dir.docs.data string The directory with the docs data (default "data")
--dir.locales string The locales directory in relation to the root (default "internal/server/locales")
-d, --dir.root string The repository root (default "./")
-X, --exclude strings Sets the names of excluded generators
@ -39,10 +41,12 @@ authelia-gen code keys [flags]
--file.commit-lint-config string The commit lint javascript configuration file in relation to the root (default "web/.commitlintrc.js")
--file.configuration-keys string Sets the path of the keys file (default "internal/configuration/schema/keys.go")
--file.docs-commit-msg-guidelines string The commit message guidelines documentation file in relation to the root (default "docs/content/en/contributing/guidelines/commit-message.md")
--file.docs-keys string Sets the path of the docs keys file (default "docs/data/configkeys.json")
--file.docs.data.languages string The languages docs data file in relation to the docs data folder (default "docs/data/languages.json")
--file.docs.data.keys string Sets the path of the docs keys file (default "configkeys.json")
--file.docs.data.languages string The languages docs data file in relation to the docs data folder (default "languages.json")
--file.docs.data.misc string The misc docs data file in relation to the docs data folder (default "misc.json")
--file.feature-request string Sets the path of the feature request issue template file (default ".github/ISSUE_TEMPLATE/feature-request.yml")
--file.scripts.gen string Sets the path of the authelia-scripts gen file (default "cmd/authelia-scripts/cmd/gen.go")
--file.server.generated string Sets the path of the server generated file (default "internal/server/gen.go")
--file.web-i18n string The i18n typescript configuration file in relation to the root (default "web/src/i18n/index.ts")
--package.configuration.keys string Sets the package name of the keys file (default "schema")
--package.scripts.gen string Sets the package name of the authelia-scripts gen file (default "cmd")

View File

@ -30,8 +30,10 @@ authelia-gen code scripts [flags]
```
-C, --cwd string Sets the CWD for git commands
--dir.docs.cli-reference string The directory to store the markdown in (default "docs/content/en/reference/cli")
--dir.docs.content string The directory with the docs content (default "docs/content")
--dir.docs string The directory with the docs (default "docs")
--dir.docs.cli-reference string The directory to store the markdown in (default "en/reference/cli")
--dir.docs.content string The directory with the docs content (default "content")
--dir.docs.data string The directory with the docs data (default "data")
--dir.locales string The locales directory in relation to the root (default "internal/server/locales")
-d, --dir.root string The repository root (default "./")
-X, --exclude strings Sets the names of excluded generators
@ -39,10 +41,12 @@ authelia-gen code scripts [flags]
--file.commit-lint-config string The commit lint javascript configuration file in relation to the root (default "web/.commitlintrc.js")
--file.configuration-keys string Sets the path of the keys file (default "internal/configuration/schema/keys.go")
--file.docs-commit-msg-guidelines string The commit message guidelines documentation file in relation to the root (default "docs/content/en/contributing/guidelines/commit-message.md")
--file.docs-keys string Sets the path of the docs keys file (default "docs/data/configkeys.json")
--file.docs.data.languages string The languages docs data file in relation to the docs data folder (default "docs/data/languages.json")
--file.docs.data.keys string Sets the path of the docs keys file (default "configkeys.json")
--file.docs.data.languages string The languages docs data file in relation to the docs data folder (default "languages.json")
--file.docs.data.misc string The misc docs data file in relation to the docs data folder (default "misc.json")
--file.feature-request string Sets the path of the feature request issue template file (default ".github/ISSUE_TEMPLATE/feature-request.yml")
--file.scripts.gen string Sets the path of the authelia-scripts gen file (default "cmd/authelia-scripts/cmd/gen.go")
--file.server.generated string Sets the path of the server generated file (default "internal/server/gen.go")
--file.web-i18n string The i18n typescript configuration file in relation to the root (default "web/src/i18n/index.ts")
--package.configuration.keys string Sets the package name of the keys file (default "schema")
--package.scripts.gen string Sets the package name of the authelia-scripts gen file (default "cmd")

View File

@ -0,0 +1,59 @@
---
title: "authelia-gen code server"
description: "Reference for the authelia-gen code server command."
lead: ""
date: 2022-06-15T17:51:47+10:00
draft: false
images: []
menu:
reference:
parent: "cli-authelia-gen"
weight: 330
toc: true
---
## authelia-gen code server
Generate the Authelia server files
```
authelia-gen code server [flags]
```
### Options
```
-h, --help help for server
```
### Options inherited from parent commands
```
-C, --cwd string Sets the CWD for git commands
--dir.docs string The directory with the docs (default "docs")
--dir.docs.cli-reference string The directory to store the markdown in (default "en/reference/cli")
--dir.docs.content string The directory with the docs content (default "content")
--dir.docs.data string The directory with the docs data (default "data")
--dir.locales string The locales directory in relation to the root (default "internal/server/locales")
-d, --dir.root string The repository root (default "./")
-X, --exclude strings Sets the names of excluded generators
--file.bug-report string Sets the path of the bug report issue template file (default ".github/ISSUE_TEMPLATE/bug-report.yml")
--file.commit-lint-config string The commit lint javascript configuration file in relation to the root (default "web/.commitlintrc.js")
--file.configuration-keys string Sets the path of the keys file (default "internal/configuration/schema/keys.go")
--file.docs-commit-msg-guidelines string The commit message guidelines documentation file in relation to the root (default "docs/content/en/contributing/guidelines/commit-message.md")
--file.docs.data.keys string Sets the path of the docs keys file (default "configkeys.json")
--file.docs.data.languages string The languages docs data file in relation to the docs data folder (default "languages.json")
--file.docs.data.misc string The misc docs data file in relation to the docs data folder (default "misc.json")
--file.feature-request string Sets the path of the feature request issue template file (default ".github/ISSUE_TEMPLATE/feature-request.yml")
--file.scripts.gen string Sets the path of the authelia-scripts gen file (default "cmd/authelia-scripts/cmd/gen.go")
--file.server.generated string Sets the path of the server generated file (default "internal/server/gen.go")
--file.web-i18n string The i18n typescript configuration file in relation to the root (default "web/src/i18n/index.ts")
--package.configuration.keys string Sets the package name of the keys file (default "schema")
--package.scripts.gen string Sets the package name of the authelia-scripts gen file (default "cmd")
--versions int the maximum number of minor versions to list in output templates (default 5)
```
### SEE ALSO
* [authelia-gen code](authelia-gen_code.md) - Generate code

View File

@ -30,8 +30,10 @@ authelia-gen commit-lint [flags]
```
-C, --cwd string Sets the CWD for git commands
--dir.docs.cli-reference string The directory to store the markdown in (default "docs/content/en/reference/cli")
--dir.docs.content string The directory with the docs content (default "docs/content")
--dir.docs string The directory with the docs (default "docs")
--dir.docs.cli-reference string The directory to store the markdown in (default "en/reference/cli")
--dir.docs.content string The directory with the docs content (default "content")
--dir.docs.data string The directory with the docs data (default "data")
--dir.locales string The locales directory in relation to the root (default "internal/server/locales")
-d, --dir.root string The repository root (default "./")
-X, --exclude strings Sets the names of excluded generators
@ -39,10 +41,12 @@ authelia-gen commit-lint [flags]
--file.commit-lint-config string The commit lint javascript configuration file in relation to the root (default "web/.commitlintrc.js")
--file.configuration-keys string Sets the path of the keys file (default "internal/configuration/schema/keys.go")
--file.docs-commit-msg-guidelines string The commit message guidelines documentation file in relation to the root (default "docs/content/en/contributing/guidelines/commit-message.md")
--file.docs-keys string Sets the path of the docs keys file (default "docs/data/configkeys.json")
--file.docs.data.languages string The languages docs data file in relation to the docs data folder (default "docs/data/languages.json")
--file.docs.data.keys string Sets the path of the docs keys file (default "configkeys.json")
--file.docs.data.languages string The languages docs data file in relation to the docs data folder (default "languages.json")
--file.docs.data.misc string The misc docs data file in relation to the docs data folder (default "misc.json")
--file.feature-request string Sets the path of the feature request issue template file (default ".github/ISSUE_TEMPLATE/feature-request.yml")
--file.scripts.gen string Sets the path of the authelia-scripts gen file (default "cmd/authelia-scripts/cmd/gen.go")
--file.server.generated string Sets the path of the server generated file (default "internal/server/gen.go")
--file.web-i18n string The i18n typescript configuration file in relation to the root (default "web/src/i18n/index.ts")
--package.configuration.keys string Sets the package name of the keys file (default "schema")
--package.scripts.gen string Sets the package name of the authelia-scripts gen file (default "cmd")

View File

@ -30,8 +30,10 @@ authelia-gen docs [flags]
```
-C, --cwd string Sets the CWD for git commands
--dir.docs.cli-reference string The directory to store the markdown in (default "docs/content/en/reference/cli")
--dir.docs.content string The directory with the docs content (default "docs/content")
--dir.docs string The directory with the docs (default "docs")
--dir.docs.cli-reference string The directory to store the markdown in (default "en/reference/cli")
--dir.docs.content string The directory with the docs content (default "content")
--dir.docs.data string The directory with the docs data (default "data")
--dir.locales string The locales directory in relation to the root (default "internal/server/locales")
-d, --dir.root string The repository root (default "./")
-X, --exclude strings Sets the names of excluded generators
@ -39,10 +41,12 @@ authelia-gen docs [flags]
--file.commit-lint-config string The commit lint javascript configuration file in relation to the root (default "web/.commitlintrc.js")
--file.configuration-keys string Sets the path of the keys file (default "internal/configuration/schema/keys.go")
--file.docs-commit-msg-guidelines string The commit message guidelines documentation file in relation to the root (default "docs/content/en/contributing/guidelines/commit-message.md")
--file.docs-keys string Sets the path of the docs keys file (default "docs/data/configkeys.json")
--file.docs.data.languages string The languages docs data file in relation to the docs data folder (default "docs/data/languages.json")
--file.docs.data.keys string Sets the path of the docs keys file (default "configkeys.json")
--file.docs.data.languages string The languages docs data file in relation to the docs data folder (default "languages.json")
--file.docs.data.misc string The misc docs data file in relation to the docs data folder (default "misc.json")
--file.feature-request string Sets the path of the feature request issue template file (default ".github/ISSUE_TEMPLATE/feature-request.yml")
--file.scripts.gen string Sets the path of the authelia-scripts gen file (default "cmd/authelia-scripts/cmd/gen.go")
--file.server.generated string Sets the path of the server generated file (default "internal/server/gen.go")
--file.web-i18n string The i18n typescript configuration file in relation to the root (default "web/src/i18n/index.ts")
--package.configuration.keys string Sets the package name of the keys file (default "schema")
--package.scripts.gen string Sets the package name of the authelia-scripts gen file (default "cmd")
@ -53,6 +57,6 @@ authelia-gen docs [flags]
* [authelia-gen](authelia-gen.md) - Authelia's generator tooling
* [authelia-gen docs cli](authelia-gen_docs_cli.md) - Generate CLI docs
* [authelia-gen docs data](authelia-gen_docs_data.md) - Generate docs data files
* [authelia-gen docs date](authelia-gen_docs_date.md) - Generate doc dates
* [authelia-gen docs keys](authelia-gen_docs_keys.md) - Generate the docs data file for configuration keys

View File

@ -30,8 +30,10 @@ authelia-gen docs cli [flags]
```
-C, --cwd string Sets the CWD for git commands
--dir.docs.cli-reference string The directory to store the markdown in (default "docs/content/en/reference/cli")
--dir.docs.content string The directory with the docs content (default "docs/content")
--dir.docs string The directory with the docs (default "docs")
--dir.docs.cli-reference string The directory to store the markdown in (default "en/reference/cli")
--dir.docs.content string The directory with the docs content (default "content")
--dir.docs.data string The directory with the docs data (default "data")
--dir.locales string The locales directory in relation to the root (default "internal/server/locales")
-d, --dir.root string The repository root (default "./")
-X, --exclude strings Sets the names of excluded generators
@ -39,10 +41,12 @@ authelia-gen docs cli [flags]
--file.commit-lint-config string The commit lint javascript configuration file in relation to the root (default "web/.commitlintrc.js")
--file.configuration-keys string Sets the path of the keys file (default "internal/configuration/schema/keys.go")
--file.docs-commit-msg-guidelines string The commit message guidelines documentation file in relation to the root (default "docs/content/en/contributing/guidelines/commit-message.md")
--file.docs-keys string Sets the path of the docs keys file (default "docs/data/configkeys.json")
--file.docs.data.languages string The languages docs data file in relation to the docs data folder (default "docs/data/languages.json")
--file.docs.data.keys string Sets the path of the docs keys file (default "configkeys.json")
--file.docs.data.languages string The languages docs data file in relation to the docs data folder (default "languages.json")
--file.docs.data.misc string The misc docs data file in relation to the docs data folder (default "misc.json")
--file.feature-request string Sets the path of the feature request issue template file (default ".github/ISSUE_TEMPLATE/feature-request.yml")
--file.scripts.gen string Sets the path of the authelia-scripts gen file (default "cmd/authelia-scripts/cmd/gen.go")
--file.server.generated string Sets the path of the server generated file (default "internal/server/gen.go")
--file.web-i18n string The i18n typescript configuration file in relation to the root (default "web/src/i18n/index.ts")
--package.configuration.keys string Sets the package name of the keys file (default "schema")
--package.scripts.gen string Sets the package name of the authelia-scripts gen file (default "cmd")

View File

@ -0,0 +1,61 @@
---
title: "authelia-gen docs data"
description: "Reference for the authelia-gen docs data command."
lead: ""
date: 2022-09-16T14:21:05+10:00
draft: false
images: []
menu:
reference:
parent: "cli-authelia-gen"
weight: 330
toc: true
---
## authelia-gen docs data
Generate docs data files
```
authelia-gen docs data [flags]
```
### Options
```
-h, --help help for data
```
### Options inherited from parent commands
```
-C, --cwd string Sets the CWD for git commands
--dir.docs string The directory with the docs (default "docs")
--dir.docs.cli-reference string The directory to store the markdown in (default "en/reference/cli")
--dir.docs.content string The directory with the docs content (default "content")
--dir.docs.data string The directory with the docs data (default "data")
--dir.locales string The locales directory in relation to the root (default "internal/server/locales")
-d, --dir.root string The repository root (default "./")
-X, --exclude strings Sets the names of excluded generators
--file.bug-report string Sets the path of the bug report issue template file (default ".github/ISSUE_TEMPLATE/bug-report.yml")
--file.commit-lint-config string The commit lint javascript configuration file in relation to the root (default "web/.commitlintrc.js")
--file.configuration-keys string Sets the path of the keys file (default "internal/configuration/schema/keys.go")
--file.docs-commit-msg-guidelines string The commit message guidelines documentation file in relation to the root (default "docs/content/en/contributing/guidelines/commit-message.md")
--file.docs.data.keys string Sets the path of the docs keys file (default "configkeys.json")
--file.docs.data.languages string The languages docs data file in relation to the docs data folder (default "languages.json")
--file.docs.data.misc string The misc docs data file in relation to the docs data folder (default "misc.json")
--file.feature-request string Sets the path of the feature request issue template file (default ".github/ISSUE_TEMPLATE/feature-request.yml")
--file.scripts.gen string Sets the path of the authelia-scripts gen file (default "cmd/authelia-scripts/cmd/gen.go")
--file.server.generated string Sets the path of the server generated file (default "internal/server/gen.go")
--file.web-i18n string The i18n typescript configuration file in relation to the root (default "web/src/i18n/index.ts")
--package.configuration.keys string Sets the package name of the keys file (default "schema")
--package.scripts.gen string Sets the package name of the authelia-scripts gen file (default "cmd")
--versions int the maximum number of minor versions to list in output templates (default 5)
```
### SEE ALSO
* [authelia-gen docs](authelia-gen_docs.md) - Generate docs
* [authelia-gen docs data keys](authelia-gen_docs_data_keys.md) - Generate the docs data file for configuration keys
* [authelia-gen docs data misc](authelia-gen_docs_data_misc.md) - Generate docs data file misc.json

View File

@ -1,6 +1,6 @@
---
title: "authelia-gen docs keys"
description: "Reference for the authelia-gen docs keys command."
title: "authelia-gen docs data keys"
description: "Reference for the authelia-gen docs data keys command."
lead: ""
date: 2022-09-16T14:21:05+10:00
draft: false
@ -12,12 +12,12 @@ weight: 330
toc: true
---
## authelia-gen docs keys
## authelia-gen docs data keys
Generate the docs data file for configuration keys
```
authelia-gen docs keys [flags]
authelia-gen docs data keys [flags]
```
### Options
@ -30,8 +30,10 @@ authelia-gen docs keys [flags]
```
-C, --cwd string Sets the CWD for git commands
--dir.docs.cli-reference string The directory to store the markdown in (default "docs/content/en/reference/cli")
--dir.docs.content string The directory with the docs content (default "docs/content")
--dir.docs string The directory with the docs (default "docs")
--dir.docs.cli-reference string The directory to store the markdown in (default "en/reference/cli")
--dir.docs.content string The directory with the docs content (default "content")
--dir.docs.data string The directory with the docs data (default "data")
--dir.locales string The locales directory in relation to the root (default "internal/server/locales")
-d, --dir.root string The repository root (default "./")
-X, --exclude strings Sets the names of excluded generators
@ -39,10 +41,12 @@ authelia-gen docs keys [flags]
--file.commit-lint-config string The commit lint javascript configuration file in relation to the root (default "web/.commitlintrc.js")
--file.configuration-keys string Sets the path of the keys file (default "internal/configuration/schema/keys.go")
--file.docs-commit-msg-guidelines string The commit message guidelines documentation file in relation to the root (default "docs/content/en/contributing/guidelines/commit-message.md")
--file.docs-keys string Sets the path of the docs keys file (default "docs/data/configkeys.json")
--file.docs.data.languages string The languages docs data file in relation to the docs data folder (default "docs/data/languages.json")
--file.docs.data.keys string Sets the path of the docs keys file (default "configkeys.json")
--file.docs.data.languages string The languages docs data file in relation to the docs data folder (default "languages.json")
--file.docs.data.misc string The misc docs data file in relation to the docs data folder (default "misc.json")
--file.feature-request string Sets the path of the feature request issue template file (default ".github/ISSUE_TEMPLATE/feature-request.yml")
--file.scripts.gen string Sets the path of the authelia-scripts gen file (default "cmd/authelia-scripts/cmd/gen.go")
--file.server.generated string Sets the path of the server generated file (default "internal/server/gen.go")
--file.web-i18n string The i18n typescript configuration file in relation to the root (default "web/src/i18n/index.ts")
--package.configuration.keys string Sets the package name of the keys file (default "schema")
--package.scripts.gen string Sets the package name of the authelia-scripts gen file (default "cmd")
@ -51,5 +55,5 @@ authelia-gen docs keys [flags]
### SEE ALSO
* [authelia-gen docs](authelia-gen_docs.md) - Generate docs
* [authelia-gen docs data](authelia-gen_docs_data.md) - Generate docs data files

View File

@ -0,0 +1,59 @@
---
title: "authelia-gen docs data misc"
description: "Reference for the authelia-gen docs data misc command."
lead: ""
date: 2022-06-15T17:51:47+10:00
draft: false
images: []
menu:
reference:
parent: "cli-authelia-gen"
weight: 330
toc: true
---
## authelia-gen docs data misc
Generate docs data file misc.json
```
authelia-gen docs data misc [flags]
```
### Options
```
-h, --help help for misc
```
### Options inherited from parent commands
```
-C, --cwd string Sets the CWD for git commands
--dir.docs string The directory with the docs (default "docs")
--dir.docs.cli-reference string The directory to store the markdown in (default "en/reference/cli")
--dir.docs.content string The directory with the docs content (default "content")
--dir.docs.data string The directory with the docs data (default "data")
--dir.locales string The locales directory in relation to the root (default "internal/server/locales")
-d, --dir.root string The repository root (default "./")
-X, --exclude strings Sets the names of excluded generators
--file.bug-report string Sets the path of the bug report issue template file (default ".github/ISSUE_TEMPLATE/bug-report.yml")
--file.commit-lint-config string The commit lint javascript configuration file in relation to the root (default "web/.commitlintrc.js")
--file.configuration-keys string Sets the path of the keys file (default "internal/configuration/schema/keys.go")
--file.docs-commit-msg-guidelines string The commit message guidelines documentation file in relation to the root (default "docs/content/en/contributing/guidelines/commit-message.md")
--file.docs.data.keys string Sets the path of the docs keys file (default "configkeys.json")
--file.docs.data.languages string The languages docs data file in relation to the docs data folder (default "languages.json")
--file.docs.data.misc string The misc docs data file in relation to the docs data folder (default "misc.json")
--file.feature-request string Sets the path of the feature request issue template file (default ".github/ISSUE_TEMPLATE/feature-request.yml")
--file.scripts.gen string Sets the path of the authelia-scripts gen file (default "cmd/authelia-scripts/cmd/gen.go")
--file.server.generated string Sets the path of the server generated file (default "internal/server/gen.go")
--file.web-i18n string The i18n typescript configuration file in relation to the root (default "web/src/i18n/index.ts")
--package.configuration.keys string Sets the package name of the keys file (default "schema")
--package.scripts.gen string Sets the package name of the authelia-scripts gen file (default "cmd")
--versions int the maximum number of minor versions to list in output templates (default 5)
```
### SEE ALSO
* [authelia-gen docs data](authelia-gen_docs_data.md) - Generate docs data files

View File

@ -32,8 +32,10 @@ authelia-gen docs date [flags]
```
-C, --cwd string Sets the CWD for git commands
--dir.docs.cli-reference string The directory to store the markdown in (default "docs/content/en/reference/cli")
--dir.docs.content string The directory with the docs content (default "docs/content")
--dir.docs string The directory with the docs (default "docs")
--dir.docs.cli-reference string The directory to store the markdown in (default "en/reference/cli")
--dir.docs.content string The directory with the docs content (default "content")
--dir.docs.data string The directory with the docs data (default "data")
--dir.locales string The locales directory in relation to the root (default "internal/server/locales")
-d, --dir.root string The repository root (default "./")
-X, --exclude strings Sets the names of excluded generators
@ -41,10 +43,12 @@ authelia-gen docs date [flags]
--file.commit-lint-config string The commit lint javascript configuration file in relation to the root (default "web/.commitlintrc.js")
--file.configuration-keys string Sets the path of the keys file (default "internal/configuration/schema/keys.go")
--file.docs-commit-msg-guidelines string The commit message guidelines documentation file in relation to the root (default "docs/content/en/contributing/guidelines/commit-message.md")
--file.docs-keys string Sets the path of the docs keys file (default "docs/data/configkeys.json")
--file.docs.data.languages string The languages docs data file in relation to the docs data folder (default "docs/data/languages.json")
--file.docs.data.keys string Sets the path of the docs keys file (default "configkeys.json")
--file.docs.data.languages string The languages docs data file in relation to the docs data folder (default "languages.json")
--file.docs.data.misc string The misc docs data file in relation to the docs data folder (default "misc.json")
--file.feature-request string Sets the path of the feature request issue template file (default ".github/ISSUE_TEMPLATE/feature-request.yml")
--file.scripts.gen string Sets the path of the authelia-scripts gen file (default "cmd/authelia-scripts/cmd/gen.go")
--file.server.generated string Sets the path of the server generated file (default "internal/server/gen.go")
--file.web-i18n string The i18n typescript configuration file in relation to the root (default "web/src/i18n/index.ts")
--package.configuration.keys string Sets the package name of the keys file (default "schema")
--package.scripts.gen string Sets the package name of the authelia-scripts gen file (default "cmd")

View File

@ -30,8 +30,10 @@ authelia-gen github [flags]
```
-C, --cwd string Sets the CWD for git commands
--dir.docs.cli-reference string The directory to store the markdown in (default "docs/content/en/reference/cli")
--dir.docs.content string The directory with the docs content (default "docs/content")
--dir.docs string The directory with the docs (default "docs")
--dir.docs.cli-reference string The directory to store the markdown in (default "en/reference/cli")
--dir.docs.content string The directory with the docs content (default "content")
--dir.docs.data string The directory with the docs data (default "data")
--dir.locales string The locales directory in relation to the root (default "internal/server/locales")
-d, --dir.root string The repository root (default "./")
-X, --exclude strings Sets the names of excluded generators
@ -39,10 +41,12 @@ authelia-gen github [flags]
--file.commit-lint-config string The commit lint javascript configuration file in relation to the root (default "web/.commitlintrc.js")
--file.configuration-keys string Sets the path of the keys file (default "internal/configuration/schema/keys.go")
--file.docs-commit-msg-guidelines string The commit message guidelines documentation file in relation to the root (default "docs/content/en/contributing/guidelines/commit-message.md")
--file.docs-keys string Sets the path of the docs keys file (default "docs/data/configkeys.json")
--file.docs.data.languages string The languages docs data file in relation to the docs data folder (default "docs/data/languages.json")
--file.docs.data.keys string Sets the path of the docs keys file (default "configkeys.json")
--file.docs.data.languages string The languages docs data file in relation to the docs data folder (default "languages.json")
--file.docs.data.misc string The misc docs data file in relation to the docs data folder (default "misc.json")
--file.feature-request string Sets the path of the feature request issue template file (default ".github/ISSUE_TEMPLATE/feature-request.yml")
--file.scripts.gen string Sets the path of the authelia-scripts gen file (default "cmd/authelia-scripts/cmd/gen.go")
--file.server.generated string Sets the path of the server generated file (default "internal/server/gen.go")
--file.web-i18n string The i18n typescript configuration file in relation to the root (default "web/src/i18n/index.ts")
--package.configuration.keys string Sets the package name of the keys file (default "schema")
--package.scripts.gen string Sets the package name of the authelia-scripts gen file (default "cmd")

View File

@ -30,8 +30,10 @@ authelia-gen github issue-templates [flags]
```
-C, --cwd string Sets the CWD for git commands
--dir.docs.cli-reference string The directory to store the markdown in (default "docs/content/en/reference/cli")
--dir.docs.content string The directory with the docs content (default "docs/content")
--dir.docs string The directory with the docs (default "docs")
--dir.docs.cli-reference string The directory to store the markdown in (default "en/reference/cli")
--dir.docs.content string The directory with the docs content (default "content")
--dir.docs.data string The directory with the docs data (default "data")
--dir.locales string The locales directory in relation to the root (default "internal/server/locales")
-d, --dir.root string The repository root (default "./")
-X, --exclude strings Sets the names of excluded generators
@ -39,10 +41,12 @@ authelia-gen github issue-templates [flags]
--file.commit-lint-config string The commit lint javascript configuration file in relation to the root (default "web/.commitlintrc.js")
--file.configuration-keys string Sets the path of the keys file (default "internal/configuration/schema/keys.go")
--file.docs-commit-msg-guidelines string The commit message guidelines documentation file in relation to the root (default "docs/content/en/contributing/guidelines/commit-message.md")
--file.docs-keys string Sets the path of the docs keys file (default "docs/data/configkeys.json")
--file.docs.data.languages string The languages docs data file in relation to the docs data folder (default "docs/data/languages.json")
--file.docs.data.keys string Sets the path of the docs keys file (default "configkeys.json")
--file.docs.data.languages string The languages docs data file in relation to the docs data folder (default "languages.json")
--file.docs.data.misc string The misc docs data file in relation to the docs data folder (default "misc.json")
--file.feature-request string Sets the path of the feature request issue template file (default ".github/ISSUE_TEMPLATE/feature-request.yml")
--file.scripts.gen string Sets the path of the authelia-scripts gen file (default "cmd/authelia-scripts/cmd/gen.go")
--file.server.generated string Sets the path of the server generated file (default "internal/server/gen.go")
--file.web-i18n string The i18n typescript configuration file in relation to the root (default "web/src/i18n/index.ts")
--package.configuration.keys string Sets the package name of the keys file (default "schema")
--package.scripts.gen string Sets the package name of the authelia-scripts gen file (default "cmd")

View File

@ -30,8 +30,10 @@ authelia-gen github issue-templates bug-report [flags]
```
-C, --cwd string Sets the CWD for git commands
--dir.docs.cli-reference string The directory to store the markdown in (default "docs/content/en/reference/cli")
--dir.docs.content string The directory with the docs content (default "docs/content")
--dir.docs string The directory with the docs (default "docs")
--dir.docs.cli-reference string The directory to store the markdown in (default "en/reference/cli")
--dir.docs.content string The directory with the docs content (default "content")
--dir.docs.data string The directory with the docs data (default "data")
--dir.locales string The locales directory in relation to the root (default "internal/server/locales")
-d, --dir.root string The repository root (default "./")
-X, --exclude strings Sets the names of excluded generators
@ -39,10 +41,12 @@ authelia-gen github issue-templates bug-report [flags]
--file.commit-lint-config string The commit lint javascript configuration file in relation to the root (default "web/.commitlintrc.js")
--file.configuration-keys string Sets the path of the keys file (default "internal/configuration/schema/keys.go")
--file.docs-commit-msg-guidelines string The commit message guidelines documentation file in relation to the root (default "docs/content/en/contributing/guidelines/commit-message.md")
--file.docs-keys string Sets the path of the docs keys file (default "docs/data/configkeys.json")
--file.docs.data.languages string The languages docs data file in relation to the docs data folder (default "docs/data/languages.json")
--file.docs.data.keys string Sets the path of the docs keys file (default "configkeys.json")
--file.docs.data.languages string The languages docs data file in relation to the docs data folder (default "languages.json")
--file.docs.data.misc string The misc docs data file in relation to the docs data folder (default "misc.json")
--file.feature-request string Sets the path of the feature request issue template file (default ".github/ISSUE_TEMPLATE/feature-request.yml")
--file.scripts.gen string Sets the path of the authelia-scripts gen file (default "cmd/authelia-scripts/cmd/gen.go")
--file.server.generated string Sets the path of the server generated file (default "internal/server/gen.go")
--file.web-i18n string The i18n typescript configuration file in relation to the root (default "web/src/i18n/index.ts")
--package.configuration.keys string Sets the package name of the keys file (default "schema")
--package.scripts.gen string Sets the package name of the authelia-scripts gen file (default "cmd")

View File

@ -30,8 +30,10 @@ authelia-gen github issue-templates feature-request [flags]
```
-C, --cwd string Sets the CWD for git commands
--dir.docs.cli-reference string The directory to store the markdown in (default "docs/content/en/reference/cli")
--dir.docs.content string The directory with the docs content (default "docs/content")
--dir.docs string The directory with the docs (default "docs")
--dir.docs.cli-reference string The directory to store the markdown in (default "en/reference/cli")
--dir.docs.content string The directory with the docs content (default "content")
--dir.docs.data string The directory with the docs data (default "data")
--dir.locales string The locales directory in relation to the root (default "internal/server/locales")
-d, --dir.root string The repository root (default "./")
-X, --exclude strings Sets the names of excluded generators
@ -39,10 +41,12 @@ authelia-gen github issue-templates feature-request [flags]
--file.commit-lint-config string The commit lint javascript configuration file in relation to the root (default "web/.commitlintrc.js")
--file.configuration-keys string Sets the path of the keys file (default "internal/configuration/schema/keys.go")
--file.docs-commit-msg-guidelines string The commit message guidelines documentation file in relation to the root (default "docs/content/en/contributing/guidelines/commit-message.md")
--file.docs-keys string Sets the path of the docs keys file (default "docs/data/configkeys.json")
--file.docs.data.languages string The languages docs data file in relation to the docs data folder (default "docs/data/languages.json")
--file.docs.data.keys string Sets the path of the docs keys file (default "configkeys.json")
--file.docs.data.languages string The languages docs data file in relation to the docs data folder (default "languages.json")
--file.docs.data.misc string The misc docs data file in relation to the docs data folder (default "misc.json")
--file.feature-request string Sets the path of the feature request issue template file (default ".github/ISSUE_TEMPLATE/feature-request.yml")
--file.scripts.gen string Sets the path of the authelia-scripts gen file (default "cmd/authelia-scripts/cmd/gen.go")
--file.server.generated string Sets the path of the server generated file (default "internal/server/gen.go")
--file.web-i18n string The i18n typescript configuration file in relation to the root (default "web/src/i18n/index.ts")
--package.configuration.keys string Sets the package name of the keys file (default "schema")
--package.scripts.gen string Sets the package name of the authelia-scripts gen file (default "cmd")

View File

@ -30,8 +30,10 @@ authelia-gen locales [flags]
```
-C, --cwd string Sets the CWD for git commands
--dir.docs.cli-reference string The directory to store the markdown in (default "docs/content/en/reference/cli")
--dir.docs.content string The directory with the docs content (default "docs/content")
--dir.docs string The directory with the docs (default "docs")
--dir.docs.cli-reference string The directory to store the markdown in (default "en/reference/cli")
--dir.docs.content string The directory with the docs content (default "content")
--dir.docs.data string The directory with the docs data (default "data")
--dir.locales string The locales directory in relation to the root (default "internal/server/locales")
-d, --dir.root string The repository root (default "./")
-X, --exclude strings Sets the names of excluded generators
@ -39,10 +41,12 @@ authelia-gen locales [flags]
--file.commit-lint-config string The commit lint javascript configuration file in relation to the root (default "web/.commitlintrc.js")
--file.configuration-keys string Sets the path of the keys file (default "internal/configuration/schema/keys.go")
--file.docs-commit-msg-guidelines string The commit message guidelines documentation file in relation to the root (default "docs/content/en/contributing/guidelines/commit-message.md")
--file.docs-keys string Sets the path of the docs keys file (default "docs/data/configkeys.json")
--file.docs.data.languages string The languages docs data file in relation to the docs data folder (default "docs/data/languages.json")
--file.docs.data.keys string Sets the path of the docs keys file (default "configkeys.json")
--file.docs.data.languages string The languages docs data file in relation to the docs data folder (default "languages.json")
--file.docs.data.misc string The misc docs data file in relation to the docs data folder (default "misc.json")
--file.feature-request string Sets the path of the feature request issue template file (default ".github/ISSUE_TEMPLATE/feature-request.yml")
--file.scripts.gen string Sets the path of the authelia-scripts gen file (default "cmd/authelia-scripts/cmd/gen.go")
--file.server.generated string Sets the path of the server generated file (default "internal/server/gen.go")
--file.web-i18n string The i18n typescript configuration file in relation to the root (default "web/src/i18n/index.ts")
--package.configuration.keys string Sets the package name of the keys file (default "schema")
--package.scripts.gen string Sets the package name of the authelia-scripts gen file (default "cmd")

View File

@ -0,0 +1 @@
{"csp":{"default":"default-src 'self'; frame-src 'none'; object-src 'none'; style-src 'self' 'nonce-${NONCE}'; frame-ancestors 'none'; base-uri 'self'; require-trusted-types-for 'script'","development":"default-src 'self' 'unsafe-eval'; frame-src 'none'; object-src 'none'; style-src 'self' 'nonce-${NONCE}'; frame-ancestors 'none'; base-uri 'self'","nonce":"${NONCE}"}}

View File

@ -0,0 +1,2 @@
<p><strong>Placeholder Value:</strong> <code>{{ $.Site.Data.misc.csp.nonce }}</code></p>
<p><strong>Default Template:</strong> <code>{{ $.Site.Data.misc.csp.default }}</code></p>

View File

@ -72,8 +72,7 @@ X_AUTHELIA_HEALTHCHECK_PATH=%s
`
const (
cspDefaultTemplate = "default-src 'self'%s; frame-src 'none'; object-src 'none'; style-src 'self' 'nonce-%s'; frame-ancestors 'none'; base-uri 'self'"
cspNoncePlaceholder = "${NONCE}"
tmplCSPSwagger = "default-src 'self'; img-src 'self' https://validator.swagger.io data:; object-src 'none'; script-src 'self' 'unsafe-inline' 'nonce-%s'; style-src 'self' 'nonce-%s'; base-uri 'self'"
)
const (

View File

@ -0,0 +1,13 @@
// Code generated by go generate. DO NOT EDIT.
//
// Run the following command to generate this file:
// go run ./cmd/authelia-gen code server
//
package server
const (
placeholderCSPNonce = "${NONCE}"
tmplCSPDefault = "default-src 'self'; frame-src 'none'; object-src 'none'; style-src 'self' 'nonce-%s'; frame-ancestors 'none'; base-uri 'self'; require-trusted-types-for 'script'"
tmplCSPDevelopment = "default-src 'self' 'unsafe-eval'; frame-src 'none'; object-src 'none'; style-src 'self' 'nonce-%s'; frame-ancestors 'none'; base-uri 'self'"
)

View File

@ -75,13 +75,13 @@ func ServeTemplatedFile(publicDir, file, assetPath, duoSelfEnrollment, rememberM
switch {
case publicDir == assetsSwagger:
ctx.Response.Header.Add(fasthttp.HeaderContentSecurityPolicy, fmt.Sprintf("base-uri 'self'; default-src 'self'; img-src 'self' https://validator.swagger.io data:; object-src 'none'; script-src 'self' 'unsafe-inline' 'nonce-%s'; style-src 'self' 'nonce-%s'", nonce, nonce))
ctx.Response.Header.Add(fasthttp.HeaderContentSecurityPolicy, fmt.Sprintf(tmplCSPSwagger, nonce, nonce))
case ctx.Configuration.Server.Headers.CSPTemplate != "":
ctx.Response.Header.Add(fasthttp.HeaderContentSecurityPolicy, strings.ReplaceAll(ctx.Configuration.Server.Headers.CSPTemplate, cspNoncePlaceholder, nonce))
ctx.Response.Header.Add(fasthttp.HeaderContentSecurityPolicy, strings.ReplaceAll(ctx.Configuration.Server.Headers.CSPTemplate, placeholderCSPNonce, nonce))
case os.Getenv("ENVIRONMENT") == dev:
ctx.Response.Header.Add(fasthttp.HeaderContentSecurityPolicy, fmt.Sprintf(cspDefaultTemplate, " 'unsafe-eval'", nonce))
ctx.Response.Header.Add(fasthttp.HeaderContentSecurityPolicy, fmt.Sprintf(tmplCSPDevelopment, nonce))
default:
ctx.Response.Header.Add(fasthttp.HeaderContentSecurityPolicy, fmt.Sprintf(cspDefaultTemplate, "", nonce))
ctx.Response.Header.Add(fasthttp.HeaderContentSecurityPolicy, fmt.Sprintf(tmplCSPDefault, nonce))
}
err := tmpl.Execute(ctx.Response.BodyWriter(), struct{ Base, BaseURL, CSPNonce, DuoSelfEnrollment, LogoOverride, RememberMe, ResetPassword, ResetPasswordCustomURL, Session, Theme string }{Base: base, BaseURL: baseURL, CSPNonce: nonce, DuoSelfEnrollment: duoSelfEnrollment, LogoOverride: logoOverride, RememberMe: rememberMe, ResetPassword: resetPassword, ResetPasswordCustomURL: resetPasswordCustomURL, Session: session, Theme: theme})