Skip to content

Commit 915bdbb

Browse files
committed
fix: regex for CT log validation
We now also accept urls with a trailing slash. The URLs will be normalized anyway. fixes #62
1 parent a06e053 commit 915bdbb

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

config.sample.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ general:
2323
# When you want to add logs that are not contained in the log list provided by
2424
# Google (https://www.gstatic.com/ct/log_list/v3/log_list.json), you can add them here.
2525
additional_logs:
26-
- url: https://ct.googleapis.com/logs/us1/mirrors/digicert_nessie2022/
26+
- url: https://ct.googleapis.com/logs/us1/mirrors/digicert_nessie2022
2727
operator: "DigiCert"
2828
description: "DigiCert Nessie2022 log"
29-
- url: https://dodo.ct.comodo.com/
29+
- url: https://dodo.ct.comodo.com
3030
operator: "Comodo"
3131
description: "Comodo Dodo"
3232
# To optimize the performance of the server, you can overwrite the size of different buffers

internal/config/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ func parseConfigFromBytes(data []byte) (*Config, error) {
140140
func validateConfig(config *Config) bool {
141141
// Still matches invalid IP addresses but good enough for detecting completely wrong formats
142142
URLPathRegex := regexp.MustCompile(`^(/[a-zA-Z0-9\-._]+)+$`)
143-
URLRegex := regexp.MustCompile(`^https?://[a-zA-Z0-9\-._]+(:[0-9]+)?(/[a-zA-Z0-9\-._]+)*$`)
143+
URLRegex := regexp.MustCompile(`^https?://[a-zA-Z0-9\-._]+(:[0-9]+)?(/[a-zA-Z0-9\-._]+)*/?$`)
144144

145145
// Check webserver config
146146
if config.Webserver.ListenAddr == "" || net.ParseIP(config.Webserver.ListenAddr) == nil {

0 commit comments

Comments
 (0)