mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-11-18 01:54:23 +01:00
fix: retain actual anonymous request paths across outcomes
This commit is contained in:
1 parent
b54cf72bf8
commit
953767b2cd
8 files changed
+57
-22
No files matched your search
@@ -341,7 +341,7 @@ a finite error type/code, and up to eight recognized application frames (1 KiB m
|
||||
exception and the deepest inspected cause (at most three levels, cycles stopped). Raw messages,
|
||||
Upstream URLs, query strings, external frames and absolute filesystem roots are
|
||||
not stored. Repository/file parameters are excluded except for the explicitly
|
||||
scoped failed-request reproduction context below. Unknown error types use `UnknownError`; unknown
|
||||
scoped anonymous-request reproduction context below. Unknown error types use `UnknownError`; unknown
|
||||
function names become `<anonymous>`. Source locations are build-relative for
|
||||
compiled code and source-relative in development; line numbers refer to that
|
||||
release, not an inferred source map.
|
||||
@@ -355,7 +355,7 @@ unknown fields. Existing discarded exception details cannot be recovered.
|
||||
|
||||
### Admin reproduction context
|
||||
|
||||
Failed application file requests now retain their public anonymous repository ID and encoded request pathname, up to 2 KiB, under the existing admin log access controls. This is an explicit exception to template-only diagnostics: repository-relative filenames are retained for reproduction. Query strings, headers, bodies and upstream owner/repository URLs are still excluded. Filenames are operator-visible data under this policy; no generic filter can guarantee that a user has not put sensitive text in a filename. Successful requests and metrics keep only the normalized route. Only `/api/repo/:repoId/file/:path` is supported; other endpoints and unsafe, oversized, malformed or traversal paths omit reproduction context. Historical records cannot be backfilled. The UI copies the exact captured pathname without a host or query.
|
||||
Application requests to the supported anonymous repository endpoints retain their public anonymous repository ID and encoded request pathname, up to 2 KiB, under the existing admin log access controls. This is an explicit exception to template-only diagnostics: repository-relative filenames are retained for reproduction. Query strings, headers, bodies and upstream owner/repository URLs are still excluded. Filenames are operator-visible data under this policy; no generic filter can guarantee that a user has not put sensitive text in a filename. Capture includes successful, failed and interrupted requests; metrics still use only normalized routes. Supported paths are repository metadata, file contents, listings/counts/search, ZIP, options, refresh, coauthors and extend under `/api/repo/:repoId`; other endpoints and unsafe, oversized, malformed or traversal paths omit reproduction context. Historical records cannot be backfilled. The UI copies the exact captured pathname without a host or query.
|
||||
For the focused restricted-file/rotation regression, run
|
||||
`LOGGING_ACCESS_ONLY=1 python3 scripts/test-logging.py`. This uses synthetic
|
||||
`0640` logs in an isolated Docker project and preserves capability restrictions.
|
||||
@@ -59,12 +59,12 @@ for_each(["status", "httpStatus", "ms", "firstByteMs", "responseMs", "bytes", "b
|
||||
if includes(["GET", "HEAD", "POST", "PUT", "PATCH", "DELETE", "OPTIONS", "OTHER"], record.method) { out.method = record.method }
|
||||
if includes(["/", "other", "/dashboard", "/anonymize", "/healthcheck", "/api/healthcheck", "/api", "/api/download", "/api/stat", "/api/stat/history", "/api/options", "/api/message", "/api/user", "/api/user/quota", "/api/user/dashboard", "/api/repo", "/api/anonymize-preview", "/api/admin/overview", "/api/admin/performance", "/api/admin/errors", "/api/admin/errors/stats", "/api/admin/queues", "/api/admin/queues/metrics", "/github/app/webhook", "/api/repo/:repoId", "/api/repo/:repoId/file/:path", "/api/repo/:repoId/files", "/api/repo/:repoId/files/counts", "/api/repo/:repoId/files/search", "/api/repo/:repoId/zip", "/api/repo/:repoId/options", "/api/repo/:repoId/refresh", "/api/repo/:repoId/coauthors", "/api/repo/:repoId/extend", "/api/repo/:owner/:repo/readme", "/api/repo/:owner/:repo/branches", "/w/:repoId/:path", "/r/:repoId/:path", "/api/pr/:id/:path", "/api/gist/:id/:path", "/assets/:path", "/github/:action", "/api/admin/:action", "/api/user/:action", "/api/repo/:id/file/:path", "/api/repo/:id/files/counts", "/api/repo/:id/files/search", "/api/repo/:id/files", "/api/repo/:id/zip", "/api/repo/:id", "/viewer/:id/:path"], record.route) { out.route = record.route }
|
||||
# VictoriaLogs consumes its message field; keep event independently searchable.
|
||||
# Explicit reproduction context for failed application file requests, never query strings.
|
||||
if includes(["error", "fatal"], out.severity) || to_int(out.status) >= 400 || to_int(out.httpStatus) >= 400 {
|
||||
# Anonymous application request context at every outcome, never query strings.
|
||||
{
|
||||
path = to_string(record.requestPath) ?? ""
|
||||
parsed, path_error = parse_regex(path, r'^/api/repo/(?P<repo>[A-Za-z0-9_-]{3,200})/file/(?P<file>[A-Za-z0-9._~!$&\'()+,;=@%/-]+)$')
|
||||
parsed, path_error = parse_regex(path, r'^/api/repo/(?P<repo>[A-Za-z0-9_-]{3,200})(?:/(?P<file>file/[A-Za-z0-9._~!$&\'()+,;=@%/-]+|files(?:/[A-Za-z0-9._~!$&\'()+,;=@%/-]*)?|(?:zip|options|refresh|coauthors|extend)/?))?/?$')
|
||||
decoded = decode_percent(to_string(parsed.file))
|
||||
if path_error == null && length(path) <= 2048 && !match(path, r'%(?:[^a-fA-F0-9]|[a-fA-F0-9][^a-fA-F0-9]|[a-fA-F0-9]?$)') && !match(decoded, r'[\x00-\x1f\x7f-\x9f\x{2028}-\x{202e}\x{2066}-\x{2069}\x{fffd}\\:?#%]|^/|(^|/)\.\.?(/|$)') {
|
||||
if path_error == null && length(path) <= 2048 && !match(path, r'%(?:[^a-fA-F0-9]|[a-fA-F0-9][^a-fA-F0-9]|[a-fA-F0-9]?$)') && !match(decoded, r'[\x00-\x1f\x7f-\x9f\x{2028}-\x{202e}\x{2066}-\x{2069}\x{fffd}\\:?#%]|//|(^|/)\.\.?(/|$)') {
|
||||
out.requestPath = path
|
||||
out.repoId = parsed.repo
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user