14999 Commits

Author SHA1 Message Date
Zuul
f45921840c Merge "Re-join the strings after re-formatting" 2024-08-02 17:17:59 +00:00
Zuul
9682ebcf48 Merge "Move bandit to pre-commit" 2024-08-02 17:17:57 +00:00
Zuul
bf82973ba3 Merge "Only log a small debug message for NotFound" 2024-08-02 17:17:54 +00:00
Zuul
f0352c5481 Merge "Enable pyupgrade" 2024-07-26 20:26:41 +00:00
Zuul
267474d318 Merge "Enable black in pre-commit" 2024-07-26 19:44:38 +00:00
Zuul
fb0180a164 Merge "Add a release note to cover fix of implied role for application credentials" 2024-07-26 16:25:59 +00:00
Artem Goncharov
aa95af38ea Enable non-voting OpenAPI build job
We are going to start building OpenAPI using codegenerator directly in
the Keystone and move all the schemas into the codebasis. It is going to
be very helpful to immediately see whether generation is possible and
the OpenAPI spec is valid. Thus adding it as non-voting for now (and it
makes no sense of having non-voting job in gate).

Change-Id: Iaf418d69cbb55fbe9dde3f2ec4213e64345057c2
2024-07-26 09:52:07 +00:00
Artem Goncharov
8416b72bff Re-join the strings after re-formatting
After reformatting there are some cases of previously strings split
across the lines were simply placed on a single line ("foo " "bar baz").
Join such cases properly.

Change-Id: Ie56d5ca35d3e0983a73554916f5399837a3b35b4
2024-07-26 11:45:16 +02:00
Artem Goncharov
204ea42232 Move bandit to pre-commit
Ensure committing locally will raise bandit check errors before we push
the change by putting it into the pre-commit. Since pre-commit is
already invoked in the pep8 env we can drop bandit from there.

Change-Id: I4d9d5aa283fb6cb91d610e23c6a44e98d8df46aa
2024-07-26 11:44:25 +02:00
Artem Goncharov
aaf0cc8fae Enable pyupgrade
pyupgrade is a tool (and pre-commit hook) to automatically upgrade
syntax for newer versions of the language. It helps getting rid of
syntax required for older python versions not supported anymore and
prepare us for easier support of newer python versions. The tool is
already used in some other OpenStack projects, so it is time to start
using it also for Keystone.

The change is generated by uncommenting the pre-commit hook and
executing `pre-commit run -a` to convert the data. The same could be
also achieved by simply trying to commit and adding converted files in
few iterations.

Change-Id: Ia1f64709e57ebb4e44db128bfea4c5957b2071df
2024-07-26 11:43:25 +02:00
Artem Goncharov
55e8c1e605 Enable black in pre-commit
With this black performs linter check even before the commit is created
allowing devs to spot issues before sending change to the CI.

With this we also switch from flake8 to pre-commit to ensure we run the
same tests locally and in the CI thus preventing accidential drift.

Change-Id: I121f55a2f00817dc4b6061933752b81e01d62cb4
2024-07-26 11:42:33 +02:00
Dr. Jens Harbott
d4695b318e Only log a small debug message for NotFound
NotFound exceptions happen regularly during normal operations,
e.g. when doing "openstack role show member", so don't make a fuss
about them.

Change-Id: I59ad6fe4ff167a431eae943dd261d4a69c21e980
2024-07-25 17:53:11 +02:00
Zuul
181dc7b03f Merge "Blackify the keystone code base" 2024-07-24 17:15:09 +00:00
Artem Goncharov
a00839ca02 Blackify the keystone code base
Improve code maintainability by enabling us to use automatic code
formatter. We use black as a relatively fast code formatter (ruff is an
lternative, but it will immediately require also changing all quotes
chaos). In the next change black is going to be added into the
pre-commit allowing contributors to spot formatting issues before
sending code to the CI sending precious run hours. Same steps has been
performed in the openstasksdk/cli and partially nova.

Steps performed:
- `black -l 79 -S keystone`
- add exceptions to the tox.ini for the lines which black decided not to
  split

Following files are polished manually due to noqa headers and similar
being reformatted to wrong strings:

keystone/auth/plugins/totp.py
keystone/common/password_hashing.py
keystone/tests/unit/ksfixtures/__init__.py

Change-Id: I832ec4c152fa58fb0088d9f880add86a20ec95fc
2024-07-22 09:02:23 +02:00
Zuul
04fdf7c0e6 Merge "Fix bindep for py312 job" 2024-07-19 16:50:01 +00:00
Zuul
6db53e793c Merge "Add pre-commit" 2024-07-19 16:49:59 +00:00
Dmitriy Rabotyagov
09c57923fc Add a release note to cover fix of implied role for application credentials
Change-Id: I627eac6934a056a921e922de4c898faccb2cb968
2024-07-15 15:19:22 +02:00
gtema
c3c6d9854c Fix implied roles in the application credentials
When user requests new application credentials without specifying roles
explicitly all current roles from the token are being used for that
(including implied roles).
When new application credentials are requested specifying a role that
implies another role (i.e. member) only that role is added into the
list. This is not what is expected, so change it by looping through
every requested role and add every implied role into the list if it is
not already there.

Related-Bug: https://bugs.launchpad.net/keystone/+bug/2030061

Change-Id: I452313ac7e1e6960748bcd1e667fb7c0076eb7a2
2024-07-15 15:09:41 +02:00
Artem Goncharov
24113bb182 Fix bindep for py312 job
python-all-dev is not available on the newer ubuntu images
(ubuntu-nobble). Replace it with `python3-dev` as used by majority of
other OpenStack repositories. This change does not fix the tests, it
just ensures tests are being executed.

Change-Id: I860ca5e6259459716e606a4c76002164d6a18668
2024-07-12 20:30:33 +02:00
Artem Goncharov
430bebe376 Add pre-commit
As a starting point for the code renovation it makes sense to add
pre-commit with the same configuration as we spread across the other
services. For now comment out hooks that fail and address them one by
one.
At the end of the series we would have pre-commit executing all the
necessary checks (linting, flake, black, mypy, etc) and it will be
invoked directly in the `tox -e pep8` to unify all the processing. We
are going to re-format source code with `black` adding revisions to
git blame ignore to reduce amount of noise. This will help us to have
reasonable formatting of the code with possibility to just auto-format
the code.

Change-Id: Ia00f4209cde8f64828dc2d827d49bfc4bd6c1efa
2024-07-12 20:30:33 +02:00
Zuul
1b78b57ec5 Merge "Improve configuration of out-of-tree identity drivers" 2024-07-12 18:16:30 +00:00
Zuul
0bc2af48d5 Merge "reno: Update master for unmaintained/zed" 2024-07-03 05:51:31 +00:00
Zuul
90695d8da6 Merge "Add test with noauth for s3tokens and ec2tokens" 2024-06-28 17:14:41 +00:00
Zuul
3353ca1456 Merge "Remove SQLAlchemy tips jobs" 2024-06-28 17:14:38 +00:00
Zuul
89b2f1cb60 Merge "do not use str(url) to stringify a URL for subsequent use" 2024-06-28 17:14:36 +00:00
Zuul
1ea4a15e9e Merge "Replace use of testtools.testcase.TestSkipped" 2024-06-28 16:21:27 +00:00
Stephen Finucane
53d547fcb8 Replace use of testtools.testcase.TestSkipped
This has been deprecated for removal [1]. Use the stdlib variant
instead.

[1] https://github.com/testing-cabal/testtools/commit/59b890db3c

Change-Id: I7701872d2de44bb7c8296501015c24d0741adc93
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2024-06-24 10:43:09 +01:00
Takashi Kajinami
bc57ccbc8b Remove dependency on pytz
pytz will be removed from RHEL/CentOS 10 because of the built-in
zoneinfo[1].

Because the current usage of pytz can be very easily replaced, this
removes the dependency on pytz.

[1] https://issues.redhat.com/browse/RHEL-219

Change-Id: Ib90acd5ebb9a0c2cffd643bda0ecdafa97552008
2024-06-10 09:14:41 +00:00
Artem Goncharov
41ab96ba8e Improve configuration of out-of-tree identity drivers
Official recommendation for operators is to develop out-of-tree drivers
for the missing functionality. While this is easily possible there are
hurdles for configuring such drivers. Configuring them using FS requires
restart of Keystone when i.e. adding new domains to be processed with
the custom driver. Using database is a much better and dynamical
approach, but it currently is not allowing drivers to have specific
configuration. This change improves this flaws and contains of 3
individual parts that are submitted together to make testing easier.

- Allowing driver to register supported configuration option before
  loading the driver (invoke DriverManager without calling the driver
  and search for specific method present).
- Allow changing driver specific configuration through API (add 2 more
  configuration options enabling listed options in the API)
- Documentation changes.

Change-Id: I99fa798ef60cdb7a488fe55de76cd931c6db3e89
2024-06-05 17:16:58 +02:00
Zuul
dd61a91864 Merge "Remove reference to devstack-gate" 2024-05-31 03:16:23 +00:00
Zuul
c8e4f53807 Merge "Update master for stable/2024.1" 2024-05-21 15:17:50 +00:00
Mike Bayer
7f0adbb016 do not use str(url) to stringify a URL for subsequent use
The str(url) function in SQLAlchemy hides the password.
For a URL string that is to be re-used, use
render_as_string(hide_password=False).

Change-Id: I2ab28da5cc2b9ed3a1588259b2e94320662816bb
2024-05-16 00:50:48 +09:00
Takashi Kajinami
0e00821762 Remove reference to devstack-gate
devstack-gate was deprecated in xena and is being retired now[1].

[1] https://review.opendev.org/c/openstack/governance/+/919629

Change-Id: I14007ad2356fd41198ac412895c6ae88232b2681
2024-05-15 20:01:46 +09:00
44e76c6207 reno: Update master for unmaintained/zed
Update the zed release notes configuration to build from
unmaintained/zed.

Change-Id: Ia0c101d35ebfeec1b5525d16f4da6d652eaff2ac
2024-05-08 12:39:03 +00:00
Takashi Kajinami
af53770e62 Make protection job voting again
Now keystone-tempest-plugin has been updated according to the fixed
policy rules.

Depends-on: https://review.opendev.org/c/openstack/keystone-tempest-plugin/+/916706
Change-Id: I8949b738a62d9a1c30326b3b9897b1540c5cfbd4
2024-04-23 14:52:36 +09:00
Takashi Kajinami
5ead95ffcc Allow domain users to manage credentials
Credentials are associated with users so there is no reason we prevent
domain users from accessing the resources. In some services like heat
domain admin is used to generate keystone credentials and loosing
the scope check is required to continue supporting such use case.

Closes-Bug: #2062045
Change-Id: I140b302d879ce1cc1f8d8de9e666cc74278a977f
2024-04-23 05:45:40 +00:00
Takashi Kajinami
522627de3c Allow domain admin to view roles
Domain admins are allowed to assign roles. So it should be allowed to
view roles.

Note that protection job is made non-voting until the domain admin role
test cases are updated.

Closes-Bug: #2059780
Change-Id: Ifc25cf32ffcdb3b8a62d6741bc38e14bca0d7763
2024-04-23 14:39:58 +09:00
Douglas Mendizábal
7a6e1a0bdc Enable protection jobs
This patch re-enables the protection gate jobs now that policy changes
and tempest test changes have merged.

Depends-On: https://review.opendev.org/c/openstack/keystone-tempest-plugin/+/914934
Change-Id: I928fcb8943319e5463a246105391a2bafe833a7e
2024-04-15 16:19:26 +00:00
Stephen Finucane
fe8b89a79a Remove SQLAlchemy tips jobs
The most recent SQLAlchemy and Alembic versions are now in
upper-constraints. As a result, this job has served its purpose and can
be removed. For more information, see [1].

[1] https://lists.openstack.org/archives/list/openstack-discuss@lists.openstack.org/thread/RBHXHTO3GUOOXVSZXD4C2O3TKDOH2QSC/

Change-Id: I6648bec52a5bcaa05a2294666edbf3fa2813054a
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Depends-on: https://review.opendev.org/c/openstack/requirements/+/879743
2024-04-12 11:46:20 +01:00
Zuul
8ca73f758b Merge "sql: Fixup for invalid unique constraint on external_id in access_rule table" 2024-04-03 16:52:44 +00:00
Douglas Mendizábal
b31007e1b2 Allow admin to access tokens and credentials
This patch modifies a few policies to allow users with the "admin" role
to access /v3/auth/tokens and /v3/credentials.  These policies were
missed when we implemented Phase 1 of Secure RBAC.

Change-Id: Id789c09121f1405f7ba5e4926498dab4ad98e057
2024-04-02 20:58:10 -05:00
Douglas Mendizábal
a050129384 Run Secure RBAC tests as project-admin
This patch updates the devstack plugin so that tempest.conf is not
configured to use system-admin.  Currently tempest uses an all-in
approach to configuring admin clients, and forcing system scope in
tempest when SRBAC is turned on results in test failures for services
that don't understand system scope.

With this patch, keystone test will be run with a project-scoped admin,
which should be fine since policies have been previously updated to
accept project-admin tokens as legacy admin for Phase 1. [1]

[1] f2f1a5c388

Change-Id: I39d50b8e6e55b0835670d753c3783f32b19b6c47
2024-04-02 20:56:48 -05:00
Zuul
fc10ccbc8c Merge "Replace CRLF by LF" 2024-03-29 17:24:57 +00:00
Zuul
31e7b1f261 Merge "reno: Update master for unmaintained/xena" 2024-03-29 17:24:55 +00:00
Zuul
4f15ee89db Merge "reno: Update master for unmaintained/wallaby" 2024-03-29 17:24:53 +00:00
9a11c0c462 reno: Update master for unmaintained/xena
Update the xena release notes configuration to build from
unmaintained/xena.

Change-Id: I85125d02ce8a17f848f23e024f32a5c183f7b67e
2024-03-26 16:44:58 +00:00
8762253c53 reno: Update master for unmaintained/wallaby
Update the wallaby release notes configuration to build from
unmaintained/wallaby.

Change-Id: Iba95e22e05c8872ddde42dc88912dcfbf14c96b7
2024-03-26 16:43:57 +00:00
7af1d49c28 reno: Update master for unmaintained/victoria
Update the victoria release notes configuration to build from
unmaintained/victoria.

Change-Id: Ibc662537e6eda4a318141d7d5ef4a522efa8d29e
2024-03-26 16:42:49 +00:00
88fcb38ca2 Update master for stable/2024.1
Add file to the reno documentation build to show release notes for
stable/2024.1.

Use pbr instruction to increment the minor version number
automatically so that master versions are higher than the versions on
stable/2024.1.

Sem-Ver: feature
Change-Id: I269449185216e98155807b046b7bab48610911b3
2024-03-19 10:15:29 +00:00
Tobias Urdin
bd70653a24 Add test with noauth for s3tokens and ec2tokens
The s3tokens and ec2tokens endpoint is a public API
that does not require authentication to be called but
that is what the testing does today.

This duplicates the "good request" tests by also
testing with noauth set so that we don't send a
token in the request, this can prevent bugs where
we would unintentionally require auth for these
endpoints.

Change-Id: Ibbde313ac8bcf3187c139bbd0840702f229534d0
2024-03-18 13:38:42 +01:00