-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create the SSCSM scripting #15818
base: master
Are you sure you want to change the base?
Create the SSCSM scripting #15818
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the amount of effort you're putting into bringing SSCSM is admirable! I really appreciate you working on this :3
it would be nice to have a demo/test SSCSM usage in the codebase too, i.e. clientmods/preview(_sscsm?)
& games/devtest/mods/sscsm(?)
Co-authored-by: Jude Melton-Houghton <[email protected]>
tostring({}) and string.format("%s", {}) give you pointers. (see lj_strfmt_obj) this is not very critical, but attacks could be made harder if we change this. the effort of overwriting is not worth it I think right now
20 us was the value, firefox used as first response to the spectre attacks. now it's 100 us or 5 us, depending on whether it's "cross-origin isolated". we only have one origin, so choosing 20 us is probably fine, I guess see also: https://www.mozilla.org/en-US/security/advisories/mfsa2018-01/ https://developer.mozilla.org/en-US/docs/Web/API/Performance/now#security_requirements other clocks: * os.time() and os.date() only have seconds precision, AFAIK. * dtime is only given once per step, so it's not useful * there might be other ways to build clocks (if we get async envs for sscsm, with a busy loop, for example)
rationale: * it's just boilerplate, as these just fill out the structs. can also be done at call site * they are usually only called at one place * it would lead to many includes (or at least forward defs) in sscsm_controller.h and sscsm_environment.h
d7bb5f9
to
51bd206
Compare
Loading mods comes in a later PR. |
b8d4d9a
to
7e6c796
Compare
All that's left here is (I think) to find out if we can/want to allow Also, potential reviewers, do you want a separate #15568? |
Note: For SSCSM debugging it should be possible to turn off this sandbox in some capacity eventually, but that can come later. I don't have hard feelings either way for whether this should be separate or not. |
Thank you, that helps deciding! <3
Yes, it uses
The issue is basically that I guess I will better disallow it. (It's also not that useful for modding anyways.) |
For local _date = os.date
function os.date(fmt, ...)
if not fmt then
return _date()
end
assert(type(fmt) == "string", "Format specifier must be a string")
for perc, spec in fmt:gmatch("(%%+)(.?)") do
if perc:len() % 2 ~= 0 then
assert(spec ~= "", "Conversion specifier extends beyond end of string")
assert(("AaBbcdFHIjMmpSUWwXxYyZ"):find(spec, 1, true), "Invalid conversion specifier")
end
end
return _date(fmt, ...)
end (Assuming we want to expose |
I'll go for not separate then. 🤷
Yes, we could. But I consider having PR should be good now. Self-review is done. |
looks like a good start. I think that at least in somewhere in proceeding added APIs there should be the ability to opt-in to use server SSCSMs. Testing on real servers is very important. And additionally security vulnerabilities (and other bugs) need to be discovered to be worked out, even if unsafe (hence why it'd be opt-in, preferably with a warning). and one other thing is the example in the markdown about "sscsm flow" is kind of... hard to understand? Maybe a better explanation is in order. either way I think that this PR is a great leap forward even if there's no real API yet. If we can create a proper API, it will absolutely change Luanti for the better and give the game what it's needed for years. I'm very excited to see that, and as a modder I've been waiting for it for a very long time. |
I do not want to discuss here whether or not users should already be able to activate SSCSM anywhere. It's not there yet anyways.
|
Based on #15568. But I decided to not update that, as it received no reviews. => Not waiting.
What this PR includes:
os.clock()
). (See alsodoc/sscsm_security.md
.)enable_sscsm
. This is not a bool, but an enum that says when (actually server-sent) sscsm is on. (Client builtin is always on.) The idea is that, for example, if it'slocalhost
, sscsm is on in singleplayer, and when joining a server on localhost, but not lan or other servers. (See alsodoc/sscsm_security.md
.)Possible follow-up PRs:
To do
This PR is Ready to be Reviewed.
How to test
enable_sscsm
tosingleplayer
. Start the game again. => It prints out nodes (not node names, but content ids).