@suffolklitlab/alkiln 4.11.0 → 4.11.2

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.
package/CHANGELOG.md CHANGED
@@ -40,6 +40,18 @@ Format:
40
40
  -->
41
41
  <!-- ## [Unreleased] -->
42
42
 
43
+ ## [4.11.2] - 2023-03-22
44
+ ### Security
45
+ - Pass docassemble API keys through HTTP headers instead of as parameters.
46
+ - ACTION: all users should delete any uWSGI logs that show their API keys.
47
+ - Parameters to certain HTTP requests are printed directly in docassemble's
48
+ uWSGI log, leaking API keys to actors with log access on your docassemble
49
+ server.
50
+
51
+ ## [4.11.1] - 2023-03-21
52
+ ### Changed
53
+ - Get error data from server errors
54
+
43
55
  ## [4.11.0] - 2023-03-13
44
56
  ### Changed
45
57
  - Shorten Axios errors to make them more readable (https://github.com/SuffolkLITLab/ALKiln/pull/632)
@@ -19,15 +19,15 @@ da.get_dev_id = async function ( timeout ) {
19
19
  /* Get docassemble developer id. */
20
20
  let options = {
21
21
  method: 'GET',
22
+ headers: {'X-API-Key': session_vars.get_dev_api_key()},
22
23
  url: `${ session_vars.get_da_server_url() }/api/user`,
23
- params: { key: session_vars.get_dev_api_key(), },
24
24
  timeout: timeout,
25
25
  };
26
26
 
27
27
  try {
28
28
  return await axios.request( options );
29
29
  } catch (error) {
30
- throw error.toJSON();
30
+ throw {...error.toJSON(), data: error.response?.data};
31
31
  }
32
32
  }; // Ends da.get_dev_id()
33
33
 
@@ -37,9 +37,9 @@ da.create_project = async function ( project_name, timeout ) {
37
37
  /* Create a new project on the user's da server. */
38
38
  let options = {
39
39
  method: 'POST',
40
+ headers: {'X-API-Key': session_vars.get_dev_api_key()},
40
41
  url: `${ session_vars.get_da_server_url() }/api/playground/project`,
41
42
  data: qs.stringify({
42
- key: session_vars.get_dev_api_key(),
43
43
  project: project_name,
44
44
  }),
45
45
  timeout: timeout,
@@ -48,7 +48,7 @@ da.create_project = async function ( project_name, timeout ) {
48
48
  try {
49
49
  return await axios.request( options );
50
50
  } catch (error) {
51
- throw error.toJSON();
51
+ throw {...error.toJSON(), data: error.response?.data};
52
52
  }
53
53
  }; // Ends da.create_project()
54
54
 
@@ -58,9 +58,9 @@ da.pull = async function ( timeout ) {
58
58
  /* Pull github code into an existing Project. */
59
59
  let options = {
60
60
  method: 'POST',
61
+ headers: {'X-API-Key': session_vars.get_dev_api_key()},
61
62
  url: `${ session_vars.get_da_server_url() }/api/playground_pull`,
62
63
  data: qs.stringify({
63
- key: session_vars.get_dev_api_key(),
64
64
  project: session_vars.get_project_name(),
65
65
  github_url: session_vars.get_repo_url(),
66
66
  branch: session_vars.get_branch_name(),
@@ -71,7 +71,7 @@ da.pull = async function ( timeout ) {
71
71
  try {
72
72
  return await axios.request( options );
73
73
  } catch (error) {
74
- throw error.toJSON();
74
+ throw {...error.toJSON(), data: error.response?.data};
75
75
  }
76
76
  }; // Ends da.pull()
77
77
 
@@ -81,9 +81,9 @@ da.has_task_finished = async function ( task_id, timeout ) {
81
81
  /* Check task status based on `task_id`. */
82
82
  let options = {
83
83
  method: 'GET',
84
+ headers: {'X-API-Key': session_vars.get_dev_api_key()},
84
85
  url: `${ session_vars.get_da_server_url() }/api/restart_status`,
85
86
  params: {
86
- key: session_vars.get_dev_api_key(),
87
87
  task_id: task_id,
88
88
  },
89
89
  timeout: timeout,
@@ -92,7 +92,7 @@ da.has_task_finished = async function ( task_id, timeout ) {
92
92
  try {
93
93
  return await axios.request( options );
94
94
  } catch (error) {
95
- throw error.toJSON();
95
+ throw {...error.toJSON(), data: error.response?.data};
96
96
  }
97
97
  }; // Ends da.has_task_finished()
98
98
 
@@ -102,9 +102,9 @@ da.delete_project = async function ( timeout ) {
102
102
  /* Delete a project on the user's da server. */
103
103
  let options = {
104
104
  method: 'DELETE',
105
+ headers: {'X-API-Key': session_vars.get_dev_api_key()},
105
106
  url: `${ session_vars.get_da_server_url() }/api/playground/project`,
106
107
  params: {
107
- key: session_vars.get_dev_api_key(),
108
108
  project: session_vars.get_project_name(),
109
109
  },
110
110
  timeout: timeout,
@@ -113,7 +113,7 @@ da.delete_project = async function ( timeout ) {
113
113
  try {
114
114
  return await axios.request( options );
115
115
  } catch (error) {
116
- throw error.toJSON();
116
+ throw {...error.toJSON(), data: error.response?.data};
117
117
  }
118
118
  }; // Ends da.delete_project()
119
119
 
@@ -132,9 +132,9 @@ da.__delete_projects_starting_with = async function ( base_name, starting_num=1,
132
132
 
133
133
  let options = {
134
134
  method: 'DELETE',
135
+ headers: {'X-API-Key': session_vars.get_dev_api_key()},
135
136
  url: `${ session_vars.get_da_server_url() }/api/playground/project`,
136
137
  params: {
137
- key: session_vars.get_dev_api_key(),
138
138
  project: project_name,
139
139
  },
140
140
  timeout: 30 * 1000,
@@ -142,7 +142,7 @@ da.__delete_projects_starting_with = async function ( base_name, starting_num=1,
142
142
 
143
143
  await axios.request( options );
144
144
  } catch ( error ) {
145
- console.log( error.toJSON() )
145
+ console.log( {...error.toJSON(), data: error.response?.data});
146
146
  }
147
147
  name_incrementor++;
148
148
  }
@@ -222,7 +222,7 @@ da_i.loop_to_create_project = async function( creation_options ) {
222
222
 
223
223
  } catch ( error ) {
224
224
  // TODO: Make a `normalize_ajax_responses_and_errors()`?
225
- let response = error.response;
225
+ let response = error;
226
226
 
227
227
  if ( response && response.data ) {
228
228
  if ( response.data.includes( `Invalid project` ) ) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suffolklitlab/alkiln",
3
- "version": "4.11.0",
3
+ "version": "4.11.2",
4
4
  "description": "Integrated automated end-to-end testing with docassemble, puppeteer, and cucumber.",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {