- Notifications
You must be signed in to change notification settings - Fork67
ImplementBannedAPIs
package#909
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Draft
lcartey wants to merge33 commits intomainChoose a base branch fromlcartey/banned-apis
base:main
Could not load branches
Branch not found:{{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline, and old review comments may become outdated.
Draft
Uh oh!
There was an error while loading.Please reload this page.
Conversation
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
Add a query to identify uses of terminating program functions. [a]
Make the results easier to understand by reporting calls inmacro expansions in the macros themselves, if they are definedby the developers of this project.
This header shouldn't exist.
A query for reporting the use of variadic functions. [a]
And remove duplicate definitions
This is not a "real" header - definitions should be in stdint.hand cstdint.
- Replace int aliases with include of stdint.h - Add str/wcs function stubs - Add header guards
Add a query to detect uses of a number of common unsafe stringhandling functions. [a]
This supports accurate detection of usage of banned functions: - Detects both accesses and calls - Reports the macro definition if the use is within a macro defined in the users code. - Otherwise reports the location of the expression.
Use library to avoid duplication.
Add a new query for detecting uses of the banned function `system`. [a]
A new query to report uses of the raw pointer constructors ofthe std::unique_ptr and std::shared_ptr classes. [a]
Add a new query to detect uses of prohibited character handlingfunctions.
Add query for banned locale functions. [a]
Adds a new query to detect use of banned cstring functions. [a]
New query to detect banned uses of the csetjmp header. [a]
Sign up for freeto 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.
Description
This PR implements the BannedAPIs package.
As many of these rules required the detection of banned functions, I've written a library (
BannedFunctions
) to help identify different uses (e.g. calls, accesses etc.), and to aggregate reports in macro definitions.I've also updated quite a few of the C++ stubs (unlike the C stubs, these are all written by hand). I suspect there may be some broken tests - will update the PR after CI/CD has run.
Change request type
.ql
,.qll
,.qls
or unit tests)Rules with added or modified queries
Release change checklist
A change note (development_handbook.md#change-notes) is required for any pull request which modifies:
If you are only adding new rule queries, a change note is not required.
Author: Is a change note required?
🚨🚨🚨
Reviewer: Confirm that format ofshared queries (not the .qll file, the
.ql file that imports it) is valid by running them within VS Code.
Reviewer: Confirm that either a change note is not required or the change note is required and has been added.
Query development review checklist
For PRs that add new queries or modify existing queries, the following checklist should be completed by both the author and reviewer:
Author
As a rule of thumb, predicates specific to the query should take no more than 1 minute, and for simple queries be under 10 seconds. If this is not the case, this should be highlighted and agreed in the code review process.
Reviewer
As a rule of thumb, predicates specific to the query should take no more than 1 minute, and for simple queries be under 10 seconds. If this is not the case, this should be highlighted and agreed in the code review process.