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

Dev #75

Merged
merged 2 commits into from
Sep 5, 2023
Merged

Dev #75

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
3 changes: 2 additions & 1 deletion spec/functional_test/testers/go_gin_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ extected_endpoints = [
Param.new("password", "", "form"),
Param.new("User-Agent", "", "header"),
]),
Endpoint.new("/public/secret.html", "GET"),
]

FunctionalTester.new("fixtures/go_gin/", {
:techs => 1,
:endpoints => 2,
:endpoints => 3,
}, extected_endpoints).test_all
10 changes: 9 additions & 1 deletion src/analyzer/analyzers/analyzer_go_gin.cr
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class AnalyzerGoGin < Analyzer
end
end

["Query", "PostForm", "GetHeader", "Static"].each do |pattern|
["Query", "PostForm", "GetHeader"].each do |pattern|
if line.includes?("#{pattern}(")
get_param(line).tap do |param|
if param.name.size > 0 && last_endpoint.method != ""
Expand All @@ -29,6 +29,14 @@ class AnalyzerGoGin < Analyzer
end
end
end

if line.includes?("Static(")
get_static_path(line).tap do |static_path|
if static_path["static_path"].size > 0 && static_path["file_path"].size > 0
public_dirs << static_path
end
end
end
end
end
end
Expand Down