-
-
Notifications
You must be signed in to change notification settings - Fork 934
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
Convert params.permit
to params.expect
#5357
Changes from all commits
9de2788
6be247c
d5c680c
21b38cd
04118ed
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -103,7 +103,7 @@ def verify_session_redirect_path | |
def find_api_key_role | ||
@api_key_role = current_user.oidc_api_key_roles | ||
.includes(:provider) | ||
.find_by!(token: params.permit(:token).require(:token)) | ||
.find_by!(token: params.expect(:token)) | ||
end | ||
|
||
def redirect_for_deleted | ||
|
@@ -113,19 +113,18 @@ def redirect_for_deleted | |
PERMITTED_API_KEY_ROLE_PARAMS = [ | ||
:name, | ||
:oidc_provider_id, | ||
{ | ||
api_key_permissions: [:valid_for, { scopes: [], gems: [] }], | ||
access_policy: { | ||
statements_attributes: [ | ||
:effect, | ||
{ principal: :oidc, conditions_attributes: %i[operator claim value] } | ||
] | ||
} | ||
api_key_permissions: [:valid_for, scopes: [], gems: []], | ||
access_policy: { | ||
statements_attributes: [[ | ||
:effect, | ||
principal: :oidc, | ||
conditions_attributes: [%i[operator claim value]] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hey @segiddins this line doesn't fail any tests either way, but it looks like this is how the code works. I guess we don't pass conditions in a test? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's possible |
||
]] | ||
} | ||
].freeze | ||
|
||
def api_key_role_params | ||
params.permit(oidc_api_key_role: PERMITTED_API_KEY_ROLE_PARAMS).require(:oidc_api_key_role) | ||
params.expect(oidc_api_key_role: PERMITTED_API_KEY_ROLE_PARAMS) | ||
end | ||
|
||
def add_default_params(rubygem, statement, condition) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rubocop side-effect. Not related to this change but necessary to keep lint passing (while also improving how expect syntax is used)