Skip to content

Commit f49d76d

Browse files
Merge branch 'main' into mbaluda/type_sanitizer
2 parents d2f15cd + 04acfd8 commit f49d76d

File tree

54 files changed

+1895
-512
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1895
-512
lines changed

.github/workflows/code_scanning.yml

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@ on:
1010
- cron: '39 12 * * 2'
1111
workflow_dispatch:
1212

13-
env:
14-
LGTM_INDEX_XML_MODE: all
15-
LGTM_INDEX_FILETYPES: ".json:JSON"
16-
1713
jobs:
1814
analyze-javascript:
1915
name: Analyze
@@ -37,39 +33,36 @@ jobs:
3733
mv $dir .github/codeql/extensions/$dir
3834
done
3935
40-
- name: Ensure presence of cds shell command
41-
run: |
42-
if ! command -v cds &> /dev/null
43-
then
44-
npm install -g @sap/cds-dk
45-
fi
46-
47-
# Compile .cds files to .cds.json files.
48-
- name: Compile CAP CDS files
49-
run: |
50-
for cds_file in $(find . -type f \( -iname '*.cds' \) -print)
51-
do
52-
echo "I am compiling $cds_file"
53-
cds compile $cds_file \
54-
-2 json \
55-
-o "$cds_file.json"
56-
done
57-
5836
- name: Extract CodeQL bundle version from qlt.conf.json
5937
run: |
6038
echo "BUNDLE_VERSION=$(jq .CodeQLCLIBundle qlt.conf.json -r)" >> $GITHUB_ENV
6139
6240
- name: Initialize CodeQL
41+
id: initialize-codeql
6342
uses: github/codeql-action/init@v3
43+
env:
44+
# Add our custom extractor to the CodeQL search path
45+
CODEQL_ACTION_EXTRA_OPTIONS: '{"database":{"init":["--search-path","${{ github.workspace }}/extractors"]}}'
6446
with:
6547
languages: javascript
6648
config-file: ./.github/codeql/codeql-config.yaml
49+
db-location: ${{ runner.temp }}/codeql-database
6750
tools: https://github.com/github/codeql-action/releases/download/${{env.BUNDLE_VERSION}}/codeql-bundle-linux64.tar.gz
6851
debug: true
52+
53+
- name: Run CDS extractor
54+
shell: bash
55+
run: |
56+
export CODEQL_DIST="$(dirname "${{ steps.initialize-codeql.outputs.codeql-path }}")"
57+
export CODEQL_EXTRACTOR_JAVASCRIPT_WIP_DATABASE="${{ runner.temp }}/codeql-database/javascript"
58+
${{ github.workspace }}/scripts/compile-cds.sh
6959
7060
- name: Perform CodeQL Analysis
7161
id: analyze
7262
uses: github/codeql-action/analyze@v3
63+
env:
64+
LGTM_INDEX_XML_MODE: all
65+
LGTM_INDEX_FILETYPES: ".json:JSON"
7366

7467
- name: Setup Python
7568
uses: actions/setup-python@v5

.github/workflows/javascript.sarif.expected

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

.github/workflows/run-codeql-unit-tests-javascript.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ jobs:
9292
echo "I am compiling $cds_file"
9393
cds compile $cds_file \
9494
-2 json \
95-
-o "$cds_file.json"
95+
-o "$cds_file.json" \
96+
--locations
9697
done
9798
9899
- name: Run test suites

CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# This repository is maintained by:
2+
@es-codeql

CODE_OF_CONDUCT.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as
6+
contributors and maintainers pledge to making participation in our project and
7+
our community a harassment-free experience for everyone, regardless of age, body
8+
size, disability, ethnicity, gender identity and expression, level of experience,
9+
nationality, personal appearance, race, religion, or sexual identity and
10+
orientation.
11+
12+
## Our Standards
13+
14+
Examples of behavior that contributes to creating a positive environment
15+
include:
16+
17+
* Using welcoming and inclusive language
18+
* Being respectful of differing viewpoints and experiences
19+
* Gracefully accepting constructive criticism
20+
* Focusing on what is best for the community
21+
* Showing empathy towards other community members
22+
23+
Examples of unacceptable behavior by participants include:
24+
25+
* The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
* Trolling, insulting/derogatory comments, and personal or political attacks
28+
* Public or private harassment
29+
* Publishing others' private information, such as a physical or electronic
30+
address, without explicit permission
31+
* Other conduct which could reasonably be considered inappropriate in a
32+
professional setting
33+
34+
## Our Responsibilities
35+
36+
Project maintainers are responsible for clarifying the standards of acceptable
37+
behavior and are expected to take appropriate and fair corrective action in
38+
response to any instances of unacceptable behavior.
39+
40+
Project maintainers have the right and responsibility to remove, edit, or
41+
reject comments, commits, code, wiki edits, issues, and other contributions
42+
that are not aligned to this Code of Conduct, or to ban temporarily or
43+
permanently any contributor for other behaviors that they deem inappropriate,
44+
threatening, offensive, or harmful.
45+
46+
## Scope
47+
48+
This Code of Conduct applies both within project spaces and in public spaces
49+
when an individual is representing the project or its community. Examples of
50+
representing a project or community include using an official project e-mail
51+
address, posting via an official social media account, or acting as an appointed
52+
representative at an online or offline event. Representation of a project may be
53+
further defined and clarified by project maintainers.
54+
55+
## Enforcement
56+
57+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
58+
reported by contacting the project team at <opensource@github.com>. All
59+
complaints will be reviewed and investigated and will result in a response that
60+
is deemed necessary and appropriate to the circumstances. The project team is
61+
obligated to maintain confidentiality with regard to the reporter of an incident.
62+
Further details of specific enforcement policies may be posted separately.
63+
64+
Project maintainers who do not follow or enforce the Code of Conduct in good
65+
faith may face temporary or permanent repercussions as determined by other
66+
members of the project's leadership.
67+
68+
## Attribution
69+
70+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71+
available at [http://contributor-covenant.org/version/1/4][version]
72+
73+
[homepage]: http://contributor-covenant.org
74+
[version]: http://contributor-covenant.org/version/1/4/

CONTRIBUTING.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
## Contributing
2+
3+
[fork]: https://github.com/advanced-security/codeql-sap-js/fork
4+
[pr]: https://github.com/advanced-security/codeql-sap-js/compare
5+
[style]: https://github.com/github/codeql/blob/main/docs/ql-style-guide.md
6+
7+
Hi there! We're thrilled that you'd like to contribute to this project. Your help is essential for keeping it great.
8+
9+
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.txt).
10+
11+
Please note that this project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.
12+
13+
## Submitting a pull request
14+
15+
1. [Fork][fork] and clone the repository
16+
1. Configure and install the [CodeQL CLI](https://github.com/github/codeql-cli-binaries/releases) specified in the `qlt.conf.json` file
17+
1. Create a new branch: `git checkout -b my-branch-name`
18+
1. Make your changes
19+
1. Make sure the QL tests pass on your machine
20+
1. Ensure the files are appropriately formatted (QL files should be formatted with `codeql query format`)
21+
1. Push to your fork and [submit a draft pull request](https://github.com/advanced-security/codeql-sap-js/compare). Make sure to select **Create Draft Pull Request**.
22+
7. Address failed checks, if any.
23+
8. Mark the [pull request ready for review](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/changing-the-stage-of-a-pull-request#marking-a-pull-request-as-ready-for-review).
24+
9. Pat your self on the back and wait for your pull request to be reviewed and merged.
25+
26+
Here are a few things you can do that will increase the likelihood of your pull request being accepted:
27+
28+
- Follow the [CodeQL style guide][style].
29+
- Write good tests.
30+
- 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.
31+
- Write a [good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
32+
33+
## Resources
34+
35+
- [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/)
36+
- [Using Pull Requests](https://help.github.com/articles/about-pull-requests/)
37+
- [GitHub Help](https://help.github.com)

LICENSE renamed to LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2023 GitHub Advanced Security
3+
Copyright GitHub, Inc.
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 99 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,101 @@
1-
# Overview
2-
[CodeQL](https://codeql.github.com/) models and queries for the SAP frameworks:
1+
# CodeQL: SAP JavaScript frameworks
2+
This repository contains [CodeQL](https://codeql.github.com/) models and queries for SAP JavaScript frameworks:
33
- [CAP](javascript/frameworks/cap) (https://cap.cloud.sap/)
44
- [UI5](javascript/frameworks/ui5) (https://sapui5.hana.ondemand.com/)
5-
- [XSJS](javascript/frameworks/xsjs) (https://www.npmjs.com/package/@sap/async-xsjs)
5+
- [XSJS](javascript/frameworks/xsjs) (https://www.npmjs.com/package/@sap/async-xsjs)
6+
7+
### Published CodeQl packs
8+
- [advanced-security/javascript-sap-cap-queries](https://github.com/advanced-security/codeql-sap-js/pkgs/container/javascript-sap-cap-queries)
9+
- [advanced-security/javascript-sap-ui5-queries](https://github.com/advanced-security/codeql-sap-js/pkgs/container/javascript-sap-ui5-queries)
10+
- [advanced-security/javascript-sap-async-xsjs-queries](https://github.com/advanced-security/codeql-sap-js/pkgs/container/javascript-sap-async-xsjs-queries)
11+
12+
## Usage
13+
14+
### Analyzing a repository with [Code Scanning](https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning#using-query-packs)
15+
Example workflow file:
16+
```yaml
17+
jobs:
18+
analyze-javascript:
19+
name: Analyze
20+
runs-on: 'ubuntu-latest'
21+
permissions:
22+
security-events: write
23+
24+
- name: Compile CDS files
25+
run: |
26+
npm install -g @sap/cds-dk
27+
for cds_file in $(find . -type f \( -iname '*.cds' \) -print)
28+
do
29+
cds compile $cds_file \
30+
-2 json \
31+
-o "$cds_file.json" \
32+
--locations
33+
done
34+
35+
- name: Initialize CodeQL
36+
uses: github/codeql-action/init@v3
37+
with:
38+
languages: javascript
39+
config-file: .github/codeql/codeql-config.yaml
40+
41+
- name: Perform CodeQL Analysis
42+
id: analyze
43+
uses: github/codeql-action/analyze@v3
44+
```
45+
Example configuration file:
46+
```yaml
47+
name: "My CodeQL config"
48+
49+
packs:
50+
# Use these packs for JavaScript and TypeScript analysis
51+
javascript:
52+
- codeql/javascript-queries:codeql-suites/javascript-security-extended.qls
53+
- advanced-security/javascript-sap-async-xsjs-queries:codeql-suites/javascript-security-extended.qls
54+
- advanced-security/javascript-sap-cap-queries:codeql-suites/javascript-security-extended.qls
55+
- advanced-security/javascript-sap-ui5-queries:codeql-suites/javascript-security-extended.qls
56+
57+
paths-ignore:
58+
- "**/node_modules"
59+
```
60+
### Building and analyzing the CodeQL database with the CodeQL CLI
61+
62+
1. Include and index XML, JSON and CDS files by setting the necessary environment variables:
63+
```
64+
export LGTM_INDEX_XML_MODE='ALL'
65+
export LGTM_INDEX_FILETYPES=$'.json:JSON\n.cds:JSON'
66+
```
67+
2. Compile all the CDS files using the SAP cds toolkit
68+
```
69+
npm install -g @sap/cds-dk
70+
for cds_file in $(find . -type f \( -iname '*.cds' \) -print)
71+
do
72+
cds compile $cds_file \
73+
-2 json \
74+
-o "$cds_file.json" \
75+
--locations
76+
done
77+
```
78+
3. Build the database [as usual](https://docs.github.com/en/code-security/codeql-cli/codeql-cli-manual/database-create)
79+
```
80+
codeql database create <DB_NAME> --language=javascript
81+
```
82+
4. Analyze the database using one or more packs
83+
```
84+
codeql database analyze <DB_NAME> --format=sarif-latest --output=<OUTPUT_FILE> \
85+
--download advanced-security/javascript-sap-cap-queries \
86+
advanced-security/javascript-sap-ui5-queries \
87+
advanced-security/javascript-sap-async-xsjs-queries
88+
```
89+
90+
## License
91+
92+
This project is licensed under the terms of the MIT open source license. Please refer to [MIT](LICENSE.txt) for the full terms.
93+
94+
## Maintainers
95+
96+
See [CODEOWNERS](CODEOWNERS)
97+
98+
## Support
99+
100+
See [SUPPORT](SUPPORT.md)
101+

SECURITY.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
Thanks for helping make GitHub safe for everyone.
2+
3+
# Security
4+
5+
GitHub takes the security of our software products and services seriously, including all of the open source code repositories managed through our GitHub organizations, such as [GitHub](https://github.com/GitHub).
6+
7+
Even though [open source repositories are outside of the scope of our bug bounty program](https://bounty.github.com/index.html#scope) and therefore not eligible for bounty rewards, we will ensure that your finding gets passed along to the appropriate maintainers for remediation.
8+
9+
## Reporting Security Issues
10+
11+
If you believe you have found a security vulnerability in any GitHub-owned repository, please report it to us through coordinated disclosure.
12+
13+
**Please do not report security vulnerabilities through public GitHub issues, discussions, or pull requests.**
14+
15+
Instead, please send an email to opensource-security[@]github.com.
16+
17+
Please include as much of the information listed below as you can to help us better understand and resolve the issue:
18+
19+
* The type of issue (e.g., buffer overflow, SQL injection, or cross-site scripting)
20+
* Full paths of source file(s) related to the manifestation of the issue
21+
* The location of the affected source code (tag/branch/commit or direct URL)
22+
* Any special configuration required to reproduce the issue
23+
* Step-by-step instructions to reproduce the issue
24+
* Proof-of-concept or exploit code (if possible)
25+
* Impact of the issue, including how an attacker might exploit the issue
26+
27+
This information will help us triage your report more quickly.
28+
29+
## Policy
30+
31+
See [GitHub's Safe Harbor Policy](https://docs.github.com/en/site-policy/security-policies/github-bug-bounty-program-legal-safe-harbor#1-safe-harbor-terms)

SUPPORT.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Support
2+
3+
## How to file issues and get help
4+
5+
This project uses GitHub issues to track bugs and feature requests. Please search the existing issues before filing new issues to avoid duplicates. For new issues, file your bug or feature request as a new issue.
6+
7+
For help or questions about using this project, please raise an issue.
8+
9+
CodeQL for SAP JavaScript frameworks is under active development and maintained by GitHub staff AND THE COMMUNITY. We will do our best to respond to support, feature requests, and community questions in a timely manner.
10+
11+
## GitHub Support Policy
12+
13+
Support for this project is limited to the resources listed above.

0 commit comments

Comments
 (0)