This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | var React = require("react"); |
||
2 | |||
3 | var DeployKeyTest = React.createClass({ |
||
4 | |||
5 | getInitialState: function() { |
||
6 | return { |
||
7 | loading: false, |
||
8 | tested: false, |
||
9 | canAccessRepo: this.props.initialCanAccessRepo |
||
10 | }; |
||
11 | }, |
||
12 | |||
13 | testAccess: function() { |
||
14 | this.setState({ loading: true }); |
||
15 | $.ajax({ |
||
16 | url: this.props.deployKeyTestUrl, |
||
17 | dataType: 'json', |
||
18 | cache: false, |
||
19 | type: 'GET', |
||
20 | success: function(data) { |
||
21 | this.setState({ |
||
22 | loading: false, |
||
23 | tested: true, |
||
24 | canAccessRepo: data.canAccessRepo |
||
25 | }); |
||
26 | }.bind(this), |
||
27 | error: function() { |
||
28 | this.setState({ |
||
29 | loading: false, |
||
30 | tested: true, |
||
31 | canAccesRepo: false |
||
32 | }); |
||
33 | }.bind(this) |
||
34 | }); |
||
35 | }, |
||
36 | |||
37 | handleTestAccess: function(e) { |
||
38 | e.preventDefault(); |
||
39 | this.testAccess(); |
||
40 | }, |
||
41 | |||
42 | button: function() { |
||
43 | var buttonText = { __html: 'Test Access' }; |
||
44 | var buttonDisabled = false; |
||
45 | var buttonClass = 'btn btn-primary'; |
||
46 | if (!this.props.deployKey) { |
||
47 | buttonDisabled = true; |
||
48 | buttonClass = 'btn'; |
||
49 | } else if (this.state.loading) { |
||
50 | buttonText = { __html: '<i class="fa fa-cog fa-spin"></i> Attempting to clone repository...' }; |
||
51 | buttonDisabled = true; |
||
52 | } else if (this.state.canAccessRepo) { |
||
53 | buttonText = { __html: '<i class="fa fa-check"></i> We can access your repository' }; |
||
54 | buttonDisabled = true; |
||
55 | buttonClass = 'btn btn-success'; |
||
56 | } |
||
57 | |||
58 | var msg; |
||
59 | if (this.state.tested && !this.state.canAccessRepo && !this.state.loading) { |
||
60 | msg = ( |
||
61 | <p className='alert alert-danger'> |
||
62 | We're having trouble accessing your repository. |
||
63 | </p> |
||
64 | ); |
||
65 | } |
||
66 | |||
67 | var button = ( |
||
68 | <button |
||
0 ignored issues
–
show
introduced
by
![]() |
|||
69 | href="#" |
||
70 | className={buttonClass} |
||
71 | onClick={this.handleTestAccess} |
||
72 | disabled={buttonDisabled} |
||
73 | dangerouslySetInnerHTML={buttonText} |
||
0 ignored issues
–
show
|
|||
74 | > |
||
75 | </button> |
||
76 | ); |
||
77 | |||
78 | return ( |
||
79 | <div> |
||
80 | {msg} |
||
81 | {button} |
||
82 | </div> |
||
83 | ); |
||
84 | }, |
||
85 | |||
86 | render: function() { |
||
87 | |||
88 | var key = null; |
||
89 | |||
90 | if (this.props.deployKey) { |
||
91 | key = ( |
||
92 | <textarea |
||
93 | className="vert readonly deploy-key" |
||
94 | rows="6" |
||
95 | readOnly |
||
96 | defaultValue={this.props.deployKey} |
||
97 | /> |
||
98 | ); |
||
99 | } else { |
||
100 | key = ( |
||
101 | <div className="alert alert-error"> |
||
102 | Something bad happened and we were not able to create your deploy key - support has been alerted. |
||
103 | Please contact the helpdesk if the key does not appear on your stack page soon. |
||
104 | </div> |
||
105 | ); |
||
106 | } |
||
107 | |||
108 | var deployKeyHelp = null; |
||
109 | if (this.props.repoInterface === 'Github') { |
||
110 | deployKeyHelp = ( |
||
111 | <p> |
||
112 | <i className="fa fa-github"></i> |
||
113 | <a href="https://developer.github.com/guides/managing-deploy-keys/#deploy-keys"> |
||
114 | Deploy key help |
||
115 | </a> |
||
116 | </p> |
||
117 | ); |
||
118 | } else if (this.props.repoInterface === 'Bitbucket') { |
||
119 | deployKeyHelp = ( |
||
120 | <p> |
||
121 | <i className="fa fa-bitbucket"></i> |
||
122 | <a href="https://confluence.atlassian.com/bitbucket/use-deployment-keys-294486051.html"> |
||
123 | Deploy key help |
||
124 | </a> |
||
125 | </p> |
||
126 | ); |
||
127 | } else if (this.props.repoInterface === 'Gitlab') { |
||
128 | deployKeyHelp = ( |
||
129 | <p> |
||
130 | <img |
||
131 | src="deploynaut/img/gitlab.png" |
||
132 | alt="Gitlab" |
||
133 | className="gitlab-icon" |
||
134 | /> |
||
135 | <a href="http://doc.gitlab.com/ce/ssh/README.html#deploy-keys"> |
||
136 | Deploy key help |
||
137 | </a> |
||
138 | </p> |
||
139 | ); |
||
140 | } else { |
||
141 | deployKeyHelp = ( |
||
142 | <ul className="list-inline"> |
||
143 | <li><i className="fa fa-github"></i> |
||
144 | <a href="https://developer.github.com/guides/managing-deploy-keys/#deploy-keys"> |
||
145 | Github |
||
146 | </a> |
||
147 | </li> |
||
148 | <li> |
||
149 | <i className="fa fa-bitbucket"></i> |
||
150 | <a href="https://confluence.atlassian.com/bitbucket/use-deployment-keys-294486051.html"> |
||
151 | Bitbucket |
||
152 | </a> |
||
153 | </li> |
||
154 | <li> |
||
155 | <img src="deploynaut/img/gitlab.png" alt="Gitlab" className="gitlab-icon" /> |
||
156 | <a href="http://doc.gitlab.com/ce/ssh/README.html#deploy-keys"> |
||
157 | Gitlab |
||
158 | </a> |
||
159 | </li> |
||
160 | </ul> |
||
161 | ); |
||
162 | } |
||
163 | |||
164 | return ( |
||
165 | <div className="add-deploy-key"> |
||
166 | <h2>One more thing...</h2> |
||
167 | <div className="row"> |
||
168 | <div className="col-md-6 col-md-offset-3"> |
||
169 | <p> |
||
170 | Whilst your environments are being built, please ensure we can |
||
171 | access your private repositories by adding the deploy key below and testing access. |
||
172 | </p> |
||
173 | {deployKeyHelp} |
||
174 | </div> |
||
175 | </div> |
||
176 | <div className="col-md-8 col-md-offset-2 text-left" id="deploy-key-test-holder"> |
||
177 | {key} |
||
178 | </div> |
||
179 | <div className="row"> |
||
180 | <div className="col-md-8 col-md-offset-2"> |
||
181 | {this.button()} |
||
182 | </div> |
||
183 | </div> |
||
184 | </div> |
||
185 | ); |
||
186 | }, |
||
187 | |||
188 | }); |
||
189 | |||
190 | module.exports = DeployKeyTest; |
||
191 |