mirror of
https://github.com/discourse/discourse.git
synced 2025-09-05 08:59:27 +08:00
FIX: Sanitize sensitive parameters in nginx log report.
This commit is contained in:
parent
1ea1cefb35
commit
85d7526219
1 changed files with 8 additions and 0 deletions
|
@ -33,6 +33,8 @@ class LogAnalyzer
|
||||||
result.route += " (PUT)"
|
result.route += " (PUT)"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
result.url = self.sanitize_url(result.url)
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -43,6 +45,12 @@ class LogAnalyzer
|
||||||
def parsed_timge
|
def parsed_timge
|
||||||
DateTime.strptime(time, TIME_FORMAT) if time
|
DateTime.strptime(time, TIME_FORMAT) if time
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def self.sanitize_url(url)
|
||||||
|
url.gsub(/(api_key|api_user)=(\w+)/, '\1=[FILTERED]')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
attr_reader :total_requests, :message_bus_requests, :filenames,
|
attr_reader :total_requests, :message_bus_requests, :filenames,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue