Skip to content

Revise SafeRefs checking to make it work for inlined defs#26154

Open
odersky wants to merge 1 commit into
scala:mainfrom
dotty-staging:fix-25387
Open

Revise SafeRefs checking to make it work for inlined defs#26154
odersky wants to merge 1 commit into
scala:mainfrom
dotty-staging:fix-25387

Conversation

@odersky
Copy link
Copy Markdown
Contributor

@odersky odersky commented May 24, 2026

We want to check the call of an inline def for safe references, not the expansion. To do this, we need to move safe reference checking earlier, where inlining has not yet happened or the original call of an Inline node is still available. This means moving it to PostTyper.

Fixes #25387

@odersky odersky force-pushed the fix-25387 branch 2 times, most recently from 71a155b to 1f072dd Compare May 24, 2026 13:28
We want to check the call of an inline def for safe references, not the expansion.
To do this, we need to move safe reference checking earlier, where inlining has not yet
happened or the original call of an Inline node is still available. This means moving it to
PostTyper.
/** Check whether references from safe mode should be allowed */
object SafeRefs {

val assumedSafePackages = List(
Copy link
Copy Markdown
Member

@bishabosha bishabosha May 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question unrelated to this PR: i guess package declarations haven't been a super important security hole to consider because TACIT runs in a repl, but i guess the current recommendation is that a harness should scan classfiles for execution to check that they arent declared in one of these packages

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This kind of sandboxing is not handled by our scheme. It's not so easy to set up since a classfile can be loaded indirectly from an asuumed-safe entry point.

@bishabosha bishabosha self-requested a review May 26, 2026 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

boundary/break not allowed by safe mode

2 participants