|
2026-10-20
| ||
| 21:24 | • Ticket [a63f5a4fed] Safe interp gets the parent's -errorinfo and -errorstack... artifact: de17c90707 user: jan.nijtmans | |
| 21:22 | • Closed ticket [a63f5a4fed]. artifact: 0317a9f699 user: serhiy.storchaka | |
| 21:21 | Fix [a63f5a4fed]: Safe interp gets the parent's -errorinfo and -errorstack through a failing alias check-in: cc7f58c2fd user: serhiy.storchaka tags: core-8-6-branch | |
| 21:21 | Fix [a63f5a4fed]: Safe interp gets the parent's -errorinfo and -errorstack through a failing alias check-in: 19a0f244cb user: serhiy.storchaka tags: core-9-0-branch | |
| 21:17 | Fix [a63f5a4fed]: Safe interp gets the parent's -errorinfo and -errorstack through a failing alias check-in: 24b65a6fb6 user: serhiy.storchaka tags: trunk, main | |
| 21:12 | • Ticket [a63f5a4fed] Safe interp gets the parent's -errorinfo and -errorstack... artifact: 1f2341b7f9 user: jan.nijtmans | |
| 21:11 | • Ticket [a63f5a4fed]: 6 changes artifact: 60b4c1556c user: jan.nijtmans | |
| 18:11 | • Ticket [a63f5a4fed]: 1 change artifact: 6cbb22bb5c user: serhiy.storchaka | |
|
2026-10-17
| ||
| 11:50 | • Ticket [a63f5a4fed]: 3 changes artifact: 8157db24a5 user: serhiy.storchaka | |
| 11:50 | Fix [a63f5a4fed]: a safe interp got the full -errorinfo and -errorstack of a trusted interp through ... closed check-in: 240c36ff66 user: serhiy.storchaka tags: safe-interp-no-parent-traceback | |
| 10:53 | • Ticket [219164ffff] various aspects of error handling fail with interp aliases</... artifact: 313a2420dd user: serhiy.storchaka | |
| 10:51 | • New ticket [a63f5a4fed] Safe interp gets the parent's -errorinfo and -errors... artifact: 0dc48976a1 user: serhiy.storchaka | |
Safe interp gets the parent's -errorinfo and -errorstack through a failing alias
proc GetPassword {user} {return hunter2}
proc VerifyPassword {user pw} {error "access denied"}
proc LoginAlias {user} {VerifyPassword $user [GetPassword $user]}
set s [interp create -safe]
interp alias $s login {} LoginAlias
puts [interp eval $s {
catch {login alice} msg opts
list $::errorInfo [dict get $opts -errorstack]
}]
Actual output (9.1, 9.0, 8.6):
{access denied
while executing
"error "access denied""
(procedure "VerifyPassword" line 1)
invoked from within
"VerifyPassword $user [GetPassword $user]"
(procedure "LoginAlias" line 1)
invoked from within
"login alice"} {INNER {returnImm {access denied} {}} CALL {VerifyPassword alice hunter2} CALL {LoginAlias alice}}
Expected: the safe interpreter sees only the error message and its own part of the traceback, as if login were a C command failing with that message:
{access denied
invoked from within
"login alice"} {}
If the alias target does [source] a file and the script fails, the traceback
also contains (file "/full/path/of/the/parent/script.tcl" line N).
Cause: AliasObjCmd in generic/tclInterp.c calls Tcl_TransferResult, which copies the whole return options dictionary (Tcl_GetReturnOptions) of the parent into the child, whether the child is safe or not. The Safe Base avoids this only because its alias procs rethrow with [return -code error $msg]; user-defined aliases get no such protection. A possible fix is to drop -errorinfo and -errorstack (keeping the message, -errorcode and the return code) when the target interpreter is safe and the source is not.
This is the knownBug test interp-26.8, one of the tests collected in [219164ffff] (bug 1637, 1999). The errorInfo part has been there at least since 8.4; -errorstack (8.6) made it worse, since it carries argument values. Related: [77f0dbc0f8] (a stale -errorstack from an earlier, already caught error in the parent is also passed through an alias, because Tcl_GetReturnOptions ignores resetErrorStack), [1669424fff] (file names leak into safe interps via [info frame]).
cc7f58c2fdFix [a63f5a4fed]: Safe interp gets the parent's -errorinfo and -errorstack through a failing alias check-in2026-10-20 21:21:4119a0f244cbFix [a63f5a4fed]: Safe interp gets the parent's -errorinfo and -errorstack through a failing alias check-in2026-10-20 21:21:4024b65a6fb6Fix [a63f5a4fed]: Safe interp gets the parent's -errorinfo and -errorstack through a failing alias check-in2026-10-20 21:17:30240c36ff66Fix [a63f5a4fed]: a safe interp got the full -errorinfo and -errorstack of a trusted interp through a failing alias, revealing proc names, bodies, file names and argument values. Tcl_TransferResult no longer transfers -errorinfo, -errorstack and -errorline from a trusted interp to a safe one. Enable knownBug test interp-26.8. check-in2026-10-17 11:50:04313a2420ddTicket [219164ffff] various aspects of error handling fail with interp aliases status still Open with 3 other changes ticket2026-10-17 10:53:34
Proposed fix in branch safe-interp-no-parent-traceback: Tcl_TransferResult() no longer transfers -errorinfo, -errorstack and -errorline from a trusted interp to a safe one; the message, -errorcode and the return code still pass. The safe interp starts its own traceback at the alias call. knownBug test interp-26.8 now passes, new test interp-26.10; four safe.test tests that expected part of the parent's traceback are updated.
This also fixes the safe interp part of [77f0dbc0f8]. It is a behaviour change of a public function, so it is proposed for 9.1 only.
> It is a behaviour change of a public function, so it is proposed for 9.1 only.
Since it's a potential security risk, I'm inclined to accept it for 9.0.
Just go ahead!
> It is a behaviour change of a public function, so it is proposed for 9.1 only.
Since it's a potential security risk, I'm inclined to accept it for 9.0 and 8.6 too.
Just go ahead!
Merged to [trunk], [core-9-0-branch] and [core-8-6-branch]. On 9.0 and 8.6 the expected results of interp-26.10 (invokeStk1) and, on 8.6, safe-11.7.1 (no parent frame any more) were adjusted.
Please don't forget the changes.md/changes entries