security::debug_return_url_signature (private)
security::debug_return_url_signature stage [ url ] [ signature ]
Defined in packages/acs-tcl/tcl/security-procs.tcl
Temporary, opt-in diagnostics for file-storage return_url signatures. Enable from nscp for fifteen minutes (optionally limit normal-path observations to one peer):
nsv_set security_return_url_signature_debug settings [list until [expr {[clock seconds] + 900}] peer 91.114.61.250]Disable with nsv_unset security_return_url_signature_debug settings. Malformed-signature observations ignore the peer filter. The target defaults to /storage/download-zip; settings may specify another path. Fields ending in _urlencoded must be decoded exactly once to recover the observed text, including the distinction between + and %2B. Fields are length-bounded with explicit truncation flags. Signing secrets, cookies and authorization headers are never collected. Diagnostics must not change request or signature-validation behavior.
- Parameters:
- stage (required)
- url (optional)
- signature (optional)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: # Best effort: an incomplete request context or diagnostic configuration # must never interfere with generation, verification, or redirects. catch { if {![nsv_get security_return_url_signature_debug settings settings] || ![dict exists $settings until] || ![string is integer -strict [dict get $settings until]] || [dict get $settings until] <= [clock seconds] || ![ns_conn isconnected]} { return } set path /storage/download-zip if {[dict exists $settings path]} { set path [dict get $settings path] } if {$path eq ""} { return } set source [ns_conn url] set malformed_p [expr {$stage eq "malformed"}] if {$source ne $path && [string first $path $url] < 0 && !(($stage eq "export-url" || $stage eq "export-form") && [string first "[file dirname $path]/" $source] == 0)} { return } set peer [ns_conn peeraddr] if {!$malformed_p && [dict exists $settings peer] && [dict get $settings peer] ne "" && [dict get $settings peer] ne $peer} { return } set headers [ns_conn headers] set record [list SIGNATURE-PROBE stage $stage driver [ns_conn driver] peer $peer] foreach {field text limit} [list request [ns_conn request] 4096 url $url 4096 signature $signature 256 referrer [ns_set iget $headers referer] 1024 user_agent [ns_set iget $headers user-agent] 512] { set truncated [expr {[string length $text] > $limit}] if {$truncated} { set text [string range $text 0 $limit-1] } lappend record ${field}_urlencoded [ns_urlencode -- $text] ${field}_truncated $truncated } ns_log notice $record } returnGeneric XQL file: packages/acs-tcl/tcl/security-procs.xql
PostgreSQL XQL file: packages/acs-tcl/tcl/security-procs-postgresql.xql
Oracle XQL file: packages/acs-tcl/tcl/security-procs-oracle.xql