Skip to content
This repository has been archived by the owner on Sep 16, 2024. It is now read-only.

feat(PE-5458): blocklist contract evaluation #95

Merged
merged 4 commits into from
Jan 18, 2024

Conversation

dtfiedler
Copy link
Collaborator

@dtfiedler dtfiedler commented Jan 18, 2024

Blocklist contract evaluation based on env vars.

Comment:

To access ctx.params we must be in a route handler, hence why we attach the blocklist middleware to routes that support contractTxId directly instead of a global middleware. Should we prefer a global middleware, we would have to parse out the contractTxId from ctx.path via regex, which has a few edge cases we may not want (e.g. the query including contractTxId for filtering which does not evaluate the contract, and instead filters out records that are assigned to that contractTxId).

dtfiedler added 2 commits January 18, 2024 08:47
Some contracts are known to cause endless evaluation and brick the service. This prevents evaluation of those contracts via middleware that checks the path for these ids and returns 403 when they are blocklisted. We also avoid evaluating these contracts when checking the ownership.
@dtfiedler dtfiedler requested a review from a team as a code owner January 18, 2024 16:55
Comment on lines +26 to +30
blockListedContractCount
.labels({
contractTxId,
})
.inc();
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

shows in prometheus metrics (e.g. /arns_metrics) as

# HELP blocklisted_contract_count A contract was blocklisted
# TYPE blocklisted_contract_count counter
blocklisted_contract_count{contractTxId="fbU8Y4NMKKzP4rmAYeYj6tDrVDo9XNbdyq5IZPA31WQ"} 1

@dtfiedler dtfiedler merged commit 2f86adf into main Jan 18, 2024
6 checks passed
@dtfiedler dtfiedler deleted the PE-5458-blocklist-contract-evaluation branch January 18, 2024 17:18
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants