Skip to content

Conversation

@JPrevost
Copy link
Member

@JPrevost JPrevost commented Apr 10, 2025

Why are these changes being introduced:

  • Bots and pentesters are using a significant amount of our resources

Relevant ticket(s):

How does this address that need:

  • Adds a rack-attack configuration for a few scenarios
    • Overall throttle for extremely high volume (not including assets)
    • Lower throttle for redirect detected requests (these are bots behaving badly)
    • a few pentester bans
  • campus IPs are safelisted, which should include ezproxy and vpn

Document any side effects to this change:

It's difficult to test to ensure the best tweaks to this type of work until it is in production.

Developer

Accessibility
  • ANDI or WAVE has been run in accordance to our guide.
  • This PR contains no changes to the view layer.
  • New issues flagged by ANDI or WAVE have been resolved.
  • New issues flagged by ANDI or WAVE have been ticketed (link in the Pull Request details above).
  • No new accessibility issues have been flagged.
New ENV
  • All new ENV is documented in README.
  • All new ENV has been added to Heroku Pipeline, Staging and Prod.
  • ENV has not changed.
Approval beyond code review
  • UXWS/stakeholder approval has been confirmed.
  • UXWS/stakeholder review will be completed retroactively.
  • UXWS/stakeholder review is not needed.
Additional context needed to review

E.g., if the PR includes updated dependencies and/or data
migration, or how to confirm the feature is working.

Code Reviewer

Code
  • I have confirmed that the code works as intended.
  • Any CodeClimate issues have been fixed or confirmed as
    added technical debt.
Documentation
  • The commit message is clear and follows our guidelines
    (not just this pull request message).
  • The documentation has been updated or is unnecessary.
  • New dependencies are appropriate or there were no changes.
Testing
  • There are appropriate tests covering any new functionality.
  • No additional test coverage is required.

@mitlib mitlib temporarily deployed to timdex-ui-pi-timx-480-r-ft7g6z April 10, 2025 12:58 Inactive
@coveralls
Copy link

coveralls commented Apr 10, 2025

Pull Request Test Coverage Report for Build 14381121857

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.2%) to 98.658%

Totals Coverage Status
Change from base Build 14044458345: 0.2%
Covered Lines: 588
Relevant Lines: 596

💛 - Coveralls

Why are these changes being introduced:

* Bots and pentesters are using a significant amount of our resources

Relevant ticket(s):

* https://mitlibraries.atlassian.net/browse/TIMX-480

How does this address that need:

* Adds a rack-attack configuration for a few scenarios
  * Overall throttle for extremely high volume (not including assets)
  * Lower throttle for redirect detected requests (these are bots
    behaving badly)
  * a few pentester bans
* campus IPs are safelisted, which should include ezproxy and vpn

Document any side effects to this change:

It's difficult to test to ensure the best tweaks to this type of work
until it is in production.
@JPrevost JPrevost force-pushed the timx-480-rack-attack-config branch from e36e66c to e12a1a5 Compare April 10, 2025 13:01
@JPrevost JPrevost temporarily deployed to timdex-ui-pi-timx-480-r-ft7g6z April 10, 2025 13:01 Inactive
@matt-bernhardt matt-bernhardt self-assigned this Apr 11, 2025
Copy link
Member

@matt-bernhardt matt-bernhardt left a comment

Choose a reason for hiding this comment

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

I'm doing this review from campus, so I can't confirm any negative behavior myself. I have seen, though, that campus addresses are not blocked when I repeatedly request paths that should trigger fail2ban however.

This said, I think the configurations here seem pretty straightforward - so in theory I think this works pretty well. As you say, we probably need to get this in production and then tweak from there?

The only question I have about any details, which isn't a blocking question, is to ask whether we should specify MIT addresses in the IPv6 space, and not just what's left of the IPv4 space? As with other details, though, this can be something we deal with after merging this.

:shipit: if you're comfortable with my review being done from a safelisted location. If you'd like me to confirm the negative behavior, I'll take another look when I'm back home.

# http://kb.mit.edu/confluence/x/F4DCAg
# Main IP range (includes campus, NAT pool, and VPNs)
# This also affects bot_challenge_page logic which uses rack_attack under the hood
Rack::Attack.safelist_ip("18.0.0.0/11")
Copy link
Member

Choose a reason for hiding this comment

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

I confess that I'm a little fuzzy on how IPv6 relates to IPv4, but do we need to specify any blocks of IPv6 addresses here as well?

Copy link
Member Author

Choose a reason for hiding this comment

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

Great question. We should consider safe listing the IPv6 range as well, but I'll open that as something to explore further

@JPrevost JPrevost merged commit a21b994 into main Apr 11, 2025
5 checks passed
@JPrevost JPrevost deleted the timx-480-rack-attack-config branch April 11, 2025 16:44
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.

5 participants