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