Skip to content

Commit

Permalink
fix(hal-browser): fixing vulnerability by upgrading HAL browser depen…
Browse files Browse the repository at this point in the history
…dencies
  • Loading branch information
vashistha committed Jan 13, 2022
1 parent 46a9578 commit a6b06f6
Show file tree
Hide file tree
Showing 24 changed files with 18,776 additions and 18,443 deletions.
1 change: 0 additions & 1 deletion vendor/hal-browser/.gitignore

This file was deleted.

190 changes: 107 additions & 83 deletions vendor/hal-browser/browser.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
<meta charset="utf-8">
<title>The HAL Browser</title>
<link rel="stylesheet" media="screen" href="vendor/css/bootstrap.css" />
<style type="text/css">
<link rel="stylesheet" href="vendor/bootstrap-icons-1.7.2/bootstrap-icons.css">
<style type="text/css">
body {
padding-top: 60px;
padding-bottom: 40px;
Expand All @@ -12,50 +13,48 @@
padding: 9px 0;
}
</style>
<link rel="stylesheet" media="screen" href="vendor/css/bootstrap-responsive.css" />
<link rel="stylesheet" media="screen" href="vendor/css/bootstrap.css" />
<link rel="stylesheet" media="screen" href="styles.css" />
</head>

<body>
<body>

<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container-fluid">
<a class="brand">The HAL Browser</a>
<div class="nav-collapse">
<ul class="nav">
<li><a href="#/" id="entryPointLink">Go To Entry Point</a></li>
<li><a href="https://github.com/mikekelly/hal-browser">About The HAL Browser</a></li>
<li><a href="/" id="pactBrokerHomeLink">Pact Broker Home</a></li> <!-- pact_broker -->
</ul>
</div>
</div>
</div>
<nav class="navbar sticky-top navbar-expand-md navbar-light bg-light">
<div class="collapse navbar-collapse">
<ul class="navbar-nav">
<li class="nav-item"><a class="nav-link" href="#/" id="entryPointLink">Go To Entry Point</a></li>
<li class="nav-item"><a class="nav-link" href="https://github.com/mikekelly/hal-browser">About The HAL Browser</a></li>
<li class="nav-item"><a class="nav-link" id="pactBrokerHomeLink" href="/">Pact Broker Home</a></li> <!-- pact_broker -->
</ul>
</div>
</nav>

<div id="browser" class="container-fluid"></div>
<div id="browser" class="container-fluid"></div>

<script id="location-bar-template" type="text/template">
<form>
<div class="input-append span12 location-bar-container">
<input class="span11" id="appendedInputButton" type="text" value="<%= _.escape(url) %>">
<button class="btn" type="submit">Go!</button>
<span class="ajax-loader"></span>
</div>
</form>
<form>
<div class="input-group mb-3">
<input type="text" class="form-control" id="appendedInputButton" type="text" value="<%= _.escape(url) %>">
<div class="input-group-append">
<button class="btn btn-outline-secondary input-group-text" type="submit">
Go!
</button>
</div>
</div>
</form>
</script>

<script id="links-template" type="text/template">
<h2>Links</h2>
<table class="table">
<thead>
<tr>
<th>rel</th>
<th>title</th>
<th>name / index</th>
<th>docs</th>
<th>GET</th>
<th>NON-GET</th>
<th scope="col">rel</th>
<th scope="col">title</th>
<th scope="col">name / index</th>
<th scope="col">docs</th>
<th scope="col">GET</th>
<th scope="col">NON-GET</th>
</tr>
</thead>
<tbody>
Expand All @@ -69,14 +68,14 @@ <h2>Links</h2>
<td><%- link.name ? 'name: ' + link.name : 'index: ' + i %></a></td>
<td>
<% if (HAL.isUrl(rel)) { %>
<a class="dox" href="<%= HAL.normalizeUrl(HAL.buildUrl(rel)) %>"><i class="icon-book"></i></a>
<a class="dox btn" href="<%= HAL.normalizeUrl(HAL.buildUrl(rel)) %>"><i class="bi-file-text-fill" style="font-size: large"></i></a>
<% } %>
</td>
<td>
<% if (link.templated === true) { %>
<a class="query btn btn-success" href="<%= HAL.normalizeUrl(link.href) %>" title="Query URI template"><i class="icon-question-sign"></i></a>
<a class="query btn btn-success" href="<%= HAL.normalizeUrl(link.href) %>" title="Query URI template">?</a>
<% } else { %>
<a class="follow btn btn-success" href="<%= HAL.normalizeUrl(link.href) %>" title="Follow link"><i class="icon-arrow-right"></i></a>
<a class="follow btn btn-success" href="<%= HAL.normalizeUrl(link.href) %>" title="Follow link">&#10140;</a>
<% } %>
</td>
<td>
Expand All @@ -92,14 +91,14 @@ <h2>Links</h2>
<td><%- obj.name || '' %></td>
<td>
<% if (HAL.isUrl(rel)) { %>
<a class="dox" href="<%= HAL.normalizeUrl(HAL.buildUrl(rel)) %>"><i class="icon-book"></i></a>
<a class="dox btn" href="<%= HAL.normalizeUrl(HAL.buildUrl(rel)) %>"><i class="bi-file-text-fill" style="font-size: large"></i></a>
<% } %>
</td>
<td>
<% if (obj.templated === true) { %>
<a class="query btn btn-success" href="<%= HAL.normalizeUrl(obj.href) %>" title="Query URI template"><i class="icon-question-sign"></i></a>
<a class="query btn btn-success" href="<%= HAL.normalizeUrl(obj.href) %>" title="Query URI template">?</a>
<% } else { %>
<a class="follow btn btn-success" href="<%= HAL.normalizeUrl(obj.href) %>" title="Follow link"><i class="icon-arrow-right"></i></a>
<a class="follow btn btn-success" href="<%= HAL.normalizeUrl(obj.href) %>" title="Follow link">&#10140;</a>
<% } %>
</td>
<td>
Expand All @@ -114,17 +113,25 @@ <h2>Links</h2>

<script id="properties-template" type="text/template">
<h2>Properties</h2>
<pre><%= properties %></pre>
<div class="card read-only">
<div class="card-body">
<pre><%= properties %></pre>
</div>
</div>
</script>

<script id="request-headers-template" type="text/template">
<h2>Custom Request Headers</h2>
<textarea class="span12"></textarea>
<div class="input-group">
<textarea class="form-control"></textarea>
</div>
</script>

<script id="response-headers-template" type="text/template">
<h2>Response Headers</h2>
<pre><%= status.code %> <%= status.text %>
<div class="card read-only">
<div class="card-body">
<pre><%= status.code %> <%= status.text %>

<% _.each(headers, function(value, name) {
%><%= _.escape(name) %>: <%
Expand All @@ -136,65 +143,82 @@ <h2>Response Headers</h2>
%></a><%
} %>
<% }) %></pre>
</div>
</div>
</script>

<script id="response-body-template" type="text/template">
<h2>Response Body</h2>
<pre><%= _.escape(body) %></pre>
<div class="card read-only">
<div class="card-body">
<pre><%= _.escape(body) %></pre>
</div>
</div>
</script>

<script id="query-uri-template" type="text/template">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h3>Expand URI Template</h3>
</div>

<form id="query" action="<%= href %>">
<div class="modal-body">
<p>URI Template:</p>
<pre><%- href %></pre>
<p>Input (JSON):</p>
<textarea><%= input %></textarea>
<p>Expanded URI:</p>
<pre class="preview">&nbsp;</pre>
</div>

<div class="modal-footer">
<button type="submit" class="btn btn-primary">Follow URI</button>
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h5>Expand URI Template</h5>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
</div>
<form id="query" action="<%= href %>">
<div class="modal-body">
<label for="uri">URI Template:</label>
<div class="card read-only" id="uri">
<div class="card-body">
<pre><%- href %></pre>
</div>
</div>
<label for="input">Input (JSON):</label>
<textarea class="form-control" id="input"><%= input %></textarea>
<label for="preview">Expanded URI:</label>
<div class="card read-only" id="preview">
<div class="card-body">
<pre class="preview">&nbsp;</pre>
</div>
</div>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary">Follow URI</button>
</div>
</form>
</div>
</form>
</div>
</script>


<script id="non-safe-request-template" type="text/template">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h3>Make a non-GET request</h3>
</div>

<form class="non-safe" action="<%= href %>">
<div class="modal-body">
<p>Target URI</p>
<input name="url" type="text" class="url" value="<%= href %>" />
<p>Method:</p>
<input name="method" type="text" class="method" value="POST" />
<p>Headers:</p>
<textarea name="headers" class="headers" style="height: 100px">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Make a NON-GET request</h5>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
</div>
<form class="non-safe" action="<%= href %>">
<div class="modal-body">
<label for="url">Target URI</label>
<input name="url" type="text" class="url form-control" id="url" value="<%= href %>" />
<label for="method">Method:</label>
<input name="method" type="text" class="method form-control" id="method" value="POST" />
<label for="headers">Headers:</label>
<textarea name="headers" class="headers form-control" style="height: 100px" id="headers">
Content-Type: application/json
<%= user_defined_headers %>
</textarea>
<p>Body:</p>
<textarea name="body" class="body" style="height: 200px">
</textarea>
<label for="body">Body:</label>
<textarea name="body" class="body form-control" style="height: 200px" id="body">
{

}
</textarea>
</div>

<div class="modal-footer">
<button type="submit" class="btn btn-primary">Make Request</button>
</textarea>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary">Make Request</button>
</div>
</form>
</div>
</div>
</form>
</script>

<script id="embedded-resources-template" type="text/template">
Expand All @@ -214,7 +238,7 @@ <h2>Embedded Resources</h2>
</div>
</script>

<script src="vendor/js/jquery-1.10.2.min.js"></script>
<script src="vendor/js/jquery-3.6.0.min.js"></script>
<script src="vendor/js/underscore.js"></script>
<script src="vendor/js/backbone.js"></script>
<script src="vendor/js/uritemplates.js"></script>
Expand Down Expand Up @@ -260,4 +284,4 @@ <h2>Embedded Resources</h2>

$('#pactBrokerHomeLink').attr('href', baseUrl); //pact_broker
</script>
</body>
</body>
4 changes: 2 additions & 2 deletions vendor/hal-browser/js/hal/http/client.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
HAL.Http.Client = function(opts) {
this.vent = opts.vent;
this.defaultHeaders = { 'Accept': 'application/hal+json, application/json, */*; q=0.01', 'X-Interface': 'HAL Browser' }; //pact_broker
this.defaultHeaders = { 'Accept': 'application/hal+json, application/json, */*; q=0.01' };
cookie = document.cookie.match('(^|;)\\s*' + 'MyHalBrowserToken' + '\\s*=\\s*([^;]+)');
cookie ? this.defaultHeaders.Authorization = 'Bearer ' + cookie.pop() : '';
this.headers = this.defaultHeaders;
Expand All @@ -23,7 +23,7 @@ HAL.Http.Client.prototype.get = function(url) {
headers: jqXHR.getAllResponseHeaders()
});
}
}).error(function() {
}).fail(function() {
self.vent.trigger('fail-response', { jqxhr: jqxhr });
});
};
Expand Down
2 changes: 1 addition & 1 deletion vendor/hal-browser/js/hal/views/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ HAL.Views.Browser = Backbone.View.extend({
this.inspectorView = new HAL.Views.Inspector({ vent: this.vent });
},

className: 'hal-browser row-fluid',
className: 'row',

render: function() {
this.$el.empty();
Expand Down
4 changes: 2 additions & 2 deletions vendor/hal-browser/js/hal/views/embedded_resource.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ HAL.Views.EmbeddedResource = Backbone.View.extend({

onToggleClick: function(e) {
e.preventDefault();
this.$accordionBody.collapse('toggle');
this.$accordionBody.toggle();
return false;
},

Expand Down Expand Up @@ -53,7 +53,7 @@ HAL.Views.EmbeddedResource = Backbone.View.extend({
$inner.append(embeddedResourcesView.el);
}

this.$accordionBody = $('<div class="accordion-body collapse"></div>');
this.$accordionBody = $('<div class="accordion-body"></div>');
this.$accordionBody.append($inner)

this.$el.append(this.$accordionBody);
Expand Down
2 changes: 1 addition & 1 deletion vendor/hal-browser/js/hal/views/explorer.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ HAL.Views.Explorer = Backbone.View.extend({
this.resourceView = new HAL.Views.Resource({ vent: this.vent });
},

className: 'explorer span6',
className: 'col-6',

render: function() {
this.navigationView.render();
Expand Down
2 changes: 1 addition & 1 deletion vendor/hal-browser/js/hal/views/inspector.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ HAL.Views.Inspector = Backbone.View.extend({
this.vent.bind('response', this.renderResponse);
},

className: 'inspector span6',
className: 'col-6',

render: function() {
this.$el.html(this.template());
Expand Down
Loading

0 comments on commit a6b06f6

Please sign in to comment.