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

Create secure custom PBA directory on Windows #1270

Merged
merged 5 commits into from
Jun 28, 2021

Conversation

shreyamalviya
Copy link
Contributor

What does this PR do?

Fixes #1196

PR Checklist

  • Have you added an explanation of what your changes do and why you'd like to include them?
  • Is the TravisCI build passing?
  • Was the CHANGELOG.md updated to reflect the changes?
  • Was the documentation framework updated to reflect the changes?

Testing Checklist

  • Added relevant unit tests?
  • Have you successfully tested your changes locally? Elaborate:

    Tested by running Monkey Island locally with no data directory so it creates everything by default. Uploaded custom PBA files on both Linux and Windows and made sure they ran.

  • If applicable, add screenshots or log transcripts of the feature working

@codecov
Copy link

codecov bot commented Jun 28, 2021

Codecov Report

Merging #1270 (37a7344) into develop (33a6e72) will decrease coverage by 0.01%.
The diff coverage is 26.92%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #1270      +/-   ##
===========================================
- Coverage    30.12%   30.11%   -0.02%     
===========================================
  Files          444      445       +1     
  Lines        13317    13341      +24     
===========================================
+ Hits          4012     4017       +5     
- Misses        9305     9324      +19     
Impacted Files Coverage Δ
monkey/tests/monkey_island/utils.py 17.39% <17.39%> (ø)
...key/monkey_island/cc/services/post_breach_files.py 100.00% <100.00%> (ø)

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 33a6e72...37a7344. Read the comment docs.

import win32api
import win32security

FULL_CONTROL = 2032127
Copy link
Collaborator

Choose a reason for hiding this comment

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

We also use this in test_file_utils.py. Can we put this constant somewhere common for tests? Maybe tests/monkey_island/utils.py.

st = os.stat(PostBreachFilesService.get_custom_pba_directory())

assert st.st_mode == 0o40700


def _get_acl_and_sid_from_path(path: str):
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is also duplicated from test_file_utils.py.

@mssalvatore mssalvatore merged commit d7991eb into develop Jun 28, 2021
@mssalvatore mssalvatore deleted the secure-custom-pba-dir branch June 28, 2021 17:48
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.

Create custom_pba directory with secure permissions on windows
2 participants