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

Secure endpoints #3203

Merged
merged 15 commits into from
Apr 7, 2023
Merged

Secure endpoints #3203

merged 15 commits into from
Apr 7, 2023

Conversation

shreyamalviya
Copy link
Contributor

@shreyamalviya shreyamalviya commented Apr 6, 2023

What does this PR do?

Fixes a part of #3078

What's left:

  • Making sure BB tests work

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?
  • Have you checked that you haven't introduced any duplicate code?

Testing Checklist

  • Added relevant unit tests?
  • Do all unit tests pass?
  • Do all end-to-end tests pass?
  • Any other testing performed?

    Tested manually by running the Agent and Island

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

@codecov
Copy link

codecov bot commented Apr 6, 2023

Codecov Report

Patch coverage has no change and project coverage change: +0.11 🎉

Comparison is base (768a656) 73.02% compared to head (40f15b1) 73.14%.

❗ Current head 40f15b1 differs from pull request most recent head 4bd5e5c. Consider uploading reports for the commit 4bd5e5c to get more accurate results

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3203      +/-   ##
===========================================
+ Coverage    73.02%   73.14%   +0.11%     
===========================================
  Files          469      469              
  Lines        13566    13616      +50     
===========================================
+ Hits          9907     9959      +52     
+ Misses        3659     3657       -2     

see 21 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Collaborator

@mssalvatore mssalvatore left a comment

Choose a reason for hiding this comment

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

The roles assigned to the endpoints look good to me.

@mssalvatore mssalvatore force-pushed the 3078-secure-endpoints branch 2 times, most recently from 9193972 to 40f15b1 Compare April 6, 2023 14:45
Copy link
Contributor

Choose a reason for hiding this comment

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

Note: We currently use this endpoint in the manual run commands to fetch the agent binaries. Requiring authentication would cause the manual run commands to fail

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, I'll remove it

@@ -29,7 +32,8 @@ def get(self, collection=None):

return propagation_credentials, HTTPStatus.OK

# Used by Agent. Can't secure.
@auth_token_required
@roles_accepted(AccountRole.AGENT.name, AccountRole.ISLAND_INTERFACE.name)
Copy link
Contributor

Choose a reason for hiding this comment

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

Do agents actually need to put propagation credentials?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I suppose they don't, since they send them via events.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch

Comment on lines 177 to 178
# if OTP_FLAG not in os.environ:
# return OTP("PLACEHOLDER_OTP")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Either we can leave this or remove it. I'm not sure this PR is the right place to remove it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just a temporary commit for testing

pass


class AgentRequests(IMonkeyIslandRequests):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we just use infection_monkey.island_api_client.IIslandAPIClient?

Pros:

  • Less code in BB tests
  • Adds a quick, ETE test for HTTPIslandAPIClient

Cons:

  • Couples the tests to that component

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't like it. These tests shouldn't know anything about the internals. We don't do anything like this anywhere else in the BB tests either.

@shreyamalviya shreyamalviya force-pushed the 3078-secure-endpoints branch 2 times, most recently from fcc5b60 to 4bd5e5c Compare April 7, 2023 13:31
@mssalvatore mssalvatore marked this pull request as ready for review April 7, 2023 14:30
@mssalvatore mssalvatore merged commit 778ba92 into develop Apr 7, 2023
@mssalvatore mssalvatore deleted the 3078-secure-endpoints branch April 7, 2023 14:31
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.

4 participants