fix: do not echo setting values in configuration errors; test: stdio and config redaction
This commit is contained in:
1 parent
984673e8cf
commit
0f5f5cdd95
2 files changed
+87
-6
No files matched your search
@@ -336,10 +336,11 @@ class Settings(BaseSettings):
|
||||
"""Accept only granular Gitea scopes (unknown scopes make Gitea grant full access)."""
|
||||
unknown = sorted({scope for scope in value if scope not in GITEA_SCOPES})
|
||||
if unknown:
|
||||
# The offending values are not echoed: a misplaced secret must not reach stderr.
|
||||
raise ValueError(
|
||||
f"OAUTH_SCOPES contains unknown scope(s): {', '.join(unknown)}. "
|
||||
"Gitea grants full access for unknown scopes, so only granular "
|
||||
"read:/write: scopes are accepted"
|
||||
f"OAUTH_SCOPES contains {len(unknown)} unknown scope(s). Gitea grants full "
|
||||
"access for unknown scopes, so only granular read:/write: scopes are accepted "
|
||||
f"({', '.join(sorted(GITEA_SCOPES))})"
|
||||
)
|
||||
if not value:
|
||||
raise ValueError("OAUTH_SCOPES must not be empty")
|
||||
@@ -365,9 +366,7 @@ class Settings(BaseSettings):
|
||||
unknown = sorted({item for item in lowered if item != "all" and item not in TOOL_DOMAINS})
|
||||
if unknown:
|
||||
allowed = ", ".join(sorted(TOOL_DOMAINS | {"all"}))
|
||||
raise ValueError(
|
||||
f"TOOLSETS contains unknown domain(s): {', '.join(unknown)}; use {allowed}"
|
||||
)
|
||||
raise ValueError(f"TOOLSETS contains {len(unknown)} unknown domain(s); use {allowed}")
|
||||
if not lowered:
|
||||
raise ValueError("TOOLSETS must not be empty (use 'all')")
|
||||
return list(dict.fromkeys(lowered))
|
||||
|
||||
Reference in new issue
Block a user