-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue #268. As part of the Hackweek (https://t.ly/epoSZ), dawn must be
able to parse a Sinatra application to spot vulnerabilities. As Sinatra code can be also self contained in a single file, this must be allowed as a valid target.
- Loading branch information
paolo
committed
Nov 8, 2023
1 parent
a891c12
commit 91f8502
Showing
7 changed files
with
70 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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 +1 @@ | ||
3.1 | ||
3.2.2 |
This file contains 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 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 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 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,20 @@ | ||
module Dawn | ||
module Processor | ||
class Require < AST::Processor | ||
attr_reader :is_sinatra | ||
|
||
def initialize() | ||
@is_sinatra = false | ||
super() | ||
end | ||
|
||
def on_send(node) | ||
if (node.children[1].to_s == "require") | ||
if node.children[2].children[0].to_s == "sinatra" | ||
@is_sinatra = true | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains 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 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 @@ | ||
require "spec_helper" | ||
|
||
describe "A single ruby file with a Sinatra application " do | ||
before (:all) do | ||
@engine = Dawn::Core.detect_mvc("./spec/support/sinatra_hello_app.rb") | ||
end | ||
it "is a good target too" do | ||
expect(@engine).not_to be_nil | ||
end | ||
|
||
it "is recognized as a Sinatra app" do | ||
expect(@engine).to be_a Dawn::Sinatra | ||
end | ||
end |