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

Azure Function App which runs periodically to aggregate the bytes read per IP address over a window of time #215

Merged
merged 46 commits into from
Jun 26, 2024

Conversation

elayrocks
Copy link
Contributor

@elayrocks elayrocks commented Jun 11, 2024

Description

This PR is the first step in implementing data consumption quotas for SAS API Token Issuance. I created a new Azure Function App which runs periodically to execute a KQL query against Storage Account Blob Logs to aggregate the bytes read per IP address over a window of time (e.g., 24 hours). IPs which have read above a certain threshold will be added to an Azure storage table called blob storage banned ip which serves as a temporary ban list.

Please refer to the design doc for more details.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Unit test uses mocked response from log query client and writes test data to azurite. The integration/E2E test queries the log analytics workspace and writes to test table in storage account and deletes it after testing is complete.

Make sure correct roles have been assigned, run ./scripts/server to start azurite service and scripts/test --funcs [--no-integration] to run unit tests. and integration tests (optionally).

Checklist:

Please delete options that are not relevant.

  • I have performed a self-review
  • Changelog has been updated
  • Documentation has been updated
  • Unit tests pass locally (./scripts/test)
  • Code is linted and styled (./scripts/format)

pcfuncs/Dockerfile Outdated Show resolved Hide resolved
pcfuncs/ipban/constants.py Outdated Show resolved Hide resolved
pcfuncs/ipban/function.json Outdated Show resolved Hide resolved
pcfuncs/ipban/models.py Outdated Show resolved Hide resolved
pcfuncs/ipban/models.py Outdated Show resolved Hide resolved
pcfuncs/ipban/models.py Show resolved Hide resolved
deployment/terraform/resources/functions.tf Outdated Show resolved Hide resolved
deployment/terraform/resources/functions.tf Outdated Show resolved Hide resolved
deployment/terraform/resources/providers.tf Outdated Show resolved Hide resolved
deployment/terraform/resources/variables.tf Outdated Show resolved Hide resolved
pcfuncs/ipban/__init__.py Outdated Show resolved Hide resolved
pcfuncs/ipban/config.py Outdated Show resolved Hide resolved
@elayrocks elayrocks merged commit a08f05e into main Jun 26, 2024
5 checks passed
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.

2 participants