Docker secrets parsing regex issue
- Dominant language
- Go
- Stars
- 37.1k
- Forks
- 1.5k
- Avg merge
- 1h 11m
- Merged PRs (30d)
- 1
Description
### Description
Relevant details:
- Installation: Docker container (docker compose)
- Glance version: 0.8.4
Issue description:
I was trying to set up the [Media server history community widget](https://github.com/glanceapp/community-widgets/blob/main/widgets/media-server-history/README.md#options) using a `.env` file (no secrets). I made sure there were no references to Docker Secrets in the variables, but I kept seeing this error when running the container: `Config has errors: parsing variable: reading secret file: open /run/secrets/jellyfin-token: no such file or directory`.
I finally fixed this when I noticed that the comment on one of the lines contained the string `${secret:plex-token}`. Removing this string from the comment portion of the line resulted in the parsing working successfully. This points to an issue in the regex for parsing `${:}` where the parsing is checking the whole line (including comments on the line!) for these specific patterns, leading to this wild goose chase.
This should be changed such that the regex does not try to match anything beyond the `}` on the line, or something similar to ensure comments and other characters in the line don't get pulled into the regex parsing.
Reproduction steps:
Just copy and paste the sample config under the "Options" section provided in the community widget linked above, and it will fail to parse the config with this error.
For example, a line like this in any widget config will cause the same parsing error:
```
api-key: ${JELLYFIN_KEY} # Use secrets with `${secret:jellyfin-token}`
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the failure with the sample widget configuration and inspect the configuration parser responsible for `${...}` variables. Trace how comments are included in secret-pattern matching, then verify that the same line parses without attempting to open a secret file when the pattern appears only in a comment.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, go
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100