nikku / wuffle

A multi-repository / multi-organization task board for GitHub issues.
https://wuffle.dev
MIT License
118 stars 23 forks source link

It's not possible to configure the BASE_URL for a domain starting with board #154

Open rafaelchavesfreitas opened 1 year ago

rafaelchavesfreitas commented 1 year ago

Describe the Bug

It's not possible to configure the BASE_URL for a domain starting with board, becouse https://board.myproject.com contains /board and the function checkBaseUrl of file run.js do this:

 function checkBaseUrl() {

    const baseUrl = process.env.BASE_URL;

    if (baseUrl) {
      if (baseUrl.includes('/board')) {
        return error('env.BASE_URL must point to the root of the webapp');
      }

I think that you can change the code to first check if the baseUrl format is not valid, then check why, somethink like this:

 function checkBaseUrl() {

    const baseUrl = process.env.BASE_URL;

    if (baseUrl && !baseUrl.match(/^https?:\/\/(\.?\w+)+$/)) {
      if (baseUrl.includes('/board')) {
        return error('env.BASE_URL must point to the root of the webapp');
      }

Steps to Reproduce

try to configure the BASE_URL for a domain starting with board

Environment

nikku commented 1 year ago

Good catch. I think the check can be further simplified. It should basically prevent users from setting {TASK_BOARD}/board as the BASE_URL over {TASK_BOARD}.