Skip to content

Commit cac43f2

Browse files
authored
Merge pull request #219 from advanced-security/v0_5_0
v0.5.0
2 parents 76f94f6 + 3bdf5fd commit cac43f2

File tree

15 files changed

+223
-144
lines changed

15 files changed

+223
-144
lines changed

.all-contributorsrc

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,15 @@
5656
"design",
5757
"ideas"
5858
]
59+
},
60+
{
61+
"login": "ViktorLindstrm",
62+
"name": "Viktor Lindström",
63+
"avatar_url": "https://avatars.githubusercontent.com/u/3715582?v=4",
64+
"profile": "https://github.com/ViktorLindstrm",
65+
"contributions": [
66+
"code"
67+
]
5968
}
6069
]
61-
}
70+
}

.github/CODEOWNERS

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
# This project is maintained with love by:
1+
# This project is maintained with love by
22

3-
- @geekmasher
3+
- @advanced-security/oss-maintainers

.github/action/src/codeql.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import * as github from "@actions/github";
77
import * as toolrunner from "@actions/exec/lib/toolrunner";
88

99
export const EXTRACTOR_REPOSITORY = "advanced-security/codeql-extractor-iac";
10-
export const EXTRACTOR_VERSION = "v0.4.1"; // stable version
10+
export const EXTRACTOR_VERSION = "v0.5.0"; // stable version
1111

1212
export interface CodeQLConfig {
1313
// The path to the codeql bundle.

.github/dependabot.yml

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,38 @@
55

66
version: 2
77
updates:
8-
- package-ecosystem: "cargo"
8+
- package-ecosystem: "github-actions"
99
directory: "/"
1010
schedule:
1111
interval: "weekly"
1212
reviewers:
13-
- "geekmasher"
13+
- "advanced-security/oss-maintainers"
14+
target-branch: "main"
15+
commit-message:
16+
prefix: deps
17+
prefix-development: chore
18+
labels:
19+
- "Dependencies"
1420
groups:
15-
extractor:
21+
production-dependencies:
1622
dependency-type: "production"
23+
development-dependencies:
24+
dependency-type: "development"
1725

18-
- package-ecosystem: "github-actions"
26+
- package-ecosystem: "cargo"
1927
directory: "/"
2028
schedule:
2129
interval: "weekly"
2230
reviewers:
23-
- "geekmasher"
31+
- "advanced-security/oss-maintainers"
32+
target-branch: "main"
33+
commit-message:
34+
prefix: deps
35+
prefix-development: chore
36+
labels:
37+
- "Dependencies"
38+
groups:
39+
production-dependencies:
40+
dependency-type: "production"
41+
development-dependencies:
42+
dependency-type: "development"

.github/workflows/build.yml

Lines changed: 74 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -69,79 +69,80 @@ jobs:
6969
run: |
7070
./scripts/run-tests.sh "ql/test/${{ matrix.test-folders }}"
7171
72-
scanning:
73-
runs-on: ubuntu-latest
74-
needs: [tests]
75-
76-
strategy:
77-
matrix:
78-
project: ["hashicorp/terraform-guides", "akamai/terraform-examples", "aws-samples/aws-sam-terraform-examples"]
79-
80-
steps:
81-
- name: "Checkout"
82-
uses: actions/checkout@v5
83-
with:
84-
submodules: true
85-
86-
- name: "Checkout"
87-
uses: actions/checkout@v5
88-
with:
89-
repository: ${{ matrix.project }}
90-
path: project
91-
92-
- name: "Check for changes"
93-
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
94-
id: extractor-changes
95-
with:
96-
filters: |
97-
src:
98-
- 'extractor/**'
99-
- 'rust-toolchain.toml'
100-
- 'Cargo.*'
101-
102-
- name: "Download Extracter"
103-
if: steps.extractor-changes.outputs.src == 'false'
104-
env:
105-
GH_TOKEN: ${{ github.token }}
106-
run: |
107-
set -e
108-
gh release list -L 1 -R "advanced-security/codeql-extractor-iac"
109-
110-
gh release download \
111-
-R "advanced-security/codeql-extractor-iac" \
112-
--clobber \
113-
--pattern 'extractor-iac.tar.gz'
114-
115-
tar -zxf extractor-iac.tar.gz
116-
117-
- uses: dtolnay/rust-toolchain@4305c38b25d97ef35a8ad1f985ccf2d2242004f2 # stable
118-
if: steps.extractor-changes.outputs.src == 'true'
119-
120-
- name: "Build Extractor"
121-
if: steps.extractor-changes.outputs.src == 'true'
122-
env:
123-
GH_TOKEN: ${{ github.token }}
124-
run: |
125-
set -e
126-
gh extensions install github/gh-codeql
127-
gh codeql set-version latest
128-
129-
./scripts/create-extractor-pack.sh
130-
131-
gh codeql resolve languages --format=json --search-path ./extractor-pack
132-
133-
- name: "Run CodeQL Analysis"
134-
env:
135-
GH_TOKEN: ${{ github.token }}
136-
PROJECT_REPO: ${{ matrix.project }}
137-
run: |
138-
set -e
139-
gh extensions install github/gh-codeql
140-
gh codeql set-version latest
141-
142-
gh codeql database create iac-db --language=iac --source-root=./project --search-path ./extractor-pack
143-
144-
gh codeql database analyze iac-db "advanced-security/iac-queries" --format=sarifv2.1.0 --output="iac-${PROJECT_REPO}.sarif"
72+
# scanning:
73+
# runs-on: ubuntu-latest
74+
# needs: [tests]
75+
76+
# strategy:
77+
# matrix:
78+
# # project: ["hashicorp/terraform-guides", "akamai/terraform-examples", "aws-samples/aws-sam-terraform-examples"]
79+
# project: []
80+
81+
# steps:
82+
# - name: "Checkout"
83+
# uses: actions/checkout@v5
84+
# with:
85+
# submodules: true
86+
87+
# - name: "Checkout"
88+
# uses: actions/checkout@v5
89+
# with:
90+
# repository: ${{ matrix.project }}
91+
# path: project
92+
93+
# - name: "Check for changes"
94+
# uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
95+
# id: extractor-changes
96+
# with:
97+
# filters: |
98+
# src:
99+
# - 'extractor/**'
100+
# - 'rust-toolchain.toml'
101+
# - 'Cargo.*'
102+
103+
# - name: "Download Extracter"
104+
# if: steps.extractor-changes.outputs.src == 'false'
105+
# env:
106+
# GH_TOKEN: ${{ github.token }}
107+
# run: |
108+
# set -e
109+
# gh release list -L 1 -R "advanced-security/codeql-extractor-iac"
110+
111+
# gh release download \
112+
# -R "advanced-security/codeql-extractor-iac" \
113+
# --clobber \
114+
# --pattern 'extractor-iac.tar.gz'
115+
116+
# tar -zxf extractor-iac.tar.gz
117+
118+
# - uses: dtolnay/rust-toolchain@4305c38b25d97ef35a8ad1f985ccf2d2242004f2 # stable
119+
# if: steps.extractor-changes.outputs.src == 'true'
120+
121+
# - name: "Build Extractor"
122+
# if: steps.extractor-changes.outputs.src == 'true'
123+
# env:
124+
# GH_TOKEN: ${{ github.token }}
125+
# run: |
126+
# set -e
127+
# gh extensions install github/gh-codeql
128+
# gh codeql set-version latest
129+
130+
# ./scripts/create-extractor-pack.sh
131+
132+
# gh codeql resolve languages --format=json --search-path ./extractor-pack
133+
134+
# - name: "Run CodeQL Analysis"
135+
# env:
136+
# GH_TOKEN: ${{ github.token }}
137+
# PROJECT_REPO: ${{ matrix.project }}
138+
# run: |
139+
# set -e
140+
# gh extensions install github/gh-codeql
141+
# gh codeql set-version latest
142+
143+
# gh codeql database create --language=iac --source-root=./project --search-path ./extractor-pack iac-db
144+
145+
# gh codeql database analyze --search-path ./extractor-pack --format sarif-latest --output="iac-${PROJECT_REPO}.sarif" iac-db ./ql/src
145146

146147

147148
docs:

.release.yml

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,23 @@
11
name: codeql-extractor-iac
2-
version: 0.4.1
3-
default: false
2+
repository: advanced-security/codeql-extractor-iac
3+
version: 0.5.0
4+
5+
ecosystems:
6+
- "Docs"
7+
- "CodeQL"
8+
9+
exclude:
10+
- "target/"
11+
- "extractor-pack/"
412

513
locations:
6-
- name: "Release file"
7-
paths:
8-
- ".release.yml"
9-
patterns:
10-
- '\nversion:\s*([0-9]+\.[0-9]+\.[0-9])'
11-
- name: "Docs"
12-
paths:
13-
- "README.md"
14-
patterns:
15-
- 'advanced-security/codeql-extractor-iac@v\s*([0-9]+\.[0-9]+\.[0-9])'
16-
- name: "CodeQL Extractor / Packs"
14+
- name: "CodeQL Extractor"
1715
paths:
1816
- "codeql-extractor.yml"
19-
- "ql/lib/qlpack.yml"
20-
- "ql/src/qlpack.yml"
2117
exclude:
2218
- ".codeql"
2319
patterns:
24-
- '\nversion:\s*([0-9]+\.[0-9]+\.[0-9])'
20+
- '\nversion:\s*{version}'
2521
- name: "Cargo"
2622
exclude:
2723
- "/target/"
@@ -30,9 +26,9 @@ locations:
3026
paths:
3127
- "*/Cargo.toml"
3228
patterns:
33-
- '\nversion\s*=\s*"([0-9]+\.[0-9]+\.[0-9])"'
29+
- '\nversion\s*=\s*"{version}"'
3430
- name: "Extractor Action"
3531
paths:
36-
- ".github/action/src/codeql.ts"
32+
- "action.yml"
3733
patterns:
38-
- 'EXTRACTOR_VERSION\s*=\s*"v([0-9]+\.[0-9]+\.[0-9])";'
34+
- '{repository}@v{version}'

CONTRIBUTING.md

Lines changed: 75 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,89 @@
1-
# Contributing
1+
# Contributing 🤝
22

3-
Hi there! We're thrilled that you'd like to contribute to this project. Your help is essential for keeping it great.
3+
Thank you for your interest in contributing to this project! Your help makes it better for everyone.
44

5-
Contributions to this project are [released](https://help.github.com/articles/github-terms-of-service/#6-contributions-under-repository-license) to the public under the [project's open source license](LICENSE.md).
5+
## Code of Conduct 📝
66

7-
Please note that this project is released with a [Contributor Code of Conduct][code-of-conduct]. By participating in this project you agree to abide by its terms.
7+
By participating, you agree to abide by our [Contributor Code of Conduct](CODE_OF_CONDUCT.md).
88

9-
## Submitting a pull request
9+
## Getting Started
1010

11-
1. [Fork][fork] and clone the repository
12-
2. Make sure the tests pass on your machine: `./tests/run-tests.sh`
13-
- Tests can be run from VSCode
14-
3. Create a new branch: `git checkout -b my-branch-name`
15-
4. Make your change, add tests, and make sure the tests still pass
16-
5. Push to your fork and [submit a pull request][pr]
17-
6. Pat yourself on the back and wait for your pull request to be reviewed and merged.
11+
### Build the extractor
1812

19-
Here are a few things you can do that will increase the likelihood of your pull request being accepted:
13+
To build the extractor, use the following command:
2014

21-
- Write tests.
22-
- Keep your change as focused as possible. If there are multiple changes you would like to make that are not dependent upon each other, consider submitting them as separate pull requests.
23-
- Write a [good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
15+
```sh
16+
./scripts/create-extractor-pack.sh
17+
```
18+
19+
This will create the extractor pack in the `./extractor-pack` directory.
20+
21+
### Installing Dependencies
22+
23+
To install the dependencies of the queries, run the following command:
24+
25+
```sh
26+
codeql pack install ./ql/lib
27+
```
28+
29+
This will install the necessary dependencies for the library queries.
30+
Alternatively, you can install them using VSCode's CodeQL extension.
31+
32+
### Compiling the Library
33+
34+
To compile the library queries, run:
35+
36+
```sh
37+
codeql pack create ./ql/lib
38+
```
39+
40+
You can also install these packs into the CodeQL home directory using:
41+
42+
```sh
43+
codeql pack install --output=$HOME/.codeql/packages ./ql/lib
44+
```
45+
46+
This will allow your to use the library on your local machine with CodeQL CLI.
47+
48+
### Run Tests
49+
50+
To run all tests:
51+
52+
```sh
53+
./scripts/run-tests.sh
54+
```
55+
56+
Or use VSCode's test runner for supported tests.
57+
58+
## Submitting a Pull Request
59+
60+
1. Fork and clone the repository
61+
2. Create a new branch: `git checkout -b my-feature`
62+
3. Make your changes and add tests if needed
63+
4. Ensure all tests pass
64+
5. Push your branch and open a pull request
65+
66+
### Tips for a Successful PR
67+
68+
- Keep changes focused and minimal
69+
- Write clear commit messages
70+
- Add or update tests as needed
71+
72+
## Reporting Issues & Discussions
73+
74+
- Report bugs or request features via [GitHub Issues](https://github.com/advanced-security/codeql-extractor-iac/issues)
75+
- Use [GitHub Discussions](https://github.com/advanced-security/codeql-extractor-iac/discussions) for questions and ideas
76+
77+
## License 📄
78+
79+
Contributions are released under the [MIT License](LICENSE.md).
2480

2581
## Resources
2682

2783
- [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/)
2884
- [Using Pull Requests](https://help.github.com/articles/about-pull-requests/)
2985
- [GitHub Help](https://help.github.com)
3086

31-
[fork]: https://github.com/advanced-security/codeql-extractor-iac/fork
32-
[pr]: https://github.com/advanced-security/codeql-extractor-iac/compare
33-
[code-of-conduct]: CODE_OF_CONDUCT.md
87+
---
88+
89+
If you have any questions, open an issue or start a discussion. Thank you for helping improve this project! 🚀

0 commit comments

Comments
 (0)