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

Add network-only scenarios test and implementation to system, cpp, ruby #63

Merged
merged 11 commits into from
Dec 21, 2023

Conversation

malakai97
Copy link
Contributor

@malakai97 malakai97 commented Dec 21, 2023

  • Add db/network.sql test fixture

  • Add restricted-by-network test site apache config

  • Ensure mod_remoteip does not ignore the ip

    It considered the 10. IPs to be internal and ignored them. By adding
    this directive, it knows to use them.

  • GrantRepo correctly finds the smallest network

    • Adds tests for nested network (allow, deny) and (deny, allow)
      scenarios
    • Changes SQL ordering of networks from desc to asc, so that we find the
      smallest network instead of the largest.
    • Removes the unnecessary math extravaganza to calculate the cidr range
      number
  • Rename for_user_and_uri to for (with named args)

  • Move ipaddr calculation to factory

Open questions

  • 401 vs 403 for responses. This is the path of least resistance to get this code merged.
    I/we will need to run the tests against the test site, but that's not a meaningful thing
    to do until the test site loads the network.sql fixture.
  • should I squash these commits down to one?

* create db/network.sql for fixture data
* Add 'pubnet' aa_coll for network and aa_coll_obj
* Add tests
* Set up client-ip/network grant queries

  This gets the basic join and where setup together for finding
  networks/grants that match the client's IP address (by way of
  institution networks). There is some cleanup to do as far method
  signatures and adding some more tests.
* Rename for_user_and_uri to for (with named args)
* Move ipaddr calculation to factory
* Adds tests for nested network (allow, deny) and (deny, allow)
  scenarios
* Changes SQL ordering of networks from desc to asc, so that we find the
  smallest network instead of the largest.
* Removes the unnecessary math extravaganza to calculate the cidr range
  number
It considered the 10. IPs to be internal and ignored them. By adding
this directive, it knows to use them.
apache/conf/lauth.conf Outdated Show resolved Hide resolved
lauth/spec/requests/authorized_client_ip_spec.rb Outdated Show resolved Hide resolved
lauth/spec/requests/authorized_client_ip_spec.rb Outdated Show resolved Hide resolved
lauth/spec/requests/authorized_spec.rb Outdated Show resolved Hide resolved
@@ -0,0 +1,23 @@
require "ipaddr"
Copy link
Member

Choose a reason for hiding this comment

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

move to somewhere bigger?

Mostly clarifications, except one case in authorized_client_ip_spec
where the ip addresses were reversed for (allow,allow)
@botimer botimer merged commit e4e372f into main Dec 21, 2023
4 checks passed
@botimer botimer deleted the networking branch December 21, 2023 21:34
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