Skip to content
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

Tubetool: allow to copy settings even if tube is protected #9

Closed
7 tasks done
SwissalpS opened this issue May 17, 2020 · 8 comments · Fixed by #19
Closed
7 tasks done

Tubetool: allow to copy settings even if tube is protected #9

SwissalpS opened this issue May 17, 2020 · 8 comments · Fixed by #19
Labels
enhancement New feature or request Testing required Needs some testing before merging to main branch Tool Tool issues

Comments

@SwissalpS
Copy link

SwissalpS commented May 17, 2020

To be tested, after list completed PR can be merged:

  • Teleport tube write protection works, cant be written in protected area
  • Teleport tube read works everywhere, protections bypassed
  • Teleport tube info protection works, not allowed to get list from protected area
  • Sorting tube write protection works, cant be written in protected area
  • Sorting tube read works everywhere, protections bypassed
  • Vacuum tube copy/paste works correctly (newly added node for tubetool)
  • Vacuum tube write protection works correctly (newly added node for tubetool)

If above stuff works correctly then most probably protection works correctly with all other nodes, above list covers most special and common cases where protection is either customized somehow or not customized at all (other that default config and config has unit tests).

@S-S-X
Copy link
Owner

S-S-X commented May 18, 2020

Maybe tubes can get custom rules at some point after API, which does protection checks, is stable.

That is probably after #7 is completed.
Currently there is open PR #8 which has not been merged yet because it causes situation where internal (within this mod) and external (any other mod) registrations would go different paths but I do have few ideas already on how to approach that problem without rewriting #8 completely.

This is something that tool should configure during registration or there could be custom callback for protection checks but currently protection check is common for any tool registrations.

Why this was disallowed at first was direct metadata manipulation which would have allowed for example to set private channels owned by other players (without very complicated checks).

@SwissalpS
Copy link
Author

Thanks for the explanations.

@S-S-X S-S-X added API Metatool API issues enhancement New feature or request Tool Tool issues and removed API Metatool API issues labels May 21, 2020
@S-S-X
Copy link
Owner

S-S-X commented May 21, 2020

Implement protection bypass settings for API #11
Tools can then define how protections should behave.

Add protection bypass for tubetool to allow node reading after API is okayish.

@S-S-X S-S-X changed the title allow to copy settings even if tube is protected Tubetool: allow to copy settings even if tube is protected May 21, 2020
@S-S-X
Copy link
Owner

S-S-X commented May 23, 2020

After #15 is merged this can be done by simply adding protection_bypass_read = "interact" for mese_tube.lua here https://github.com/S-S-X/metatool/blob/master/tubetool/nodes/mese_tube.lua#L39

Protection should also now work for teleport tubes correctly and same thing should be possible for teleport_tube.lua but should be tested first.

S-S-X added a commit that referenced this issue May 25, 2020
* Allow per node protection bypass / protection override #11 #9

* Bypass protection check completely if bypass privs present

* Simplify overcomplicated privilege check

Co-authored-by: SX <sx@minetest>
@S-S-X
Copy link
Owner

S-S-X commented May 25, 2020

Dependency (#11/#15) is tested and merged, it is now possible to do this.

@S-S-X S-S-X added the Testing required Needs some testing before merging to main branch label May 25, 2020
@S-S-X
Copy link
Owner

S-S-X commented May 25, 2020

Implemented but not tested at all, needs some testing. PR also implements vacuum tube cloning #1 and tool to use teleport tube infotext so would be good to test those too.

@S-S-X
Copy link
Owner

S-S-X commented Jun 21, 2020

Teleport tube listing got implemented #33 and that caused one possible problem with protection bypass:

#19 (comment)

if this gets merged as is then anyone who can reach one protected private tp tube owned by some other player he can also get exact locations for all other tp tubes connected to that channel.

Not sure if this is acceptable or not, I think some players do not like to reveal their stuff that is marked as private.

To change this there should be separate protection bypass check before calling info event handler. Currently it uses same validation and priv checks that are used by copy / before_read methods.

Could simply just add before_read_info validation function and add similar default method with privilege bypass check / disallowed by default like before_read / copy / before_write / paste.

Above could be used to separate reading tube for cloning from reading tube for enumerating tubes in channel.

@S-S-X
Copy link
Owner

S-S-X commented Jun 27, 2020

Conflicts fixed for PR, also added various other nodes to protection bypass list for reading information. All added nodes already have this information as public.

Protection bypass problem mentioned earlier should be now fixed for things that implement third info function.

Additional nodes with bypass read protection check privilege set to interact:

  • lua controller
  • lua tube
  • microcontroller
  • vacuum tube
  • sorting tube
  • injectors

For the record it is now also possible to do this through configuration by setting following key/value pairs to metatool.cfg:

metatool:tubetool:nodes:mese_tube:protection_bypass_read = interact
metatool:tubetool:nodes:teleport_tube:protection_bypass_read = interact
metatool:tubetool:nodes:vacuum_tube:protection_bypass_read = interact
metatool:tubetool:nodes:filter:protection_bypass_read = interact
metatool:luatool:nodes:luatube:protection_bypass_read = interact
metatool:luatool:nodes:luacontroller:protection_bypass_read = interact
metatool:luatool:nodes:microcontroller:protection_bypass_read = interact

@S-S-X S-S-X closed this as completed in #19 Jul 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Testing required Needs some testing before merging to main branch Tool Tool issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants