authorization_code_grant_access_token_lifespan cannot be nil
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 7
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
Preflight checklist
- I could not find a solution in the existing issues, docs, nor discussions.
- I agree to follow this project's Code of Conduct.
- I have read and am following this repository's Contribution Guidelines.
- I have joined the Ory Community Slack.
- I am signed up to the Ory Security Patch Newsletter.
Ory Network Project
No response
Describe the bug
Please revert back custom attribute writer methods for OAuth2Client. If records already exist cannot update and recieve ArgumentError: authorization_code_grant_access_token_lifespan cannot be nil. Those attributes are optional and new implementation is wrong when they are nil:
def authorization_code_grant_access_token_lifespan=(authorization_code_grant_access_token_lifespan)
if authorization_code_grant_access_token_lifespan.nil?
fail ArgumentError, 'authorization_code_grant_access_token_lifespan cannot be nil'
end
pattern = Regexp.new(/^([0-9]+(ns|us|ms|s|m|h))*$/)
if authorization_code_grant_access_token_lifespan !~ pattern
fail ArgumentError, "invalid value for \"authorization_code_grant_access_token_lifespan\", must conform to the pattern #{pattern}."
end
@authorization_code_grant_access_token_lifespan = authorization_code_grant_access_token_lifespan
end
The correct implementation from version 2.2.0:
# Custom attribute writer method with validation
# @param [Object] authorization_code_grant_access_token_lifespan Value to be assigned
def authorization_code_grant_access_token_lifespan=(authorization_code_grant_access_token_lifespan)
pattern = Regexp.new(/^([0-9]+(ns|us|ms|s|m|h))*$/)
if !authorization_code_grant_access_token_lifespan.nil? && authorization_code_grant_access_token_lifespan !~ pattern
fail ArgumentError, "invalid value for \"authorization_code_grant_access_token_lifespan\", must conform to the pattern #{pattern}."
end
@authorization_code_grant_access_token_lifespan = authorization_code_grant_access_token_lifespan
end
Reproducing the bug
Make Api request set_o_auth2_client for an existing record
Relevant log output
No response
Relevant configuration
No response
Version
2.2.1
On which operating system are you observing this issue?
macOS
In which environment are you deploying?
Docker
Additional Context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the OAuth2Client custom attribute writer for authorization_code_grant_access_token_lifespan and compare it with the version 2.2.0 implementation shown in the issue. Reproduce the existing-record set_o_auth2_client request, then verify that nil is accepted while non-nil invalid values are still rejected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- api
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100