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

Add option to run as a certain user on the Run Monkey page #838

Merged
merged 2 commits into from
Jan 11, 2021

Conversation

shreyamalviya
Copy link
Contributor

@shreyamalviya shreyamalviya commented Sep 14, 2020

Fixes #830
run-as-user-demo

UPDATE:
Added checkbox for "Run as user"
run-as-user-checkbox

@codecov
Copy link

codecov bot commented Sep 14, 2020

Codecov Report

Merging #838 (55dae3f) into develop (62541d2) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop     #838   +/-   ##
========================================
  Coverage    60.58%   60.58%           
========================================
  Files          166      166           
  Lines         4955     4955           
========================================
  Hits          3002     3002           
  Misses        1953     1953           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 62541d2...55dae3f. Read the comment docs.

@VakarisZ
Copy link
Contributor

VakarisZ commented Oct 5, 2020

Nice! It should be easy to backmerge to my latest changes, but if you run into any trouble, let me know. Also, why do we need the checkmark if it works fine with empty field? I don't think we need it, just inform that running as specific user is optional, but let's talk with @itaymmguardicore

@shreyamalviya
Copy link
Contributor Author

@VakarisZ, backmerged. Love the refactoring you did! :)

@itaymmguardicore, what do you think about the checkbox?
This is how it is right now (it works in the same way as in the GIFs in the description):
image

Copy link
Contributor

@VakarisZ VakarisZ left a comment

Choose a reason for hiding this comment

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

There are some issues which must be resolved. Powershell doesn't work with runas and on linux it's better to use su than runuser

@shreyamalviya shreyamalviya force-pushed the add-run-as-user-option branch 2 times, most recently from 5cd022d to 0f45837 Compare December 22, 2020 16:35
Comment on lines 10 to 11
if (username != '')
command = `su - ${username} -c "${command}"`;
Copy link
Contributor

Choose a reason for hiding this comment

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

Use curly-braces for ifs. Easier to extend and read, even if it's a single sentence.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, this is a code duplication with other linux run method.

Copy link
Contributor

@VakarisZ VakarisZ left a comment

Choose a reason for hiding this comment

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

Approved. Optional things to improve is: 1. reduce duplication between commands. 2. add curly braces around single sentence ifs

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.

Add "runas" option to Monkey run page for ZT People (UEBA) test
2 participants