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

warehouse: add initial pending OIDC provider models #12572

Merged
merged 5 commits into from
Nov 21, 2022

Conversation

woodruffw
Copy link
Member

@woodruffw woodruffw commented Nov 18, 2022

See #11296.

This is going to be a relatively complex set of models (thanks to the mixins for shared functionality between "pending" and concrete OIDC providers), so I wanted to get them up and merged before beginning on actual routes/view logic.

Needs unit tests.

Signed-off-by: William Woodruff william@trailofbits.com

Signed-off-by: William Woodruff <william@trailofbits.com>
@woodruffw woodruffw requested a review from a team as a code owner November 18, 2022 22:23
@woodruffw woodruffw self-assigned this Nov 18, 2022
Comment on lines +266 to +273
__table_args__ = (
UniqueConstraint(
"repository_name",
"repository_owner",
"workflow_filename",
name="_github_oidc_provider_uc",
),
)
Copy link
Member Author

Choose a reason for hiding this comment

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

Flagging for review: I had to dupe this UniqueConstraint between GitHubProvider and PendingGitHubProvider, even though they're functionally equivalent, thanks to the unique name requirement. There might be a better way to do this, though.

Copy link
Member

Choose a reason for hiding this comment

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

I think this is due to not having set any naming_conventions for this project in the global metadata setup

metadata = sqlalchemy.MetaData()

Alembic docs go into it here: https://alembic.sqlalchemy.org/en/latest/naming.html

I think we always named them manually, like here:

UniqueConstraint("label", "user_id", name="_user_security_keys_label_uc"),

So it might be a future refactoring to replace the manually-named constraints, but I’d approach that with some serious caution 😉

Signed-off-by: William Woodruff <william@trailofbits.com>
Signed-off-by: William Woodruff <william@trailofbits.com>
@woodruffw woodruffw requested a review from di November 18, 2022 22:50
warehouse/oidc/models.py Outdated Show resolved Hide resolved
Copy link
Member

@di di left a comment

Choose a reason for hiding this comment

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

LGTM overall, just the one comment about what should be duplicated vs. shared via mixins.

@woodruffw
Copy link
Member Author

Should be good to go now!

@di di enabled auto-merge (squash) November 21, 2022 20:45
@di di merged commit ed21864 into pypi:main Nov 21, 2022
@woodruffw woodruffw deleted the tob-pending-oidc-provider-models branch November 21, 2022 23: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.

3 participants