--idp-gsep can't be just space
- Ngôn ngữ chính
- Python
- Star
- 46.6k
- Fork
- 1.9k
- Merge trung bình
- 10 ngày 16 giờ
- Pull request đã merge (30 ngày)
- 5
Mô tả
### Describe the bug
if I use `--idp-gsep " "` I get a python error:
```
File "/nix/store/nniir0jrvgw1xv71gl3lsq3xbsfb79wz-copyparty-1.19.20/lib/python3.12/site-packages/copyparty/svchub.py", line 1156, in _process_config
setattr(self.args, k, re.compile("[%s]" % (ptn,)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
File "/nix/store/vxl8pzgkkw8vdb4agzwm58imrfclmfrx-python3-3.12.11/lib/python3.12/re/_parser.py", line 568, in _parse
raise source.error("unterminated character set",
re.error: unterminated character set at position 0
```
I think the gsep string is stripped, becomes "", and then that results in the regex compile error above.
### To Reproduce
I'm using caddy + caddy-security, which allows directives to add roles:
```caddyfile
transform user {
exact match origin google
exact match email me@gmail.com
action add role authp/user
action add role authp/copyparty-user
}
```
These roles are passed to copyfile in a header like:
`x-token-user-roles: authp/user authp/copyparty-user`
The default `--idp-gsep` will parse these as one group, since the space is not a default separator
### Expected behavior
I should be able to specify `--idp-gsep " "` and have space be the only separator in the list of idp groups
### Server details (if you're NOT using docker/podman)
remove the ones that are not relevant:
* **server OS / version:** NixOS 25.05
* **what copyparty did you grab:** (sfx/exe/pip/arch/...) built-in version
* **how you're running it:** (in a terminal, as a systemd-service, ...) nix pkg
* run copyparty with `--version` and grab the last 3 lines (they start with `copyparty`, `CPython`, `sqlite`) and paste them below this line:
```
copyparty v1.19.20 "usernames" (2025-11-02)
CPython v3.12.11 on Linux64 6.8.12 [GCC 14.3.0]
sqlite 3.48.0*1 | jinja 3.1.6 | pyftpd 2.0.1 | tftp (None)
```
* **copyparty arguments and/or config-file:**
```nix
services.copyparty = {
enable = true;
settings = {
#######################################
# misc
unlist = [
"^@eaDir"
".stfolder"
];
name = "";
#######################################
# network
# listening interface. note: exposing the copyparty service through any
# other interface, including LAN or Tailscale, opens up the possibility
# for things like spoofing the X-Forwarded-For header.
i = "127.0.0.1";
#######################################
# idp/user
auth-ord = "idp"; # no other access method
no-bauth = true; # disable basic authentication
idp-h-usr = "x-token-user-email";
idp-h-grp = "x-token-user-roles";
idp-gsep = " ";
idp-logout = "";
#######################################
# proxy
rproxy = 1;
xff-src = "127.0.0.1/32"; # only allow localhost reverse proxy
# trust the x-forwarded-for header from caddy:
xff-hdr = "X-Forwarded-For";
#######################################
# troubleshooting
# convenient debug option:
# log all incoming request headers from the proxy
ihead = "*";
#######################################
# ui
ui-nosrvi = true; # hide server-info in the UI
# ui-noacci = true; # hide account-info in the UI
# ui-nocpla = true; # hide cpanel-link in the UI
# ui-nolbar = true; # hide link-bar in the UI
# ui-nombar = true; # hide top-menu in the UI
# ui-nonav = true; # hide navpane+breadcrumbs in the UI
# ui-notree = true; # hide navpane in the UI
# ui-norepl = true; # hide repl-button in the UI
# ui-noctxb = true; # hide context-buttons in the UI
#######################################
# files
e2dsa = true; # enables general file indexing
e2ts = true; # enables audio metadata indexing
hist = "";
};
};
```
### Workaround
I can work around the problem by defeating the strip with : `--idp ", ,"` which will use commas or spaces as the separator. 🤷🏽♀️
Hướng dẫn đóng góp
Đánh giá
Issue này chưa được đánh giá.