Skip to content

Dbartol/rc/merge #3

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

Open
wants to merge 1,338 commits into
base: dbartol/rc/base
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
1338 commits
Select commit Hold shift + click to select a range
9b877dc
Add an example snippet query
aibaars Aug 4, 2021
df4fb23
Merge pull request #246 from github/aibaars/tweaks
aibaars Aug 17, 2021
e82c21d
Don't include desugared nodes in the printed AST
hmac Aug 17, 2021
a2115f4
Merge pull request #259 from github/hmac-print-ast
hmac Aug 18, 2021
9c17e00
Merge pull request #256 from github/syncRedos
nickrolfe Aug 23, 2021
5e783e4
Implement getPrimaryQlClasses
nickrolfe Aug 24, 2021
41ff10c
extend modelling of ActionController, and start modelling ActionView
alexrford Aug 15, 2021
d628716
extend ActionController tests
alexrford Aug 24, 2021
e403fc7
tests
alexrford Aug 24, 2021
abc283e
remove ErbFile refs
alexrford Aug 24, 2021
289b59d
Bump tree-sitter versions to pick up parsing fixes
nickrolfe Aug 25, 2021
bc06817
Add ERB comment as regression test for parsing bug
nickrolfe Aug 25, 2021
3b0055a
Use published crate for tree-sitter-ruby 0.19
nickrolfe Aug 25, 2021
0bd7e59
Enable dependabot on the Rust projects
hmac Aug 25, 2021
4cbd848
Merge pull request #264 from github/hmac-dependabot
hmac Aug 25, 2021
ffd80fc
Merge pull request #263 from github/bump_ts
nickrolfe Aug 25, 2021
4a4b244
Clean up how we map between Rails actions and default associated temp…
alexrford Aug 25, 2021
ff27a0c
use toUnicode in ReDoSUtil.qll
erik-krogh Aug 26, 2021
4ec30b2
Merge pull request #267 from github/erik-krogh/redosUnicode
nickrolfe Aug 26, 2021
a3ae5bc
improve ActionControllerHelperMethod doc
alexrford Aug 26, 2021
9571e7b
drop ViewComponent parts from the ActionView library
alexrford Aug 26, 2021
42daf5b
Add DB upgrade script check
hvitved Aug 26, 2021
348b12c
Merge pull request #268 from github/hvitved/db-upgrade-pr-check
hvitved Aug 26, 2021
ee6c809
Merge pull request #262 from github/action-view-1
alexrford Aug 26, 2021
17fc6ab
Refactor into separate library and query packs
aibaars Aug 11, 2021
817f874
Fix build
aibaars Aug 11, 2021
0afcb9c
Workaround for compilation failure
aibaars Aug 11, 2021
ac2c315
Fix merge conflicts during rebase
aibaars Aug 11, 2021
56332a6
Ignore `.codeql` output directories
dbartol Aug 25, 2021
eb412fb
Fix PowerShell version of extractor pack script
dbartol Aug 25, 2021
11ad664
Updated pack versions and lock files
dbartol Aug 25, 2021
9d7b774
Use hotfixed version of `codeql/suite-helpers` with workaround for bu…
dbartol Aug 26, 2021
2c1620f
Move missed library file
dbartol Aug 26, 2021
9c03a02
Update lock file for hotfix
dbartol Aug 26, 2021
593f3b6
Fix paths in upgrade script check
dbartol Aug 26, 2021
42629b9
Move initial dbscheme
dbartol Aug 26, 2021
32253aa
Merge pull request #266 from github/dbartol/refactor-packs
aibaars Aug 31, 2021
7f03b87
Drop redundant columns from `files` and `folders` relations
hvitved Aug 12, 2021
652d2a7
DB upgrade script
hvitved Aug 26, 2021
c70407a
Update DB stats
hvitved Aug 26, 2021
60aca01
Merge pull request #254 from github/hvitved/drop-files-folders-columns
aibaars Aug 31, 2021
b9745c8
Bump `codeql` submodule
hvitved Aug 31, 2021
50158b8
Sync shared files
hvitved Aug 31, 2021
4677a08
Adopt shared CFG library
hvitved Aug 12, 2021
eeb68a8
Add `make` target to run tests locally
hvitved Aug 31, 2021
ad66f03
Fix typo in db upgrade script
nickrolfe Aug 31, 2021
d1171e0
Merge pull request #272 from github/fix_upgrade
nickrolfe Aug 31, 2021
2fbbabd
First draft of a jump-to-definition query
hmac Aug 4, 2021
19e135f
Remove redundant imports
hmac Aug 4, 2021
95e2b8a
Simplify jump-to-def query
hmac Aug 4, 2021
a814010
Small refactor to `constantQualifiedName`
hmac Aug 4, 2021
a16cd89
Ignore synthesised reads for jump-to-definition
hmac Aug 5, 2021
e84ebe2
Include instance variables in jump-to-def query
hmac Aug 5, 2021
e72f139
Include class variables in jump-to-def query
hmac Aug 5, 2021
155b385
Simplify LocalVariable constraint in jump-to-def
hmac Aug 5, 2021
8901eba
Include constants in jump-to-def query
hmac Aug 9, 2021
cd3192e
Fix ordering for `definitionOf`
hmac Aug 9, 2021
91d56cd
Use dataflow to find method call targets
hmac Aug 9, 2021
34f02ee
Fix `constantQualifiedName`
hmac Aug 23, 2021
d3f683e
Minor refactor of constantQualifiedName
hmac Aug 23, 2021
3490e32
codeql_ruby -> codeql.ruby
hmac Aug 31, 2021
502ad3f
Merge pull request #247 from github/hmac-jump-to-def
hmac Aug 31, 2021
d84731b
Add a library for working with the ERB AST
alexrford Aug 11, 2021
df9e0df
make strictlyBefore a member predicate on Location
alexrford Aug 31, 2021
20b851a
improve ErbExecutionDirective definition
alexrford Aug 31, 2021
2d08b01
Merge pull request #271 from github/hvitved/cfg/shared
hvitved Aug 31, 2021
d47c8ee
format
alexrford Aug 31, 2021
41e7ef1
add missing pragma back
alexrford Aug 31, 2021
4eaa31d
Add `hasName` predicates
hvitved Sep 1, 2021
89e6c0e
CFG: Model calls that may raise an exception
hvitved Sep 1, 2021
701eab7
Merge pull request #273 from github/hvitved/has-name
hvitved Sep 1, 2021
031a73f
Add API graph test that exhibits a missing edge
hvitved Sep 1, 2021
ae70af0
API graphs: Fix bug for resolvable modules
hvitved Sep 1, 2021
03e91a2
API graphs: Performance fixes
hvitved Sep 1, 2021
6e23a9a
Merge pull request #275 from github/hvitved/api-graphs-fix
hvitved Sep 1, 2021
c176d34
Merge pull request #274 from github/hvitved/cfg/may-raise
hvitved Sep 1, 2021
2d0febe
Fix typo in comment
hvitved Sep 2, 2021
b8ec5d7
Merge pull request #276 from github/hvitved/api-graphs-comment-typo
hvitved Sep 2, 2021
ab4cc75
Revert "Use hotfixed version of `codeql/suite-helpers` with workaroun…
aibaars Sep 2, 2021
8607377
Merge pull request #249 from github/erb-lib
alexrford Sep 2, 2021
d62b41b
Add query for polynomial ReDoS
nickrolfe Aug 26, 2021
cbe2366
Rename exponential ReDoS test directory
nickrolfe Sep 2, 2021
47e5a8f
Add test for polynomial ReDoS query
nickrolfe Sep 2, 2021
bc85a1b
Add LICENSE file
turbo Sep 3, 2021
799c0ff
Merge pull request #281 from github/add-license
calumgrant Sep 3, 2021
8725303
Add a query for URL redirect vulnerabilities
hmac Aug 23, 2021
12c1f43
Create CODE_OF_CONDUCT.md
turbo Sep 3, 2021
36d5fda
Merge pull request #260 from github/hmac-url-redirect
hmac Sep 3, 2021
51d729a
Merge pull request #282 from github/add-coc
calumgrant Sep 3, 2021
9b3b9a7
Move `instanceof` check from charpred in `CfgScope`
hvitved Sep 6, 2021
3594794
Use `instanceof` base classes in range patterns
hvitved Sep 6, 2021
060060b
Merge remote-tracking branch 'origin/main' into getPrimaryQlClasses
nickrolfe Sep 6, 2021
8ce7fdc
Merge pull request #284 from github/hvitved/instanceof-test
hvitved Sep 7, 2021
8fbe5c0
Merge pull request #261 from github/getPrimaryQlClasses
nickrolfe Sep 7, 2021
4d5928a
Add @security-severity tag
nickrolfe Sep 7, 2021
7666d85
Merge remote-tracking branch 'origin/main' into polynomial_redos
nickrolfe Sep 7, 2021
414362d
Rename .qll to match our naming scheme for other dataflow queries.
nickrolfe Sep 7, 2021
a62aa2b
Merge pull request #269 from github/polynomial_redos
nickrolfe Sep 7, 2021
adceb0a
Add query rb/unsafe-deserialization
nickrolfe Sep 7, 2021
9b9fc18
Add taint step for Base64.decode64
nickrolfe Sep 8, 2021
760dbd7
Add test for rb/unsafe-deserialization
nickrolfe Sep 8, 2021
2ddca2c
Document and test YAML.safe_load
nickrolfe Sep 8, 2021
b4c2942
Make barrier guards more specific
hmac Sep 9, 2021
6dbf6d7
Merge pull request #278 from github/aibaars/revert-hotfix
nickrolfe Sep 9, 2021
cf72bad
Fix 'unused borrow that must be used' warnings.
nickrolfe Sep 9, 2021
b51e741
Merge pull request #289 from github/rust_warnings
nickrolfe Sep 9, 2021
5698356
Update ReDoS length guard
hmac Sep 10, 2021
8f36b0d
Simplify guard in SQL injection tests
hmac Sep 10, 2021
800e183
Add != to StringConstCompare
hmac Sep 10, 2021
6f32401
Add `unless x !=` test to barrier guards
hmac Sep 13, 2021
c2ec640
Add AlertSuppression.ql
aibaars Sep 14, 2021
4763312
Merge `ConditionBlock` and `BarrierGuard`
hmac Sep 14, 2021
8ac3dc2
Speedup `RegExp::multiples`
hvitved Sep 14, 2021
f4e2c30
Merge pull request #291 from github/hvitved/regexp-multiples
hvitved Sep 14, 2021
e03fe0f
Add ClassifyFiles.ql
aibaars Sep 14, 2021
12723f0
Merge pull request #288 from github/hmac-barrier-guard-checks
hmac Sep 14, 2021
ebf23d0
Don't parse \A and \Z as RegExpConstant
nickrolfe Sep 14, 2021
ec13133
Automatically extract .gemspec and Gemfile files
nickrolfe Sep 10, 2021
961674e
Update expected output now we extract the Gemfile
nickrolfe Sep 14, 2021
9e67382
Bump `codeql` submodule
hvitved Sep 15, 2021
d3a1d0a
Merge pull request #294 from github/bump-codeql
hvitved Sep 15, 2021
d71dd3f
rb/reflected-xss
alexrford Aug 15, 2021
dbb239b
reorder and format rb/reflected-xss qhelp
alexrford Sep 2, 2021
b264a05
Update ql/lib/codeql/ruby/security/ReflectedXSSCustomizations.qll
alexrford Sep 7, 2021
3430a46
fix some local variable mappings between view and controller
alexrford Sep 7, 2021
b993723
remove spurious ivar -> locals hash mapping (actionview/controller)
alexrford Sep 7, 2021
3445a6a
fix flow steps from controller instance var assignement to view read …
alexrford Sep 7, 2021
76864a8
remove an incorrect test case
alexrford Sep 7, 2021
205b141
format
alexrford Sep 7, 2021
eed87b3
Apply suggestions from code review
alexrford Sep 8, 2021
ed708c1
Update ql/src/queries/security/cwe-079/ReflectedXSS.qhelp
alexrford Sep 8, 2021
0689e60
make a type more specific
alexrford Sep 8, 2021
98fd0e1
Update ql/src/queries/security/cwe-079/ReflectedXSS.qhelp
alexrford Sep 8, 2021
2e65f9b
update some comments referencing view components
alexrford Sep 8, 2021
200c8f2
Add some HTMLEscaping implementations for Rails
alexrford Sep 8, 2021
6cc82d4
Fix LinkToCallArgumentAsSink matching when link_to is passed a block
alexrford Sep 8, 2021
5cfefb1
Add some more test cases for rb/reflected-xss
alexrford Sep 8, 2021
50b0bb8
Restrict rb/reflected-xss instance variable taint edges
alexrford Sep 8, 2021
35da921
format
alexrford Sep 8, 2021
e80faa0
Fix rb/reflected-xss flow from helper method return values
alexrford Sep 13, 2021
773291e
Put exprNodeReturnedFrom predicate in DataFlowDispatch.qll
alexrford Sep 15, 2021
e89d485
update test output (subpaths)
alexrford Sep 15, 2021
fd04baa
No longer create redundant `numlines` relation
hvitved Sep 16, 2021
464b502
DB upgrade script
hvitved Sep 16, 2021
1fd91ab
Merge pull request #295 from github/hvitved/remove-numlines
hvitved Sep 16, 2021
3d23575
Merge pull request #292 from github/regexp_slash_az
nickrolfe Sep 17, 2021
3c05101
Merge pull request #290 from github/extract_gemfile
nickrolfe Sep 17, 2021
a8f0bce
Add SystemCommandExecution concept
hmac Aug 25, 2021
8440fe2
Add CommandInjection dataflow config
hmac Sep 1, 2021
4a0d7c5
Add top-level CLI injection query and tests
hmac Sep 2, 2021
fe8fc06
Add qhelp for CLI Injection query
hmac Sep 3, 2021
8f65d78
Add Shellwords.escape as CLI injection sanitizer
hmac Sep 3, 2021
4ecc78e
Kernel#system -> Kernel.system
hmac Sep 3, 2021
799ef4e
Add barrier guards for CLI injection
hmac Sep 3, 2021
fb23a2e
Add SubshellHeredocExecution
hmac Sep 7, 2021
cbc14cc
Make KernelSystemCall more specific
hmac Sep 7, 2021
174ba25
Update SystemCommandExecution to new pattern
hmac Sep 7, 2021
d046fb0
Separate open3 pipeline methods
hmac Sep 8, 2021
c8e9a59
Update CLI injection tests
hmac Sep 8, 2021
f835976
Exclude non-shell interpreted args
hmac Sep 9, 2021
599dc28
Add another test for shell interpretation
hmac Sep 13, 2021
64a8ced
Generalise the concept of a Kernel method call
hmac Sep 14, 2021
739661e
Test that KernelMethodCall is specific enough
hmac Sep 14, 2021
36289aa
Merge pull request #255 from github/reflected-xss
alexrford Sep 17, 2021
58d0671
Extract a special empty location
hvitved Sep 16, 2021
b2d0c60
Replace `hasLocationInfo` with `getLocation` in `API::Node`
hvitved Sep 16, 2021
916b844
Merge pull request #280 from github/hmac-cli-injection
hmac Sep 20, 2021
95e50ce
Add query for Code Injection
hmac Sep 14, 2021
1393dc9
Update extractor/src/main.rs
hvitved Sep 20, 2021
4bfbf62
Merge pull request #296 from github/hvitved/empty-location
hvitved Sep 20, 2021
0936c4c
Fix trap extension for source files without extensions
nickrolfe Sep 20, 2021
c30c7b3
Replace `if let` with `match`.
nickrolfe Sep 20, 2021
e201dae
Add two 'composite' actions for reusing logic
hvitved Sep 20, 2021
8af12a1
Merge pull request #298 from github/trap_extension
nickrolfe Sep 20, 2021
6f7d4fe
Merge pull request #287 from github/unsafe-deserialization
nickrolfe Sep 20, 2021
8aaabe8
Merge pull request #299 from github/hvitved/actions-reuse
hvitved Sep 20, 2021
d27f8a6
Add empty subpaths section to expected test output
nickrolfe Sep 20, 2021
c183e05
Merge pull request #300 from github/fix_tests
nickrolfe Sep 20, 2021
143256e
Fix filenames in source archives
nickrolfe Sep 20, 2021
6f05963
Remove idx column from tokeninfo tables.
nickrolfe Sep 20, 2021
6a17dfd
Remove file column from tokeninfo tables.
nickrolfe Sep 20, 2021
e97adff
Add upgrade script to remove unused tokeninfo columns
nickrolfe Sep 20, 2021
3201f30
Update dbscheme stats
nickrolfe Sep 20, 2021
08dc6d7
Add support for flow summaries
hvitved Aug 25, 2021
564c76c
Address review comments
hvitved Sep 21, 2021
cdc3595
Resolve semantic conflicts after rebase
hvitved Sep 21, 2021
237a7d3
C++: Exclusion rules for system macros
jbj Sep 21, 2021
d60410e
Use integer comparisons instead of strings when scanning ERB files
nickrolfe Sep 21, 2021
a055c86
C++: change note
jbj Sep 21, 2021
dd31473
Merge pull request #301 from github/fix_source_archive
nickrolfe Sep 21, 2021
25300cb
start modelling some file access concepts
alexrford Sep 1, 2021
d1f2258
revamp weak file permissions query
alexrford Sep 3, 2021
6315621
use instanceof extensions for some filesystem concepts
alexrford Sep 6, 2021
05a04f4
Files.qll library implementation
alexrford Sep 21, 2021
70c2be8
Files library tests
alexrford Sep 21, 2021
888183f
Desugar array literals to `::Array.[]`
hvitved Sep 21, 2021
a37737d
Replace `string kind` with `boolean preservesValue`
hvitved Sep 22, 2021
e670fdb
Move two predicates in `FlowSummaryImplSpecific.qll`
hvitved Sep 22, 2021
0092c02
Apply suggestions from code review
alexrford Sep 22, 2021
b769aa6
test for IO.open as a way of creating an IO instance
alexrford Sep 22, 2021
21e31a4
Merge pull request #283 from github/file-system-sources
alexrford Sep 22, 2021
2bdea01
Add HTTP::Client concept
hmac Sep 21, 2021
3000587
Add Net::HTTP request modelling
hmac Sep 21, 2021
b658bac
Simplify Net::HTTP modelling
hmac Sep 22, 2021
5826f2c
Move Net::HTTP modelling into http_clients module
hmac Sep 22, 2021
83705c5
Merge pull request #306 from github/hmac-outgoing-http
hmac Sep 23, 2021
68d41f9
Address review comments
hvitved Sep 23, 2021
41608ef
Address review comments
hmac Sep 23, 2021
f347505
Merge pull request #277 from github/hvitved/flow-summaries
hvitved Sep 23, 2021
4f9518a
Merge pull request #293 from github/hmac-code-injection
hmac Sep 23, 2021
40f0112
Merge pull request #297 from github/aibaars/alert-suppression
aibaars Sep 23, 2021
ca2ff9a
Merge pull request #305 from github/hvitved/desugar/array-literals
hvitved Sep 23, 2021
ee51298
Model the Excon HTTP client
hmac Sep 22, 2021
4cf520c
Model the Faraday HTTP client
hmac Sep 22, 2021
88885a2
Model the RestClient HTTP client
hmac Sep 23, 2021
edfdfb1
Make `{Unary,Binary}Operation` a sub class of `MethodCall`
hvitved Sep 22, 2021
30d2df5
Include `MethodCall.getAChild` in `{Unary,Binary}Operation.getAChild`
hvitved Sep 24, 2021
141f5f7
Merge pull request #308 from github/hvitved/operation-method-call
hvitved Sep 24, 2021
74982cb
Merge pull request #307 from github/hmac-outgoing-http-2
hmac Sep 24, 2021
793368d
More uses of `instanceof` in the external/internal AST layer
hvitved Sep 24, 2021
3e100bc
Remove unicode character from doc string
hmac Sep 27, 2021
2a4747b
Merge pull request #313 from github/hmac-remove-unicode-char
aibaars Sep 27, 2021
317303c
Strengthen the type of `SetterMethodCall`
hvitved Sep 27, 2021
b2c4dae
Merge pull request #303 from github/nickrolfe/node_kind_id
nickrolfe Sep 27, 2021
79c2f09
Merge pull request #302 from github/rm_tokeninfo_idx
nickrolfe Sep 27, 2021
8018c15
Merge pull request #314 from github/hvitved/setter-method-call-base
hvitved Sep 27, 2021
5219b1a
Merge pull request #310 from github/hvitved/more-instanceof
hvitved Sep 27, 2021
10d19bf
Temporarily disable operation call resolution
hvitved Sep 29, 2021
3a270ab
Fix `hasLocationInfo` URL reference
RasmusWL Sep 29, 2021
c69762b
Merge pull request #317 from github/hvitved/disable-operation-resolution
hvitved Sep 29, 2021
1d58f8c
Merge pull request #320 from github/rasmuswl/fix-hasLocationInfo-url
nickrolfe Sep 29, 2021
4c6f4ef
Revert "C++: change note" and "C++: Exclusion rules for system macros"
geoffw0 Oct 6, 2021
91b2ee2
Merge pull request #6822 from github/lgtm.com
dbartol Oct 6, 2021
b9ede18
Docs: Add Ruby to query help pages
shati-patel Oct 18, 2021
702c647
Merge pull request #6904 from shati-patel/ruby-query-help
shati-patel Oct 18, 2021
ba32c54
Move files to ruby subfolder
aibaars Oct 25, 2021
d2ea732
Remove CodeSpaces configuration
aibaars Oct 14, 2021
068beef
Move create-extractor-pack Action
aibaars Oct 14, 2021
2de7573
Update Ruby workflows
aibaars Oct 14, 2021
3554e8d
Drop LICENSE and CODE_OF_CONDUCT.md
aibaars Oct 14, 2021
8ce7b28
Update dependabot config
aibaars Oct 14, 2021
7741a72
Merge remote-tracking branch 'codeql-ruby/rc/3.3' into codeql/rc/3.3
aibaars Oct 25, 2021
aeb9ace
Add ruby to CODEOWNERS
aibaars Oct 14, 2021
ddbba40
Update CodeSpaces configuration
aibaars Oct 14, 2021
1bf4542
Remove github/codeql submodule
aibaars Oct 15, 2021
de38570
Merge identical-files.json
aibaars Oct 14, 2021
b23b3c3
Add a queries.xml file (for CWE coverage) docs
shati-patel Oct 15, 2021
8cd86ae
Move queries.xml to `src`
shati-patel Oct 18, 2021
b79f8f1
Fix CI jobs
aibaars Oct 25, 2021
015fb81
Merge b79f8f18901e5ba5b67db1e28ad53300e2d05e9c into 702c6475565382ecd…
aibaars Oct 25, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 2 additions & 1 deletion .codeqlmanifest.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{ "provide": [ "*/ql/src/qlpack.yml",
{ "provide": [ "ruby/.codeqlmanifest.json",
"*/ql/src/qlpack.yml",
"*/ql/lib/qlpack.yml",
"*/ql/test/qlpack.yml",
"cpp/ql/test/query-tests/Security/CWE/CWE-190/semmle/tainted/qlpack.yml",
Expand Down
5 changes: 5 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
{
"extensions": [
"rust-lang.rust",
"bungcip.better-toml",
"github.vscode-codeql",
"slevesque.vscode-zipexplorer"
],
"settings": {
"files.watcherExclude": {
"**/target/**": true
},
"codeQL.runningQueries.memory": 2048
}
}
14 changes: 14 additions & 0 deletions .github/actions/fetch-codeql/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Fetch CodeQL
description: Fetches the latest version of CodeQL
runs:
using: composite
steps:
- name: Fetch CodeQL
shell: bash
run: |
LATEST=$(gh release list --repo https://github.com/github/codeql-cli-binaries | cut -f 1 | grep -v beta | sort --version-sort | tail -1)
gh release download --repo https://github.com/github/codeql-cli-binaries --pattern codeql-linux64.zip "$LATEST"
unzip -q codeql-linux64.zip
echo "${{ github.workspace }}/codeql" >> $GITHUB_PATH
env:
GITHUB_TOKEN: ${{ github.token }}
18 changes: 18 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: 2
updates:
- package-ecosystem: "cargo"
directory: "ruby/node-types"
schedule:
interval: "daily"
- package-ecosystem: "cargo"
directory: "ruby/generator"
schedule:
interval: "daily"
- package-ecosystem: "cargo"
directory: "ruby/extractor"
schedule:
interval: "daily"
- package-ecosystem: "cargo"
directory: "ruby/autobuilder"
schedule:
interval: "daily"
39 changes: 39 additions & 0 deletions .github/workflows/qhelp-pr-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Query help preview

on:
pull_request:
branches:
- main
- 'rc/*'
paths:
- "ruby/**/*.qhelp"

jobs:
qhelp:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Determine changed files
id: changes
run: |
echo -n "::set-output name=qhelp_files::"
(git diff --name-only --diff-filter=ACMRT HEAD~1 HEAD | grep .qhelp$ | grep -v .inc.qhelp;
git diff --name-only --diff-filter=ACMRT HEAD~1 HEAD | grep .inc.qhelp$ | xargs -d '\n' -rn1 basename | xargs -d '\n' -rn1 git grep -l) |
sort -u | xargs -d '\n' -n1 printf "'%s' "

- uses: ./.github/actions/fetch-codeql

- name: QHelp preview
if: ${{ steps.changes.outputs.qhelp_files }}
run: |
( echo "QHelp previews:";
for path in ${{ steps.changes.outputs.qhelp_files }} ; do
echo "<details> <summary>${path}</summary>"
echo
codeql generate query-help --format=markdown ${path}
echo "</details>"
done) | gh pr comment "${{ github.event.pull_request.number }}" -F -
env:
GITHUB_TOKEN: ${{ github.token }}
232 changes: 232 additions & 0 deletions .github/workflows/ruby-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,232 @@
name: "Ruby: Build"

on:
push:
paths:
- 'ruby/**'
branches:
- main
- 'rc/*'
pull_request:
paths:
- 'ruby/**'
branches:
- main
- 'rc/*'
workflow_dispatch:
inputs:
tag:
description: "Version tag to create"
required: false

env:
CARGO_TERM_COLOR: always

defaults:
run:
working-directory: ruby

jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
- name: Install GNU tar
if: runner.os == 'macOS'
run: |
brew install gnu-tar
echo "/usr/local/opt/gnu-tar/libexec/gnubin" >> $GITHUB_PATH
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
ruby/target
key: ${{ runner.os }}-rust-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Check formatting
run: cargo fmt --all -- --check
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
- name: Release build
run: cargo build --release
- name: Generate dbscheme
if: ${{ matrix.os == 'ubuntu-latest' }}
run: target/release/ruby-generator --dbscheme ql/lib/ruby.dbscheme --library ql/lib/codeql/ruby/ast/internal/TreeSitter.qll
- uses: actions/upload-artifact@v2
if: ${{ matrix.os == 'ubuntu-latest' }}
with:
name: ruby.dbscheme
path: ruby/ql/lib/ruby.dbscheme
- uses: actions/upload-artifact@v2
if: ${{ matrix.os == 'ubuntu-latest' }}
with:
name: TreeSitter.qll
path: ruby/ql/lib/codeql/ruby/ast/internal/TreeSitter.qll
- uses: actions/upload-artifact@v2
with:
name: extractor-${{ matrix.os }}
path: |
ruby/target/release/ruby-autobuilder
ruby/target/release/ruby-autobuilder.exe
ruby/target/release/ruby-extractor
ruby/target/release/ruby-extractor.exe
retention-days: 1
compile-queries:
runs-on: ubuntu-latest
env:
CODEQL_THREADS: 4 # TODO: remove this once it's set by the CLI
steps:
- uses: actions/checkout@v2
- name: Fetch CodeQL
run: |
LATEST=$(gh release list --repo https://github.com/github/codeql-cli-binaries | cut -f 1 | grep -v beta | sort --version-sort | tail -1)
gh release download --repo https://github.com/github/codeql-cli-binaries --pattern codeql-linux64.zip "$LATEST"
unzip -q codeql-linux64.zip
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Build Query Pack
run: |
codeql/codeql pack create ql/lib --output target/packs
codeql/codeql pack install ql/src
codeql/codeql pack create ql/src --output target/packs
PACK_FOLDER=$(readlink -f target/packs/codeql/ruby-queries/*)
codeql/codeql generate query-help --format=sarifv2.1.0 --output="${PACK_FOLDER}/rules.sarif" ql/src
(cd ql/src; find queries \( -name '*.qhelp' -o -name '*.rb' -o -name '*.erb' \) -exec bash -c 'mkdir -p "'"${PACK_FOLDER}"'/$(dirname "{}")"' \; -exec cp "{}" "${PACK_FOLDER}/{}" \;)
- name: Compile with previous CodeQL versions
run: |
for version in $(gh release list --repo https://github.com/github/codeql-cli-binaries | cut -f 1 | sort --version-sort | tail -3 | head -2); do
rm -f codeql-linux64.zip
gh release download --repo https://github.com/github/codeql-cli-binaries --pattern codeql-linux64.zip "$version"
rm -rf codeql; unzip -q codeql-linux64.zip
codeql/codeql query compile target/packs/*
done
env:
GITHUB_TOKEN: ${{ github.token }}
- uses: actions/upload-artifact@v2
with:
name: codeql-ruby-queries
path: |
ruby/target/packs/*
retention-days: 1

package:
runs-on: ubuntu-latest
needs: [build, compile-queries]
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
name: ruby.dbscheme
path: ruby/ruby
- uses: actions/download-artifact@v2
with:
name: extractor-ubuntu-latest
path: ruby/linux64
- uses: actions/download-artifact@v2
with:
name: extractor-windows-latest
path: ruby/win64
- uses: actions/download-artifact@v2
with:
name: extractor-macos-latest
path: ruby/osx64
- run: |
mkdir -p ruby
cp -r codeql-extractor.yml tools ql/lib/ruby.dbscheme.stats ruby/
mkdir -p ruby/tools/{linux64,osx64,win64}
cp linux64/ruby-autobuilder ruby/tools/linux64/autobuilder
cp osx64/ruby-autobuilder ruby/tools/osx64/autobuilder
cp win64/ruby-autobuilder.exe ruby/tools/win64/autobuilder.exe
cp linux64/ruby-extractor ruby/tools/linux64/extractor
cp osx64/ruby-extractor ruby/tools/osx64/extractor
cp win64/ruby-extractor.exe ruby/tools/win64/extractor.exe
chmod +x ruby/tools/{linux64,osx64}/{autobuilder,extractor}
zip -rq codeql-ruby.zip ruby
- uses: actions/upload-artifact@v2
with:
name: codeql-ruby-pack
path: ruby/codeql-ruby.zip
retention-days: 1
- uses: actions/download-artifact@v2
with:
name: codeql-ruby-queries
path: ruby/qlpacks
- run: |
echo '{
"provide": [
"ruby/codeql-extractor.yml",
"qlpacks/*/*/*/qlpack.yml"
]
}' > .codeqlmanifest.json
zip -rq codeql-ruby-bundle.zip .codeqlmanifest.json ruby qlpacks
- uses: actions/upload-artifact@v2
with:
name: codeql-ruby-bundle
path: ruby/codeql-ruby-bundle.zip
retention-days: 1

test:
defaults:
run:
working-directory: ${{ github.workspace }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]

runs-on: ${{ matrix.os }}
needs: [package]
steps:
- uses: actions/checkout@v2
with:
repository: Shopify/example-ruby-app
ref: 67a0decc5eb550f3a9228eda53925c3afd40dfe9
- name: Fetch CodeQL
shell: bash
run: |
LATEST=$(gh release list --repo https://github.com/github/codeql-cli-binaries | cut -f 1 | grep -v beta | sort --version-sort | tail -1)
gh release download --repo https://github.com/github/codeql-cli-binaries --pattern codeql.zip "$LATEST"
unzip -q codeql.zip
env:
GITHUB_TOKEN: ${{ github.token }}
working-directory: ${{ runner.temp }}
- name: Download Ruby bundle
uses: actions/download-artifact@v2
with:
name: codeql-ruby-bundle
path: ${{ runner.temp }}
- name: Unzip Ruby bundle
shell: bash
run: unzip -q -d "${{ runner.temp }}/ruby-bundle" "${{ runner.temp }}/codeql-ruby-bundle.zip"
- name: Prepare test files
shell: bash
run: |
echo "import ruby select count(File f)" > "test.ql"
echo "| 4 |" > "test.expected"
echo 'name: sample-tests
version: 0.0.0
dependencies:
codeql/ruby-all: 0.0.1
extractor: ruby
tests: .
' > qlpack.yml
- name: Run QL test
shell: bash
run: |
"${{ runner.temp }}/codeql/codeql" test run --search-path "${{ runner.temp }}/ruby-bundle" --additional-packs "${{ runner.temp }}/ruby-bundle" .
- name: Create database
shell: bash
run: |
"${{ runner.temp }}/codeql/codeql" database create --search-path "${{ runner.temp }}/ruby-bundle" --language ruby --source-root . ../database
- name: Analyze database
shell: bash
run: |
"${{ runner.temp }}/codeql/codeql" database analyze --search-path "${{ runner.temp }}/ruby-bundle" --format=sarifv2.1.0 --output=out.sarif ../database ruby-code-scanning.qls
Loading