Skip to content
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

Bearer POC #293

Closed
wants to merge 11 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/reviewdog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Automated Code Reviews
on: [pull_request]

permissions:
contents: read
pull-requests: write

jobs:
bearer:
name: Bearer Security Analysis
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: reviewdog/action-setup@v1
with:
reviewdog_version: latest
- name: Bearer
uses: bearer/bearer-action@v2
with:
diff: true
format: rdjson
output: reviewdog.json
- name: Run reviewdog
if: always()
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
touch reviewdog.json && cat reviewdog.json | reviewdog -f=rdjson -reporter=github-pr-check
2 changes: 2 additions & 0 deletions packages/consent/lib/consent/dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
def eval_view(key, label, collection_conditions)
view key, label do |user|
eval(collection_conditions)
# trigger failure
eval(collection_conditions)

Check failure on line 22 in packages/consent/lib/consent/dsl.rb

View workflow job for this annotation

GitHub Actions / Bearer Security Analysis

[rdjson] reported by reviewdog 🐶 # Usage of dangerous 'eval' function ## Description The use of the `eval` function, which dynamically executes code represented as strings, poses a high security risk in any programming environment. This is primarily because it can be exploited to run arbitrary and potentially harmful code, making the application vulnerable to code injection attacks. ## Remediations - **Do not** use the `eval` function. Its ability to execute code that can be manipulated by an attacker introduces various injection vulnerabilities. ```ruby eval("def hello_world; puts 'Hello world!'; end") ``` - **Do** explore safer alternatives to `eval`. Use language features or libraries specifically designed for the task you're trying to accomplish with `eval`. - **Do** validate and sanitize all inputs if you must use dynamic code execution. This reduces the risk of executing malicious code. - **Do** use restricted execution environments for running code dynamically if absolutely necessary. This minimizes the potential impact of malicious code execution by isolating it from the main application environment. ## References - [OWASP: Eval Injection](https://owasp.org/www-community/attacks/Direct_Dynamic_Code_Evaluation_Eval%20Injection) - [MDN Web Docs: Never use eval!](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval#never_use_eval!) Raw Output: message:"\n# Usage of dangerous 'eval' function\n## Description\n\nThe use of the `eval` function, which dynamically executes code represented as strings, poses a high security risk in any programming environment. This is primarily because it can be exploited to run arbitrary and potentially harmful code, making the application vulnerable to code injection attacks.\n\n## Remediations\n\n- **Do not** use the `eval` function. Its ability to execute code that can be manipulated by an attacker introduces various injection vulnerabilities.\n ```ruby\n eval(\"def hello_world; puts 'Hello world!'; end\")\n ```\n- **Do** explore safer alternatives to `eval`. Use language features or libraries specifically designed for the task you're trying to accomplish with `eval`.\n- **Do** validate and sanitize all inputs if you must use dynamic code execution. This reduces the risk of executing malicious code.\n- **Do** use restricted execution environments for running code dynamically if absolutely necessary. This minimizes the potential impact of malicious code execution by isolating it from the main application environment.\n\n## References\n\n- [OWASP: Eval Injection](https://owasp.org/www-community/attacks/Direct_Dynamic_Code_Evaluation_Eval%20Injection)\n- [MDN Web Docs: Never use eval!](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval#never_use_eval!)" location:{path:"packages/consent/lib/consent/dsl.rb" range:{start:{line:22 column:9} end:{line:22 column:36}}} severity:ERROR source:{name:"Bearer" url:"https://docs.bearer.com/"} code:{value:"ruby_lang_eval_linter" url:"https://docs.bearer.com/reference/rules/ruby_lang_eval_linter"}
end
end
# rubocop:enable Lint/UnusedBlockArgument, Security/Eval
Expand Down
Loading