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

Bug Report: Empty/truncated file considered valid when enforceTableACLConfig is set #17273

Open
garfthoffman opened this issue Nov 22, 2024 · 1 comment · May be fixed by #17274
Open

Bug Report: Empty/truncated file considered valid when enforceTableACLConfig is set #17273

garfthoffman opened this issue Nov 22, 2024 · 1 comment · May be fixed by #17274

Comments

@garfthoffman
Copy link

Overview of the Issue

When running vttablet with the flag --enforce-tableacl-config provided, it is possible to provide an empty or truncated file for the value of --table-acl-config which will successfully load an empty ACL config.

Reproduction Steps

Create an empty file, say ./empty-acl.json and run vttablet with the --table-acl-config ./empty-acl.json and --enforce-tableacl-config parameters.

Binary Version

vttablet `v18`

Operating System and Environment details

Ubuntu 20.04
Linux 5.15.0-125-generic
x86_64

Log Fragments

N/A
@garfthoffman garfthoffman added Needs Triage This issue needs to be correctly labelled and triaged Type: Bug labels Nov 22, 2024
@rohit-nayak-ps rohit-nayak-ps added Component: ACL and removed Needs Triage This issue needs to be correctly labelled and triaged labels Nov 24, 2024
@arthurschreiber
Copy link
Contributor

To give a bit more context: We have a tool that re-generates the ACL files used by vttablet when we start / restart vttablet processes.

This tool was not performing it's operations in an atomic fashion: the ACL file was opened and truncated, the ACL configuration was written, the file was closed (but critically, not fsynced), and then vttablet was started.

We've ran into one case where due to the missing fsync call, vttablet would start up and read the truncated tablet ACL file. In combination with the --queryserver-config-strict-table-acl flag, this lead to all query execution requests on this particular vttablet instance to fail.

Obviously, our tool was wrong (and has been fixed to perform these writes in a fully atomic fashion), but we were also surprised to learn that --enforce-tableacl-config prevents starting vttablet if the given ACL file does not exist, but does not prevent vttablet from starting if the given ACL file is 0 bytes long. This is because it's first attempted to be deserialized as protobuf, where a 0 byte input is treated as a noop.

@deepthi How do you feel about this change? 🙇‍♂️ Obviously, we can't prevent all misconfiguration cases, but this one might be something we want to prevent? 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants