1. 11 Oct, 2021 1 commit
  2. 08 Oct, 2021 1 commit
  3. 07 Oct, 2021 3 commits
    • Lance Bragstad's avatar
      Fix typos in application credential policies · 4063ad98
      Lance Bragstad authored
      We updated these policies when we introduces system scope and default
      roles, but the policy names accidentally changed, which makes the policy
      files render with an alias because oslo.policy thinks the names are
      changing.
      
      Conflicts:
            keystone/common/policies/application_credential.py in later
            releases the deprecated parameters were moved from the
            DocumentedRuleDefault object to the DeprecatedRule object, which
            is a non-functional change.
      
      Change-Id: I1121f1abe769ee83ffc285103a95ee95540ce727
      (cherry picked from commit 60e898c4)
      (cherry picked from commit 7b28f1b3b47d0e4a22afe99c64d047016a772da5)
      (cherry picked from commit 14d2f594)
      4063ad98
    • Lance Bragstad's avatar
      Fix typos in ec2 credential policies · 65c99d6e
      Lance Bragstad authored
      There was a trailing s in two of these policies and it caused the policy
      names to mismatch, which causes confusion with the rendered policy files
      and potentially causes uses with deprecation logic.
      
      Change-Id: I54021986d17c57d7733d53caa4032c2767eaf25e
      (cherry picked from commit 82da8824)
      (cherry picked from commit 6dff22b5baa1a19842aca435782fe1f9789f72cc)
      (cherry picked from commit a57ae85c)
      65c99d6e
    • Lance Bragstad's avatar
      Fix typo in identity provider policies · f742fade
      Lance Bragstad authored
      This cause the sample generated policy file to alias the old name with
      the new policy name, which isn't needed since we're not renaming these
      policies at all and it was likely a typo.
      
      Conflicts:
            keystone/common/policies/identity_provider.py
            In later releases the deprecation parameters were moved up to the
            deprecated options and not in the DocumentedRule defaults.
      
      Change-Id: Idfd9adbbe800bbc21814d94002a2b61524cce28a
      (cherry picked from commit c10d5c88)
      (cherry picked from commit bdd8f82f)
      f742fade
  4. 10 May, 2021 1 commit
    • Gage Hugo's avatar
      Hide AccountLocked exception from end users · 4649fe6b
      Gage Hugo authored
      
      
      This change hides the AccountLocked exception from being returned
      to the end user to hide sensitive information that a potential
      malicious person could gain insight from.
      
      The notification handler catches the AccountLocked exception as
      before, but after sending the audit notification, it instead
      bubbles up Unauthorized rather than AccountLocked.
      
      Co-Authored-By: default avatarSamuel de Medeiros Queiroz <samueldmq@gmail.com>
      
      Change-Id: Id51241989b22c52810391f3e8e1cadbf8613d873
      Related-Bug: #1688137
      (cherry picked from commit ac2631ae)
      4649fe6b
  5. 29 Mar, 2021 1 commit
    • Lance Bragstad's avatar
      Retry update_user when sqlalchemy raises StaleDataErrors · 5b7d4c80
      Lance Bragstad authored
      Keystone's update_user() method in the SQL driver processes a lot of
      information about how to update users. This includes evaluating password
      logic and authentication attempts for PSI-DSS. This logic is evaluated
      after keystone pulls the user record from SQL and before it exits the
      context manager, which performs the write.
      
      When multiple clients are all updating the same user reference, it's
      more likely they will see an HTTP 500 because of race conditions exiting
      the context manager. The HTTP 500 is due to stale data when updating
      password expiration for old passwords, which happens when setting a new
      password for a user.
      
      This commit attempts to handle that case more gracefully than throwing a
      500 by detecting StaleDataErrors from sqlalchemy and retrying.  The
      identity sql backend will retry the request for clients that have
      stale data change from underneath them.
      
      Change-Id: I75590c20e90170ed862f46f0de7d61c7810b5c90
      Closes-Bug: 1885753
      (cherry picked from commit ceae3566)
      (cherry picked from commit f47e635b)
      5b7d4c80
  6. 03 Feb, 2021 1 commit
    • Keigo Noha's avatar
      Support bytes type in generate_public_ID() · 5b860e0b
      Keigo Noha authored
      python-ldap3.0 or later running on python3 uses str or bytes
      data type according to what fields are returned.
      local_id may be a bytes data type.
      To handle it properly, mapping[key] needs to be examined for
      identifying its data type and what python version is used.
      
      Closes-Bug: #1901654
      Change-Id: Iac097235fd31e166028c169d14ec0937c663c21c
      (cherry picked from commit f7df9fba)
      5b860e0b
  7. 26 Jan, 2021 2 commits
  8. 08 Jan, 2021 3 commits
    • Lance Bragstad's avatar
      Use app cred user ID in policy enforcement · 66c3bd8d
      Lance Bragstad authored
      The application credential policies use the `rule:owner` policy to allow
      users to manage their own credentials. The policy engine pulled the
      user_id attribute from the request path instead of the actual
      application credential. This allowed for users to exploit the
      enforcement and view or delete application credentials they don't own.
      
      This commit attempts to resolve the issue by updating the flask
      parameters before they're translated to policy arguments and target
      data, prior to policy enforcement.
      
      Change-Id: I903d20fa41270499ca1c39d296120dd97cef5405
      Closes-Bug: 1901207
      (cherry picked from commit 2d7bf10a)
      66c3bd8d
    • OpenStack Release Bot's avatar
      Update TOX_CONSTRAINTS_FILE for stable/victoria · 66594899
      OpenStack Release Bot authored
      Update the URL to the upper-constraints file to point to the redirect
      rule on releases.openstack.org so that anyone working on this branch
      will switch to the correct upper-constraints list automatically when
      the requirements repository branches.
      
      Until the requirements repository has as stable/victoria branch, tests will
      continue to use the upper-constraints list on master.
      
      Change-Id: I97a59aeda28e193f34f3c4d003ff7b90b9582e0f
      66594899
    • Kristi Nikolla's avatar
      Drop lower-constraints job · 42faeb27
      Kristi Nikolla authored
      Lower-constraints is not a requirement of the OpenStack Python PTI
      [0] and there currently is a discussion on the mailing list [1]
      about dropping the test, with the oslo team already having done
      so [2].
      
      The new dependency resolver in pip fails due to incompatible
      dependency versions in our lower-constraints file, meaning that
      we were never providing any real guarantees with it.
      
      To unblock the CI, I am disabling lower-constraints job for now,
      with the option to reenable it in case we fix the constraints,
      and based on the outcome of the mailing list discussions and
      consensus.
      
      [0]. https://governance.openstack.org/tc/reference/pti/python.html
      [1]. http://lists.openstack.org/pipermail/openstack-discuss/2021-January/019672.html
      [2]. http://lists.openstack.org/pipermail/openstack-discuss/2021-January/019659.html
      
      Change-Id: I47e747058891596e7717848a0b0bc10f0a235b2f
      (cherry picked from commit d6610594)
      42faeb27
  9. 30 Oct, 2020 1 commit
    • Vishakha Agarwal's avatar
      Delete system role assignments from system_assignment table · 6f93063f
      Vishakha Agarwal authored
      This patch ensures to delete the system role assignments from
      all the assignment tables in keystone after deleting the role
      user has over the system.
      
      This also make sure of deleting stale role assignments before
      deleting role for the deployments that are already in this state.
      
      Closes-Bug: #1878938
      
      Change-Id: I4df19c45c870ff3fb78578ca1fb7dd0d35da3c82
      (cherry picked from commit c1dcbb05)
      (cherry picked from commit b83170a3)
      6f93063f
  10. 02 Oct, 2020 1 commit
    • Lance Bragstad's avatar
      Implement more robust connection handling for asynchronous LDAP calls · a26a40d4
      Lance Bragstad authored
      Keystone's paging implementation contains a memory leak. The issue is
      noticeable if you integrate keystone with an LDAP server that supports
      paging and set `keystone.conf [ldap] page_size` to a low integer
      (e.g., 5).
      
      Keystone's LDAP backend uses `python-ldap` to interact with LDAP
      servers. For paged requests, it uses `search_ext()`, which is an
      asynchronous API [0]. The server responds with a message ID, which the
      client uses to retrieve all data for the request. In keystone's case,
      the `search_ext()` method is invoked with a page control that tells
      the server to deliver responses in increments according to the page
      size configured with `keystone.conf [ldap] page_size`. So long as the
      client has the original connection used to fetch the message ID, it
      can request the rest of the information associated to the request.
      
      Keystone's paging implementation loops continuously for paged
      requests. It takes the message ID it gets from `search_ext()` and
      calls `result3()`, asking the server for the data associated with that
      specific message. Keystone continues to do this until the server sends
      an indicator that it has no more data relevant to the query (via a
      cookie). The `search_ext()` and `result3()` methods must use the same
      LDAP connection.
      
      Given the above information, keystone uses context managers to provide
      connections. This is relevant when deploying connection pools, where
      certain connections are re-used from a pool. Keystone relies on Python
      context managers to handle connections, which is pretty typical
      use-case for context managers. Connection managers allow us to do the
      following (assuming pseudocode):
      
        with self.get_connection as conn:
            response = conn.search_s()
            return format(response)
      
      The above snippet assumes the `get_connection` method provides a
      connection object and a callable that implements `search_s`. Upon
      exiting the `with` statement, the connection is disconnected, or put
      back into the pool, or whatever the implementation of the context
      manager decides to do. Most connections in the LDAP backend are
      handled in this fashion.
      
      Unfortunately, the LDAP driver is somewhat oblivious to paging, it's
      control implementation, or the fact that it uses an asynchronous API.
      Instead, the driver leaves it up to the handler objects it uses for
      connections to determine if the request should be controlled via
      paging. This is an anti-pattern since the backend establishes the
      connection for the request but doesn't ensure that connection is
      safely handled for asynchronous APIs.
      
      This forces the `search_ext()` and `result3()` implementations in the
      PooledLDAPHandler to know how to handle connections and context
      managers, since it needs to ensure the same connection is used for
      paged requests. The current code tried to clean up the context
      manager responsible for connections after the results are collected
      from the server using the message ID. I believe it does this because
      it needs to get a new connection for each message in the paged
      results, even though it already operates from within a connection
      established via a context manager and the PooledLDAPHandler almost
      always returns the same connection object from the pool. The code
      tries to use a weak reference to create a callback that tears down the
      context manager when nothing else references it. At a high-level, the
      idea is similar to the following pseudocode:
      
        with self.get_connection as conn:
            while True:
      	ldap_data = []
      	context_manager = self.get_connection()
      	connection = context_manager.__enter__()
      	message_id = connection.search_ext()
      	results = connection.result3(message_id)
      	ldap_data.append(results)
      	context_manager.__exit__()
      
      I wasn't able to see the callback get invoked or work as described in
      comments, resulting in memory bloat, especially with low page sizes
      which results in more requests. A weak reference invokes the callback
      when the weak reference is called, but there are no other references
      to the original object [1]. In our case, I don't think we invoke that
      path because we don't actually do anything with the weak reference. We
      assume it's going to run the callback when the object is garbage
      collected.
      
      This commit attempts to address this issue by using the concept of a
      finalizer [2], which was designed for similar cases. It also attempts
      to hide the cleanup implementation in the AsynchronousMessage object,
      so that callers don't have to worry about making sure they invoke the
      finalizer.
      
      An alternative approach would be to push more of the paging logic and
      implementation up into the LDAP driver. This would make it easier to
      put the entire asynchronous API flow for paging into a `with`
      statement and relying on the normal behavior of context managers to
      clean up accordingly. This approach would remove the manual cleanup
      invocation, regardless of using weak references or finalizer objects.
      However, this approach would likely require a non-trivial amount of
      design work to refactor the entire LDAP backend. The LDAP backend has
      other issues that would complicate the re-design process:
      
        - Handlers and connection are generalized to mean the same thing
        - Method names don't follow a convention
        - Domain-specific language from python-ldap bleeds into keystone's
          implementation (e.g., get_all, _ldap_get_all, add_member) at
          different points in the backend (e.g., UserApi (BaseLdap), GroupApi
          (BaseLdap), KeystoneLDAPHandler, PooledLDAPHandler,
          PythonLDAPHandler)
        - Backend contains dead code from when keystone supported writeable
          LDAP backends
        - Responsibility for connections and connection handling is spread
          across objects (BaseLdap, LDAPHandler)
        - Handlers will invoke methods differently based on configuration at
          runtime, which is a sign that the relationship between the driver,
          handlers, and connection objects isn't truely polymorphic
      
      While keeping the logic for properly handling context managers and
      connections in the Handlers might not be ideal, it is a relatively
      minimal fix in comparison to a re-design or backend refactor. These
      issues can be considered during a refactor of the LDAP backend if or
      when the community decides to re-design the LDAP backend.
      
      [0] https://www.python-ldap.org/en/python-ldap-3.3.0/reference/ldap.html#ldap.LDAPObject.search_ext
      [1] https://docs.python.org/3/library/weakref.html#weakref.ref
      [2] https://docs.python.org/3/library/weakref.html#finalizer-objects
      
      Closes-Bug: 1896125
      Change-Id: Ia45a45ff852d0d4e3a713dae07a46d4ff8d370f3
      a26a40d4
  11. 25 Sep, 2020 1 commit
  12. 16 Sep, 2020 1 commit
  13. 14 Sep, 2020 1 commit
  14. 11 Sep, 2020 1 commit
    • Ghanshyam Mann's avatar
      Fix gate by running l-c job on Bionic · 0ba9e3a1
      Ghanshyam Mann authored
      l-c job template moved the l-c jobs running on Focal
      and currently fails on many constraints.
      
      Let's keep running l-c job on bionic as it was before and we
      can move it to Focal once issues are identified and fixed.
      
      - Fixing the hacking tests which are behaving differently between
      < 3.8.0 (until Ubuntu Bionic) and 3.8.2 (Ubuntu Focal).
      
      Squashing below review also
      - https://review.opendev.org/#/c/750786/
      
      Co-Author: Lance Bragstad <lbragstad@gmail.com>
      
      Change-Id: If733e9824d87d8c73797f753e4daf95489bed9c2
      0ba9e3a1
  15. 28 Aug, 2020 2 commits
  16. 26 Aug, 2020 1 commit
  17. 25 Aug, 2020 3 commits
  18. 24 Aug, 2020 2 commits
  19. 21 Aug, 2020 1 commit
  20. 17 Aug, 2020 1 commit
    • Vishakha Agarwal's avatar
      Fix user creation with GRANT in MySQL 8.0(Ubuntu Focal) · b54839f3
      Vishakha Agarwal authored
      In Ubuntu Bionic (18.04) mysql 5.7 version used to create
      the user implicitly when using using the GRANT.
      
      Ubuntu Focal (20.04) has mysql 8.0 and with mysql 8.0 there
      is no implicit user creation with GRANT. We need to
      create the user first before using GRANT command.
      
      This patch updates tools/test-setup.sh so that keystone supports
      ubuntu focal.
      
      Story: #2007865
      Task: #40190
      
      Change-Id: I86d10729cfc7c02f12df611b56f6e263969dfe4b
      Closes-Bug: #1885825
      b54839f3
  21. 13 Aug, 2020 2 commits
  22. 11 Aug, 2020 2 commits
  23. 10 Aug, 2020 1 commit
  24. 06 Aug, 2020 2 commits
    • Vishakha Agarwal's avatar
      Spelling Fix · f6df4e32
      Vishakha Agarwal authored
      This Patch fixes the 'middleware' spelling.
      
      Change-Id: I6659ca49db86e5c20ecf80e4c4fff93328616eb6
      f6df4e32
    • Vishakha Agarwal's avatar
      NIT: Spelling Fix · 4ef7a237
      Vishakha Agarwal authored
      This patch fixes spelling "project" in test_sql_upgrade.py file.
      
      Change-Id: I8b1a8dbea5fb17707e59fae8605cc615f1b51f2c
      4ef7a237
  25. 05 Aug, 2020 2 commits
  26. 31 Jul, 2020 2 commits