Restrict HTTP file artifact inputs

This commit is contained in:
2026-07-04 23:34:44 +00:00
parent 0d45ac6e3c
commit 5c882f26a9
14 changed files with 415 additions and 18 deletions

View File

@@ -40,7 +40,8 @@ type Config struct {
}
type ServerConfig struct {
Addr string `yaml:"addr"`
Addr string `yaml:"addr"`
ArtifactRoot string `yaml:"artifact_root"`
}
type DefaultsConfig struct {
@@ -53,6 +54,7 @@ type AppSettings struct {
ProfileDir string
SchemaDir string
ServerAddr string
ArtifactRoot string
DefaultRenderFormat renderformat.PreparedRunOutputFormat
}
@@ -62,6 +64,7 @@ type CLIOverrides struct {
ProfileDir string
SchemaDir string
ServerAddr string
ArtifactRoot string
RenderFormat string
}
@@ -142,6 +145,9 @@ func ApplyCLIOverrides(base AppSettings, overrides CLIOverrides) (AppSettings, e
if v := strings.TrimSpace(overrides.ServerAddr); v != "" {
out.ServerAddr = v
}
if v := strings.TrimSpace(overrides.ArtifactRoot); v != "" {
out.ArtifactRoot = filepath.Clean(v)
}
if rawFormat := strings.TrimSpace(overrides.RenderFormat); rawFormat != "" {
parsed, err := renderformat.ParsePreparedRunOutputFormat(rawFormat)
if err != nil {
@@ -181,6 +187,9 @@ func applyConfig(base AppSettings, cfg Config) (AppSettings, error) {
if v := strings.TrimSpace(cfg.Server.Addr); v != "" {
out.ServerAddr = v
}
if v := strings.TrimSpace(cfg.Server.ArtifactRoot); v != "" {
out.ArtifactRoot = filepath.Clean(v)
}
if rawFormat := strings.TrimSpace(cfg.Defaults.RenderFormat); rawFormat != "" {
parsed, err := renderformat.ParsePreparedRunOutputFormat(rawFormat)
if err != nil {