gitrob 0.0.6 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +30 -7
- data/.rspec +0 -1
- data/.rubocop.yml +55 -0
- data/.travis.yml +4 -0
- data/CHANGELOG.md +42 -0
- data/CONTRIBUTING.md +137 -9
- data/Gemfile +11 -1
- data/Guardfile +42 -0
- data/LICENSE.txt +17 -18
- data/README.md +79 -29
- data/Rakefile +6 -0
- data/bin/console +34 -0
- data/bin/setup +7 -0
- data/db/migrations/001_create_assessments.rb +19 -0
- data/db/migrations/002_create_github_access_tokens.rb +11 -0
- data/db/migrations/003_create_owners.rb +24 -0
- data/db/migrations/004_create_repositories.rb +23 -0
- data/db/migrations/005_create_blobs.rb +16 -0
- data/db/migrations/006_create_flags.rb +13 -0
- data/db/migrations/007_create_comparisons.rb +17 -0
- data/db/migrations/008_create_blobs_comparisons.rb +8 -0
- data/db/migrations/009_create_comparisons_repositories.rb +8 -0
- data/db/migrations/010_create_comparisons_owners.rb +8 -0
- data/exe/gitrob +6 -0
- data/gitrob.gemspec +25 -18
- data/lib/gitrob/blob_observer.rb +103 -0
- data/lib/gitrob/cli/command.rb +58 -0
- data/lib/gitrob/cli/commands/accept_terms_of_use.rb +61 -0
- data/lib/gitrob/cli/commands/analyze/analysis.rb +75 -0
- data/lib/gitrob/cli/commands/analyze/gathering.rb +101 -0
- data/lib/gitrob/cli/commands/analyze.rb +63 -0
- data/lib/gitrob/cli/commands/banner.rb +25 -0
- data/lib/gitrob/cli/commands/configure.rb +123 -0
- data/lib/gitrob/cli/commands/server.rb +21 -0
- data/lib/gitrob/cli/progress_bar.rb +47 -0
- data/lib/gitrob/cli.rb +213 -0
- data/lib/gitrob/github/client_manager.rb +46 -0
- data/lib/gitrob/github/data_manager.rb +121 -0
- data/lib/gitrob/jobs/assessment.rb +12 -0
- data/lib/gitrob/jobs/comparison.rb +55 -0
- data/lib/gitrob/models/assessment.rb +96 -0
- data/lib/gitrob/models/blob.rb +50 -0
- data/lib/gitrob/models/comparison.rb +15 -0
- data/lib/gitrob/models/flag.rb +15 -0
- data/lib/gitrob/models/github_access_token.rb +17 -0
- data/lib/gitrob/models/owner.rb +23 -0
- data/lib/gitrob/models/repository.rb +20 -0
- data/lib/gitrob/utils.rb +19 -0
- data/lib/gitrob/version.rb +1 -1
- data/lib/gitrob/web_app.rb +292 -0
- data/lib/gitrob.rb +30 -113
- data/public/css/bootstrap.min.css +11 -0
- data/public/css/main.css +130 -0
- data/public/css/tomorrow-night.css +75 -0
- data/public/fonts/glyphicons-halflings-regular.eot +0 -0
- data/public/fonts/glyphicons-halflings-regular.svg +273 -214
- data/public/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/public/fonts/glyphicons-halflings-regular.woff +0 -0
- data/public/fonts/glyphicons-halflings-regular.woff2 +0 -0
- data/public/images/blob_spinner.gif +0 -0
- data/public/images/gear_spinner.gif +0 -0
- data/public/js/bootstrap.min.js +7 -0
- data/public/js/highlight.pack.js +2 -0
- data/public/js/highlight.worker.js +13 -0
- data/public/js/jquery-2.1.4.min.js +4 -0
- data/public/js/main.js +239 -0
- data/public/robots.txt +2 -0
- data/signatures.json +541 -0
- data/views/assessments/_assessments.erb +57 -0
- data/views/assessments/_comparable_assessments.erb +38 -0
- data/views/assessments/_comparisons.erb +111 -0
- data/views/assessments/compare.erb +22 -0
- data/views/assessments/findings.erb +55 -0
- data/views/assessments/repositories.erb +35 -0
- data/views/assessments/show.erb +1 -0
- data/views/assessments/users.erb +46 -0
- data/views/blobs/show.erb +37 -0
- data/views/comparisons/show.erb +125 -0
- data/views/errors/internal_server_error.erb +9 -0
- data/views/errors/not_found.erb +5 -0
- data/views/index.erb +43 -28
- data/views/layout.erb +38 -12
- data/views/repositories/show.erb +49 -0
- data/views/users/show.erb +54 -0
- metadata +217 -106
- data/bin/gitrob +0 -260
- data/lib/gitrob/github/blob.rb +0 -41
- data/lib/gitrob/github/http_client.rb +0 -127
- data/lib/gitrob/github/organization.rb +0 -99
- data/lib/gitrob/github/repository.rb +0 -72
- data/lib/gitrob/github/user.rb +0 -84
- data/lib/gitrob/observers/sensitive_files.rb +0 -83
- data/lib/gitrob/progressbar.rb +0 -52
- data/lib/gitrob/util.rb +0 -11
- data/lib/gitrob/webapp.rb +0 -76
- data/models/blob.rb +0 -35
- data/models/finding.rb +0 -14
- data/models/organization.rb +0 -32
- data/models/repo.rb +0 -22
- data/models/user.rb +0 -28
- data/patterns.json +0 -394
- data/public/javascripts/bootstrap.min.js +0 -7
- data/public/javascripts/gitrob.js +0 -75
- data/public/javascripts/jquery-2.1.1.min.js +0 -4
- data/public/javascripts/lang-apollo.js +0 -2
- data/public/javascripts/lang-basic.js +0 -3
- data/public/javascripts/lang-clj.js +0 -18
- data/public/javascripts/lang-css.js +0 -2
- data/public/javascripts/lang-dart.js +0 -3
- data/public/javascripts/lang-erlang.js +0 -2
- data/public/javascripts/lang-go.js +0 -1
- data/public/javascripts/lang-hs.js +0 -2
- data/public/javascripts/lang-lisp.js +0 -3
- data/public/javascripts/lang-llvm.js +0 -1
- data/public/javascripts/lang-lua.js +0 -2
- data/public/javascripts/lang-matlab.js +0 -6
- data/public/javascripts/lang-ml.js +0 -2
- data/public/javascripts/lang-mumps.js +0 -2
- data/public/javascripts/lang-n.js +0 -4
- data/public/javascripts/lang-pascal.js +0 -3
- data/public/javascripts/lang-proto.js +0 -1
- data/public/javascripts/lang-r.js +0 -2
- data/public/javascripts/lang-rd.js +0 -1
- data/public/javascripts/lang-scala.js +0 -2
- data/public/javascripts/lang-sql.js +0 -2
- data/public/javascripts/lang-tcl.js +0 -3
- data/public/javascripts/lang-tex.js +0 -1
- data/public/javascripts/lang-vb.js +0 -2
- data/public/javascripts/lang-vhdl.js +0 -3
- data/public/javascripts/lang-wiki.js +0 -2
- data/public/javascripts/lang-xq.js +0 -3
- data/public/javascripts/lang-yaml.js +0 -2
- data/public/javascripts/prettify.js +0 -30
- data/public/javascripts/run_prettify.js +0 -34
- data/public/stylesheets/bootstrap.min.css +0 -7
- data/public/stylesheets/bootstrap.min.css.vanilla +0 -5
- data/public/stylesheets/gitrob.css +0 -88
- data/public/stylesheets/prettify.css +0 -51
- data/spec/lib/gitrob/observers/sensitive_files_spec.rb +0 -691
- data/spec/spec_helper.rb +0 -127
- data/views/blob.erb +0 -22
- data/views/organization.erb +0 -126
- data/views/repository.erb +0 -51
- data/views/user.erb +0 -51
data/public/js/main.js
ADDED
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
$(document).ready(function() {
|
|
2
|
+
$(function () {
|
|
3
|
+
$('[data-toggle="tooltip"]').tooltip()
|
|
4
|
+
});
|
|
5
|
+
|
|
6
|
+
if ($("#assessments_table_container").length === 1) {
|
|
7
|
+
initializeAssessmentsTableEvents();
|
|
8
|
+
setTimeout(function() {
|
|
9
|
+
refreshAssessmentsTable();
|
|
10
|
+
}, 5000);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
if ($("#comparisons_table_container").length === 1) {
|
|
14
|
+
initializeComparisonsTableEvents();
|
|
15
|
+
setTimeout(function() {
|
|
16
|
+
refreshComparisonsTable();
|
|
17
|
+
}, 5000)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
$("#new_assessment_button").on("click", function(e) {
|
|
21
|
+
e.preventDefault();
|
|
22
|
+
|
|
23
|
+
$("#assessment_targets").val("");
|
|
24
|
+
$("#new_assessment_modal").modal({
|
|
25
|
+
show: true
|
|
26
|
+
});
|
|
27
|
+
return false;
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
$("#new_assessment_modal").on('shown.bs.modal', function (e) {
|
|
31
|
+
$("#assessment_targets").focus();
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
$("#new_assessment_form").on("submit", function(e) {
|
|
35
|
+
e.preventDefault();
|
|
36
|
+
|
|
37
|
+
$.ajax({
|
|
38
|
+
url: "/assessments",
|
|
39
|
+
type: "POST",
|
|
40
|
+
data: $(this).serialize()
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
$("#new_assessment_modal").modal("hide");
|
|
44
|
+
refreshAssessmentsTable();
|
|
45
|
+
|
|
46
|
+
return false;
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
$(".blob-link").on("click", function(e) {
|
|
50
|
+
e.preventDefault();
|
|
51
|
+
$("#blob_modal").modal({
|
|
52
|
+
show: true
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
$("#blobs_table tbody tr").removeClass("active-blob-row");
|
|
56
|
+
$(this).closest("tr").addClass("active-blob-row");
|
|
57
|
+
|
|
58
|
+
$.get($(this).attr("href"), function(response) {
|
|
59
|
+
if ($(response).find("#blob_content").length === 1) {
|
|
60
|
+
var worker = new Worker("/js/highlight.worker.js");
|
|
61
|
+
worker.onmessage = function(event) {
|
|
62
|
+
$("#blob_modal_content").html(response);
|
|
63
|
+
$("#blob_content").html(event.data);
|
|
64
|
+
$("#blob_content").scrollTop(0);
|
|
65
|
+
worker.terminate();
|
|
66
|
+
markInterestingValues($("#blob_content"));
|
|
67
|
+
}
|
|
68
|
+
worker.postMessage($(response).find("#blob_content").html());
|
|
69
|
+
} else {
|
|
70
|
+
$("#blob_modal_content").html(response);
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
$("#blob_modal").on('hidden.bs.modal', function (e) {
|
|
76
|
+
$("#blob_modal_content").html(blobModalPlaceholder);
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
$("div.owner").on("click", function(e) {
|
|
80
|
+
e.preventDefault();
|
|
81
|
+
|
|
82
|
+
$.get($(this).attr("data-href"), function(response) {
|
|
83
|
+
$("#user_modal_content").html(response);
|
|
84
|
+
$("#user_modal").modal({
|
|
85
|
+
show: true
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
$("#quick_filter").on("keyup", function(e) {
|
|
91
|
+
var rows = $(this).closest("table").find("tbody tr.blob-row");
|
|
92
|
+
var query = $.trim($(this).val()).replace(/ +/g, ' ').toLowerCase();
|
|
93
|
+
var onlyFlagged = false;
|
|
94
|
+
if ($("#show_only_flagged_files").length === 1) {
|
|
95
|
+
if ($("#show_only_flagged_files").is(":checked")) {
|
|
96
|
+
onlyFlagged = true;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
rows.show().filter(function() {
|
|
101
|
+
if (onlyFlagged && !$(this).hasClass("danger")) {
|
|
102
|
+
return true;
|
|
103
|
+
}
|
|
104
|
+
var text = $(this).text().replace(/\s+/g, ' ').toLowerCase();
|
|
105
|
+
return !~ text.indexOf(query);
|
|
106
|
+
}).hide();
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
$("#show_only_flagged_files").on("click", function() {
|
|
110
|
+
var rows = $(this).closest("table").find("tbody tr.blob-row");
|
|
111
|
+
if ($(this).is(":checked")) {
|
|
112
|
+
rows.show().filter(function() {
|
|
113
|
+
if (!$(this).hasClass("danger")) {
|
|
114
|
+
return true;
|
|
115
|
+
} else {
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
}).hide();
|
|
119
|
+
} else {
|
|
120
|
+
rows.show();
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
var blobModalPlaceholder = $("#blob_modal_content").html();
|
|
126
|
+
var csrfToken = $('meta[name="csrf-token"]').attr("content");
|
|
127
|
+
$.ajaxPrefilter(function(options, originalOptions, jqXHR) {
|
|
128
|
+
var method = options.type.toLowerCase();
|
|
129
|
+
if (method === "post" || method === "put" || method === "delete") {
|
|
130
|
+
jqXHR.setRequestHeader('X-CSRF-Token', csrfToken);
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
function refreshAssessmentsTable() {
|
|
135
|
+
var refreshEndpoint = $("#assessments_table_container").attr("data-refresh-endpoint");
|
|
136
|
+
if (typeof refreshEndpoint !== typeof undefined && refreshEndpoint !== false) {
|
|
137
|
+
$.get(refreshEndpoint, function(result) {
|
|
138
|
+
$("#assessments_table_container").html(result);
|
|
139
|
+
initializeAssessmentsTableEvents();
|
|
140
|
+
setTimeout(function() {
|
|
141
|
+
refreshAssessmentsTable();
|
|
142
|
+
}, 5000);
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function refreshComparisonsTable() {
|
|
148
|
+
var refreshEndpoint = $("#comparisons_table_container").attr("data-refresh-endpoint");
|
|
149
|
+
if (typeof refreshEndpoint !== typeof undefined && refreshEndpoint !== false) {
|
|
150
|
+
$.get(refreshEndpoint, function(result) {
|
|
151
|
+
$("#comparisons_table_container").html(result);
|
|
152
|
+
initializeComparisonsTableEvents();
|
|
153
|
+
setTimeout(function() {
|
|
154
|
+
refreshComparisonsTable();
|
|
155
|
+
}, 5000)
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function initializeAssessmentsTableEvents() {
|
|
161
|
+
$("table.assessments").on("click", "td.owners", function(e) {
|
|
162
|
+
e.preventDefault();
|
|
163
|
+
|
|
164
|
+
if (!$(this).closest("tr").hasClass("unfinished")) {
|
|
165
|
+
window.location = $(this).attr("data-href");
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
$("table.assessments").on("click", ".delete-assessment", function(e) {
|
|
170
|
+
e.preventDefault();
|
|
171
|
+
|
|
172
|
+
if (confirm("Are you sure you want to delete this assessment?")) {
|
|
173
|
+
$.ajax({
|
|
174
|
+
url: "/assessments/" + $(this).attr("data-assessment-id"),
|
|
175
|
+
type: "DELETE"
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
$(this).closest("tr").fadeOut("fast", function() {
|
|
179
|
+
$(this).remove();
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
return false;
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
$("table.assessments").on("click", ".compare-assessments", function() {
|
|
186
|
+
$.ajax({
|
|
187
|
+
url: "/comparisons",
|
|
188
|
+
type: "POST",
|
|
189
|
+
data: "assessment_id=" + parseInt($(this).attr("data-assessment-id")) + "&other_assessment_id=" + parseInt($(this).attr("data-other-assessment-id"))
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
$(this).closest("tr").fadeOut("fast", function() {
|
|
193
|
+
$(this).remove();
|
|
194
|
+
});
|
|
195
|
+
return false;
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
function initializeComparisonsTableEvents() {
|
|
200
|
+
$("table.comparisons").on("click", "td.owners", function(e) {
|
|
201
|
+
e.preventDefault();
|
|
202
|
+
|
|
203
|
+
if (!$(this).closest("tr").hasClass("unfinished")) {
|
|
204
|
+
window.location = $(this).attr("data-href");
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
$("table.comparisons").on("click", ".delete-comparison", function(e) {
|
|
209
|
+
e.preventDefault();
|
|
210
|
+
|
|
211
|
+
if (confirm("Are you sure you want to delete this comparison?")) {
|
|
212
|
+
$.ajax({
|
|
213
|
+
url: "/comparisons/" + $(this).attr("data-comparison-id"),
|
|
214
|
+
type: "DELETE"
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
$(this).closest("tr").fadeOut("fast", function() {
|
|
218
|
+
$(this).remove();
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
return false;
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
function markInterestingValues(element) {
|
|
226
|
+
var haystack = $(element).html();
|
|
227
|
+
var needles = [
|
|
228
|
+
/((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))/gmi,
|
|
229
|
+
/([a-zA-Z0-9.!#$%&*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)/gmi,
|
|
230
|
+
/((\w+:\/\/)([\da-z\.-]+)\.([a-z\.]{2,6}))/gmi,
|
|
231
|
+
/(([a-z0-9]([-a-z0-9]*[a-z0-9])?\.)+((aero|arpa|a[cdefgilmnoqrstuwxz])|(biz|b[abdefghijmnorstvwyz])|(cat|com|coop|c[acdfghiklmnorsuvxyz])|d[ejkmoz]|(edu|e[ceghrstu])|f[ijkmor]|(gov|g[abdefghilmnpqrstuwy])|h[kmnrtu]|(info|int|i[delmnoqrst])|(jobs|j[emop])|k[eghimnprwyz]|l[abcikrstuvy]|(mil|mobi|museum|m[acdghklmnopqrstuvwxyz])|(name|net|n[acefgilopruz])|(om|org)|(pro|p[aefghklmnrstw])|qa|r[eouw]|s[abcdegijklmnortvyz]|(travel|t[cdfghjklmnoprtvwz])|u[agkmsyz]|v[aceginu]|w[fs]|y[etu]|z[amw]))/gm,
|
|
232
|
+
/([a-f0-9\-\$\/]{32,})/gmi
|
|
233
|
+
];
|
|
234
|
+
|
|
235
|
+
needles.forEach(function(needle) {
|
|
236
|
+
haystack = haystack.replace(needle, "<mark>$1</mark>");
|
|
237
|
+
});
|
|
238
|
+
element.html(haystack);
|
|
239
|
+
}
|
data/public/robots.txt
ADDED