Repository navigation
Conversation
Adds a custom CodeQL query (.github/codeql/openssl-return-check.ql) that detects calls to OpenSSL EVP_* functions whose return value is not guarded by the OQS_OPENSSL_GUARD macro. Integrates the query into a new CodeQL workflow (.github/workflows/codeql.yml) that runs on every PR and push to main. The query was originally written by Trail of Bits during their audit of liboqs and reported in issue open-quantum-safe#1867. Closes open-quantum-safe#1867 Signed-off-by: Vishnu Ajith <27vishnu07@gmail.com>
Addresses Scorecard Token-Permissions finding: security-events write permission scoped to codeql job only, not workflow level. Signed-off-by: Vishnu Ajith <27vishnu07@gmail.com>
Replace inline queries: path with a codeql-config.yml config file. The CodeQL init action requires local queries to be referenced via a config file rather than a direct relative path in the queries field. Signed-off-by: Vishnu Ajith <27vishnu07@gmail.com>
The CodeQL cpp extractor pre-finalize script crashes with exit code 134 when the trapCaches/cpp/tarballs directory does not exist on the runner. Disabling TRAP caching avoids the crash. Signed-off-by: Vishnu Ajith <27vishnu07@gmail.com>
Replace config-file approach with inline queries field combining security-and-quality suite with the custom EVP return check query, as suggested by @baentsch. Remove codeql-config.yml. Signed-off-by: Vishnu Ajith <27vishnu07@gmail.com>
Signed-off-by: Vishnu Ajith <27vishnu07@gmail.com>
Adding upload: false to the analyze step prevents the SARIF conflict with GitHub's default CodeQL setup which is enabled on this repo. The query still runs and catches issues but does not upload results. Signed-off-by: Vishnu Ajith <27vishnu07@gmail.com>
Add bad example at .github/codeql/test/openssl-return-check-bad.c to confirm the query catches unchecked EVP_* calls. Document verification steps in CONTRIBUTING.md. Signed-off-by: Vishnu Ajith <27vishnu07@gmail.com>
Signed-off-by: Vishnu Ajith <27vishnu07@gmail.com>
Address the review concerns from open-quantum-safe#2415: - Do not upload results to code scanning, which rejects CodeQL results from other workflows while default setup is enabled. Instead, print each result as an error annotation and fail the job if there are any - Run only liboqs's own queries, since the standard suite already runs via default setup. - Add CodeQL unit tests for each query which run in a seperate job - Analyse a full default build with OpenSSL used for AES, SHA2 and SHA3 - Flag only EVP_* calls whose return value is discarded, since there are other safe ways beyond OQS_OPENSSL_GUARD to check this. - In pr.yml, depend on check-push-result rather than basic-checks and drop `security-events: write`, so the job can be run in forks. The workflow currently reports 119 unchecked EVP_* calls in src/common. These will be fixed separately. Assisted-by: Claude:claude-opus-5.5 Signed-off-by: Owen Waldron <owen.waldron@uwaterloo.ca>
Assited-by: Claude:claude-opus-5.5 Signed-off-by: Owen Waldron <owen.waldron@uwaterloo.ca>
Temporary commit for the fork test run; to be dropped before review. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Owen Waldron <owen.waldron@uwaterloo.ca>
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Demo, not for merge. Shows what a failing run of the CodeQL custom-query workflow (
.github/workflows/codeql.yml) looks like.The branch is the CodeQL workflow rework plus one
TEST ONLYcommit that trimspr.ymlto just the CodeQL job (and skipspush.ymlfor this branch), so no other CI runs.Expected outcome:
CodeQL query unit testspasses.CodeQL custom queriesfails on the existing discardedEVP_*return values insrc/common/sha3/. Every result is listed in the job log; the first 10 also appear as annotations under "Files changed"/the run summary.🤖 Generated with Claude Code