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

Refactor runAsUser into tablehelper package #1653

Merged
merged 10 commits into from
Mar 25, 2024

Conversation

Micah-Kolide
Copy link
Contributor

@Micah-Kolide Micah-Kolide commented Mar 14, 2024

Cleaning up the runAsUser idiom I was using in a couple of places for the table generates.

@Micah-Kolide Micah-Kolide marked this pull request as ready for review March 14, 2024 18:36
Copy link
Contributor

@directionless directionless left a comment

Choose a reason for hiding this comment

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

Hrm... this might be okay, but it is a bit of a sharp edge.

tablehelpers.Exec enforces that it's called with a timeout, and ensures consistent logging. I'm not totally sure the signature is correct, but it does unify a lot of things.

In contrast, this takes a cmd and runs it. Which, in some ways, is a better idiom. But I'm not sure how we can enforce things like timeouts, and create consistent logging.

I'd be inclined to make a functional argument on tablehelpers.Exec that takes RunAs(uid)

The more arduous path would be to rethink how we handle exec. I can imagine passing cmd around, and maybe there are other patterns.

Curious where y'all land

@RebeccaMahany
Copy link
Contributor

I don't feel strongly about it either way. I think enforcing the timeout/logging is a plus, but I'm not terribly worried about not enforcing either since we do a good job including that in the first place and/or requesting it in code review.

Copy link
Contributor

@directionless directionless left a comment

Choose a reason for hiding this comment

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

Looks pretty good. As Becca said -- drop the WithUid into a _posix flavor.

Copy link
Contributor

@RebeccaMahany RebeccaMahany left a comment

Choose a reason for hiding this comment

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

🔥

@directionless directionless added this pull request to the merge queue Mar 25, 2024
Merged via the queue into main with commit 6d40d54 Mar 25, 2024
31 checks passed
@directionless directionless deleted the micah/refactor_run_as_user branch March 25, 2024 17:28
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.

3 participants