-
Notifications
You must be signed in to change notification settings - Fork 649
Allow to skip signature verification #741
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
base: master
Are you sure you want to change the base?
Conversation
43a6658
to
e276dfc
Compare
This reverts commit e276dfc.
d79e580
to
47bd3ec
Compare
47bd3ec
to
e6a1849
Compare
* This can be useful in scenarios such as when you're in the process of updating | ||
* the channel secret and need to temporarily bypass verification to avoid disruptions. | ||
*/ | ||
public $skipSignatureValidation; |
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.
Are you using a callable instead of a bool so that the user can dynamically skip validation? If so, it might be helpful to mention that briefly in the PHPDoc.
class EventRequestOptions | ||
{ | ||
/** | ||
* @var callable|null Function that returns boolean to determine if signature validation should be skipped. |
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.
It might be a good idea to explicitly specify that it returns a bool.
* @var callable|null Function that returns boolean to determine if signature validation should be skipped. | |
* @var callable(): bool|null Function that returns boolean to determine if signature validation should be skipped. |
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.
Thank you for the suggestion!
Yes, the intention is to allow dynamic control — the callable can return a boolean value to determine whether signature validation should be skipped.
However, we had to simplify the PHPDoc type to callable|null instead of callable(): bool|null, because phpDocumentor 3.x currently doesn’t support the newer callable syntax with return types.
To avoid breaking the documentation build, we decided to keep the simpler type declaration.
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.
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.
and more, this is probably (callable(): bool)|null
...?
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.
or null|callable(): bool
?
/** | ||
* Constructor | ||
* | ||
* @param callable|null $skipSignatureValidation Function that returns boolean to determine if signature validation should be skipped |
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.
ditto
* @param callable|null $skipSignatureValidation Function that returns boolean to determine if signature validation should be skipped | |
* @param callable(): bool|null $skipSignatureValidation Function that returns boolean to determine if signature validation should be skipped |
echo "DIFF_IS_EMPTY=$([[ -z "$diff_excluding_submodule" ]] && echo 'true' || echo 'false')" >> $GITHUB_ENV | ||
echo "CURRENT_DATETIME=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_ENV | ||
# Save full diff to file and upload artifact |
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.
I recognize this as a workaround, but do you encounter a diff when executing the steps written in the workflow locally?
line-bot-sdk-php/.github/workflows/generate-code.yml
Lines 33 to 57 in e6a1849
# Install openapi-generator-cli | |
- run: echo "OPENAPI_GENERATOR_VERSION=7.11.0" >> $GITHUB_ENV | |
- uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 | |
id: openapi-generator-cache | |
env: | |
cache-name: openapi-generator-cache | |
with: | |
path: ~/bin/openapitools | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.OPENAPI_GENERATOR_VERSION }} | |
- if: steps.openapi-generator-cache.outputs.cache-hit != 'true' | |
run: | | |
mkdir -p ~/bin/openapitools | |
curl https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/bin/utils/openapi-generator-cli.sh > ~/bin/openapitools/openapi-generator-cli | |
chmod u+x ~/bin/openapitools/openapi-generator-cli | |
export PATH=$PATH:~/bin/openapitools/ | |
OPENAPI_GENERATOR_VERSION=${{ env.OPENAPI_GENERATOR_VERSION }} openapi-generator-cli version | |
- name: Generate codes | |
run: | | |
export PATH=$PATH:~/bin/openapitools/ | |
bash tools/gen-oas-client.sh | |
- name: Update document | |
run: | | |
wget https://github.com/phpDocumentor/phpDocumentor/releases/download/v3.3.1/phpDocumentor.phar | |
php phpDocumentor.phar run -d src -t docs |
If so, this might confuse external contributors too like you, and we should consider measures to ensure stricter version control. For example, https://github.com/line/line-bot-sdk-php/blob/master/CONTRIBUTING.md should be updated.
.... However, since CI provides stable results, could it be that your local version is misaligned...?
@eucyt might help you when you're confused with something.
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.
It seems the PHP version I was running locally was outdated. The issue is now resolved, but I plan to keep this change for future troubleshooting.
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.
we're waiting response! #741 (comment)
Changes
Motivation
The signature returned with webhooks is calculated using a single channel secret. If the bot owner changes their channel secret, the signature for webhooks starts being calculated using the new channel secret. To avoid signature verification failures, the bot owner must update the channel secret on their server, which is used for signature verification. However, if there is a timing mismatch in the update—and such a mismatch is almost unavoidable—verification will fail during that period.
In such cases, having an option to skip signature verification for webhooks would be a convenient way to avoid these issues.