Skip to content

Conversation

@jaekwon
Copy link
Contributor

@jaekwon jaekwon commented Nov 17, 2025

This PR will finalize the gno interrealm spec.
The primary goal is to address the Oak security audit issue found.
Also will unify terminology, and double-check consistency of interrealm spec.

Making a PR to allow commenting on the initial commit of mental model.

@Gno2D2
Copy link
Collaborator

Gno2D2 commented Nov 17, 2025

🛠 PR Checks Summary

All Automated Checks passed. ✅

Manual Checks (for Reviewers):
  • IGNORE the bot requirements for this PR (force green CI check)
Read More

🤖 This bot helps streamline PR reviews by verifying automated checks and providing guidance for contributors and reviewers.

✅ Automated Checks (for Contributors):

No automated checks match this pull request.

☑️ Contributor Actions:
  1. Fix any issues flagged by automated checks.
  2. Follow the Contributor Checklist to ensure your PR is ready for review.
    • Add new tests, or document why they are unnecessary.
    • Provide clear examples/screenshots, if necessary.
    • Update documentation, if required.
    • Ensure no breaking changes, or include BREAKING CHANGE notes.
    • Link related issues/PRs, where applicable.
☑️ Reviewer Actions:
  1. Complete manual checks for the PR, including the guidelines and additional checks if applicable.
📚 Resources:
Debug
Manual Checks
**IGNORE** the bot requirements for this PR (force green CI check)

If

🟢 Condition met
└── 🟢 On every pull request

Can be checked by

  • Any user with comment edit permission

Comment on lines +2148 to +2150
bob.Do(obj.Method) // FAIL: not yet unattached
alice.SetClosure(cls) // obj recursively attached to alice late
bob.Do(obj.Method) // SUCCESS: attached to bob
Copy link
Member

Choose a reason for hiding this comment

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

contradictory?

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
bob.Do(obj.Method) // FAIL: not yet unattached
alice.SetClosure(cls) // obj recursively attached to alice late
bob.Do(obj.Method) // SUCCESS: attached to bob
bob.Do(obj.Method) // FAIL: not yet attached
alice.SetClosure(cls) // obj recursively attached to alice late
bob.Do(obj.Method) // FAIL: attached to alice (but need bob)

?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you're right, i'll update with a better example. bob.SetClosure().

Comment on lines +2238 to +2240
bob.Do(obj.Method) // FAIL: not yet unattached
alice.SetClosure(cls) // obj recursively attached via cls to alice late
bob.Do(obj.Method) // SUCCESS: attached to bob
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
bob.Do(obj.Method) // FAIL: not yet unattached
alice.SetClosure(cls) // obj recursively attached via cls to alice late
bob.Do(obj.Method) // SUCCESS: attached to bob
bob.Do(obj.Method) // FAIL: not yet attached
alice.SetClosure(cls) // obj recursively attached via cls to alice late
bob.Do(obj.Method) // FAIL: attached to alice (but need bob)

Comment on lines +2108 to +2114
// --------------------------------------------------------------------------------
// CASE rC1: method has attached receiver -- storage-cross to receiver
// - in bob.Do: (storage:[], current:caller, previous:nil)
// - in obj.Method: (storage:[bob], current:caller, previous:nil)
obj := new(alice.Object)
bob.SetObject(obj) // obj attached to bob
bob.Do(obj.Method) // SUCCESS: attached to bob
Copy link
Contributor

@ltzmaxwell ltzmaxwell Nov 18, 2025

Choose a reason for hiding this comment

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

if in package alice, Method is declared as:

func (obj *Object) Method() { // CASE rB2~4, CASE rC1~5
        // mutate unintended exported global var by assignment 
        bob.Private2 = -1
        // mutate intended global var
		bob.PrivateFunc()
}

it can be inferred that a realm should never declare an exported global var, if there are any method/closure attached/injected, to avoid unintended mutation, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

interesting point.

bob has to be careful what he exposes; if he exposes something like this, needs to be careful about what he attaches, unless it is meant to be modified this way.

it is intentional, if we think of .Exposed variables as basically having implied GetExposed() and SetExposed() functions.

Copy link
Contributor

Choose a reason for hiding this comment

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

This seems to increase the developer’s mental burden — they have to be aware of whether their realm will attach functions, and whether there are any global variables that should not be exposed.

How about requiring that all global variables of realm be mutated only through functions?

@codecov
Copy link

codecov bot commented Nov 18, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@github-actions github-actions bot added the 📦 ⛰️ gno.land Issues or PRs gno.land package related label Nov 19, 2025
@@ -0,0 +1,273 @@
adduserfrom runner 'apart roast chief monitor bundle auto fade double valid budget able average onion slam rice flame despair wage uphold nominee proud alien spider useful'
Copy link
Contributor

@ltzmaxwell ltzmaxwell Nov 19, 2025

Choose a reason for hiding this comment

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

convert the spec into txtar. the pXXXs are not included here as p cannot import r.

Comment on lines +252 to +263
// XXX, this is the inital GHSA issue.
func RD1(cur realm) {
// CASE rD1: closure attached to bob
// - in bob.ExecuteClosure: (storage:[], current:bob, previous:caller)
f := func() {
bob.AllowedList = append(bob.AllowedList, 3)
println("all right")
}

bob.SetClosure(cross, f)
bob.ExecuteClosure(cross)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

the initial "issue". the "issue" is same as previous comment: "bob has to be careful what he exposes; if he exposes something like this, needs to be careful about what he attaches, unless it is meant to be modified this way."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

📦 ⛰️ gno.land Issues or PRs gno.land package related 📦 🤖 gnovm Issues or PRs gnovm related

Projects

Status: No status
Status: Triage

Development

Successfully merging this pull request may close these issues.

5 participants