Skip to content

TEST ONLY: CodeQL enforce OpenSSL return code check - #2499

Closed
xuganyu96 wants to merge 10 commits into
mainfrom
ci/codeql-openssl-return-check
Closed

xuganyu96 wants to merge 10 commits into
mainfrom
ci/codeql-openssl-return-check

Conversation

@xuganyu96

Copy link
Copy Markdown
Contributor

This is a duplicate of #2415. This is for testing purpose only and will not be merged.

#2415 was raised on a fork, which is probably why the CodeQL analysis result was not uploaded to Code Scanning.

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 #1867.

Closes #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>
Signed-off-by: Ganyu (Bruce) Xu <g66xu@uwaterloo.ca>
@github-advanced-security

Copy link
Copy Markdown
Contributor

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

@xuganyu96 xuganyu96 closed this Jul 20, 2026
@xuganyu96
xuganyu96 deleted the ci/codeql-openssl-return-check branch July 20, 2026 20:00
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