uc3-dmp-id 0.0.11 → 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5d939c9632627e8210c03f3d0e6a6c742076540d401fd6cb8d20a18fe5007f93
4
- data.tar.gz: 3a9b9367c66ff23fe7c710a1ee7cc0fcf29ffa0ebc3eb6861e2ca3ffa7959ab7
3
+ metadata.gz: 7305cd9930a1eb2f2feb56fa439ef8ebfc95ce5550184f81801989b570b9e56e
4
+ data.tar.gz: dafe80d52cb7ef18b1dc63c15708955eb8abb608bace639d29df2cbcd96e0aaf
5
5
  SHA512:
6
- metadata.gz: 0a03ba8fab35515ca126b39fc7ec140823eaa250e560c300bf3d6621a30ddf710a8410ed48d096aac743f037899a84e158c4ddeccccd9c603204d4c6b6570180
7
- data.tar.gz: 9ae9ed3c91002df747860dae714b86de88be6e1d5f2d7fdfe24d57fb391fc1fc144bc9c903b23cb6b55c6debb96bdf6744858c18bf77bfbeb89628ccea325a30
6
+ metadata.gz: 2b14d04b52398da535ef787b15e5f883f9fdf93a6adb1adf34c5e82c459f13c40f481fb214bb17f770502e06a8fe67e3a6692359a2a8e96a5a6918dcd2e134c3
7
+ data.tar.gz: 3c9eded9447bc3fd9a4b3f2168bc289d812b5b1613a86e4e407ba83ad402be23ca4fd01d113373e93f23c951d1d96d36d6b75863cbad14be27c47376cc9f2ebc
@@ -60,18 +60,26 @@ module Uc3DmpId
60
60
  def by_pk(p_key:, s_key: Helper::DMP_LATEST_VERSION, client: nil, debug: false)
61
61
  raise Uc3DmpIdFinderError, MSG_MISSING_PK if p_key.nil?
62
62
 
63
- s_key = Helper::DMP_LATEST_VERSION if s_key.nil? || s_key.strip.empty?
63
+ s_key = Helper::DMP_LATEST_VERSION if s_key.nil? || s_key.to_s.strip.empty?
64
+
65
+ puts "PK: #{p_key}, SK: #{s_key}"
64
66
 
65
67
  client = client.nil? ? Uc3DmpDynamo::Client.new(debug: debug) : client
66
68
  resp = client.get_item(
67
69
  key: {
68
70
  PK: Helper.append_pk_prefix(p_key: p_key),
69
- SK: s_key.nil? || s_key.strip.empty? ? Helper::DMP_LATEST_VERSION : s_key
71
+ SK: s_key
70
72
  }
71
73
  )
72
- return nil if resp.nil? || resp.fetch('dmp', {})['PK'].nil?
74
+ return resp unless resp.is_a?(Hash)
75
+
76
+ puts "FETCHED:"
77
+ puts resp
78
+
79
+ dmp = resp['dmp'].nil? ? JSON.parse({ dmp: resp }.to_json) : resp
80
+ return nil if resp['dmp']['PK'].nil?
73
81
 
74
- _append_versions(p_key: resp['dmp']['PK'], dmp: resp, client: client, debug: debug)
82
+ _append_versions(p_key: resp['dmp']['PK'], dmp: dmp, client: client, debug: debug)
75
83
  end
76
84
 
77
85
  # Attempt to find the DMP item by the provenance system's identifier
@@ -92,10 +100,13 @@ module Uc3DmpId
92
100
  }
93
101
  client = client.nil? ? Uc3DmpDynamo::Client.new(debug: debug) : client
94
102
  resp = client.query(**args)
95
- return resp if resp.nil? || resp['dmp'].nil?
103
+ return resp unless resp.is_a?(Hash)
104
+
105
+ dmp = resp['dmp'].nil? ? JSON.parse({ dmp: resp }.to_json) : resp
106
+ return nil if resp['dmp']['PK'].nil?
96
107
 
97
108
  # If we got a hit, fetch the DMP and return it.
98
- by_pk(p_key: resp['dmp']['PK'], s_key: resp['dmp']['SK'])
109
+ by_pk(p_key: dmp['dmp']['PK'], s_key: dmp['dmp']['SK'])
99
110
  end
100
111
  # rubocop:enable Metrics/AbcSize
101
112
 
@@ -106,10 +117,16 @@ module Uc3DmpId
106
117
  def _append_versions(p_key:, dmp:, client: nil, debug: false)
107
118
  return dmp if p_key.nil? || !dmp.is_a?(Hash) || dmp['dmp'].nil?
108
119
 
120
+ puts "FETCHING VERSIONS"
121
+
109
122
  results = versions(p_key: p_key, client: client, debug: debug)
110
123
  return dmp unless results.length > 1
111
124
 
112
- versions = results.map do |version|
125
+ versions = results.map do |ver|
126
+
127
+ puts version
128
+
129
+ version = ver['dmp'].nil? ? JSON.parse({ dmp: ver }.to_json) : ver
113
130
  next if version.fetch('dmp', {})['modified'].nil?
114
131
 
115
132
  timestamp = version['dmp']['modified']
@@ -119,6 +136,10 @@ module Uc3DmpId
119
136
  }
120
137
  end
121
138
  dmp['dmp']['dmphub_versions'] = JSON.parse(versions.to_json)
139
+
140
+ puts "AFTER APPENDING VERSIONS:"
141
+ puts dmp
142
+
122
143
  dmp
123
144
  end
124
145
  # rubocop:enable Metrics/AbcSize
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Uc3DmpId
4
- VERSION = '0.0.11'
4
+ VERSION = '0.0.13'
5
5
  end
@@ -0,0 +1,73 @@
1
+
2
+ WAF analysis
3
+ ===========================================================
4
+
5
+ AWS#AWSManagedRulesCommonRuleSet#NoUserAgent_HEADER
6
+ Action: REMOVE THIS RULE? I feel like this one will cause more harm then good
7
+ Blocking: /
8
+ /plans/98982
9
+ /nuclei.svg?fc9dz=x (about 100 times!)
10
+ /v1/metadata/private-networks
11
+ /latest/meta-data/
12
+ /computeMetadata/v1/project/
13
+ /dynamic/instance-identity/document
14
+ /openstack/latest
15
+ /metadata/v1.json
16
+ /opc/v1/instance
17
+
18
+ AWS#AWSManagedRulesCommonRuleSet#SizeRestrictions_BODY
19
+ Action: Add exclusion for this specific path!
20
+ Blocking: /Shibboleth.sso/SAML2/POST
21
+
22
+ AWS#AWSManagedRulesAdminProtectionRuleSet#AdminProtection_URIPATH
23
+ Action: Add exceptions for [/org/admin/, /org_admin/, /super_admin/, /paginable/plans/org_admin]. The others are
24
+ all illegitimate so we want to block them.
25
+ Blocking: /org/admin/users/98307/admin_update_permissions
26
+ /org/admin/users/admin_index
27
+ /paginable/plans/org_admin/[page]?[query_params]
28
+ /org_admin/plans
29
+ /org/admin/543/admin_edit
30
+ /org/admin/users/admin_index
31
+ /org/admin/guidance/2163/admin_update
32
+ /org_admin/templates/1967/phases/2144/sections/11313
33
+ /org/admin/17/admin_edit
34
+ /super_admin/users/77446/merge
35
+
36
+ /admin/
37
+ /admin/phpMyAdmin/server_import.php
38
+ /phpMyAdmin/server_import.php
39
+ /admin/pma/server_import.php
40
+ /miscadmin
41
+ /admin/server_import.php
42
+ /backend/admin/users?username=anonymous
43
+ /phpmyadmin/server_import.php
44
+ /admin/install.php
45
+ /admin/install/install.php
46
+ /wp-admin/install.php
47
+ /solr/admin/
48
+ /Admin/frmWelcome.aspx
49
+ /boaform/admin/formLogin?username=user&psd=user
50
+
51
+
52
+ AWS#AWSManagedRulesCommonRuleSet#UserAgent_BadBots_HEADER
53
+ Actions: Block them
54
+ Blocking: /public_templates?[query_params]
55
+ /robots.txt
56
+ /aab8
57
+ /aaa9
58
+ /dmptool-ui/SourceSans3VF-Italic.ttf.fd20af5b.woff2
59
+ /dmptool-ui/SourceSans3VF-Roman.ttf.99aa17fb.woff2
60
+ /assets/application-4551ebb71fffa2b6d576438af0e66620a4e84cb8431cdd25889e191eed0fae66.js
61
+
62
+ AWS#AWSManagedRulesAmazonIpReputationList#AWSManagedReconnaissanceList
63
+ Actions: Block them
64
+ Blocking: /
65
+ /.env
66
+ /header.php
67
+
68
+ AWS#AWSManagedRulesCommonRuleSet#CrossSiteScripting_BODY
69
+ Actions: Add exception for /answers/create_or_update (or better yet address it)
70
+ Blocking: /answers/create_or_update?question_id=17592
71
+ /content/crx/de/setPreferences.jsp;%0A.html?keymap=<svg/onload=confirm(document.domain)>//a&language=en
72
+ /7/0/33/1d/www.citysearch.com/search?what=x&where=place%22%3E%3Csvg+onload=confirm(document.domain)%3E
73
+ /etc/designs/xh1x.childrenlist.json//%3Csvg%20onload=alert%28document.domain%29%3E.html
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uc3-dmp-id
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Riley
@@ -127,6 +127,7 @@ files:
127
127
  - lib/uc3-dmp-id/validator.rb
128
128
  - lib/uc3-dmp-id/version.rb
129
129
  - lib/uc3-dmp-id/versioner.rb
130
+ - lib/uc3-dmp-id/waf_analysis_2023-06-05.txt
130
131
  homepage: https://github.com/CDLUC3/dmp-hub-cfn/blob/main/src/sam/gems/uc3-dmp-id
131
132
  licenses:
132
133
  - MIT