Skip to content

Add regex pattern for corsOrigin setting

Warren Gifford requested to merge cors-origin-pattern into master

Created by: felixfbecker

This would have caught https://github.com/sourcegraph/infrastructure/issues/1574.

The goal of this regex is to ensure the value is a space-delimited list of origins.

It enforces

  • providing at least one element
  • delimiting with exactly one space
  • including http:// or https://
  • not including any path segment or trailing /
  • or providing *

It does not enforce perfectly valid domain names.

It does not allow null origins or special origins like chrome-extension://....

If the pattern does not match, afaik all that happens is that a hint is shown in the config UI, so no backcompat concerns.

Merge request reports

Loading