-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: Final URL to managed access manifests is broken (#3922, #3328) #3931
Fix: Final URL to managed access manifests is broken (#3922, #3328) #3931
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #3931 +/- ##
===========================================
+ Coverage 81.97% 81.99% +0.01%
===========================================
Files 124 124
Lines 15150 15149 -1
===========================================
+ Hits 12419 12421 +2
+ Misses 2731 2728 -3
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another reason for adding a second commit is that the present commit doesn't resolve (#3328) AFAICT, so I am unsure it is accurate to reference it in this form in the commit or the PR tittle.
3f1d66d
to
479785a
Compare
54142bb
to
e0a29cf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
479785a
to
5444a57
Compare
e0a29cf
to
6521f09
Compare
6521f09
to
7e6b614
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this leaves the source code in a bit of a confusing state. With this surgical approach, the service still goes through all the motions of actually listing the accessible sources in the controller and populating the filter object with the result even though the wrong credentials are used to request the listing.
Maybe this makes it more clear
Index: src/azul/service/source_controller.py
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/azul/service/source_controller.py b/src/azul/service/source_controller.py
--- a/src/azul/service/source_controller.py (revision 7e6b6143b13fc42cd9ed60dd76d70fd52ad68950)
+++ b/src/azul/service/source_controller.py (date 1648084946401)
@@ -54,7 +54,7 @@
def get_filters(self,
catalog: CatalogName,
- authentication: Authentication,
+ authentication: Optional[Authentication],
filters: Optional[str] = None
) -> MutableFilters:
return MutableFilters(explicit=self._parse_filters(filters),
Index: src/azul/service/manifest_controller.py
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/azul/service/manifest_controller.py b/src/azul/service/manifest_controller.py
--- a/src/azul/service/manifest_controller.py (revision 7e6b6143b13fc42cd9ed60dd76d70fd52ad68950)
+++ b/src/azul/service/manifest_controller.py (date 1648084888573)
@@ -107,10 +107,10 @@
token = query_params.get('token')
if token is None:
format_ = ManifestFormat(query_params['format'])
- filters = self.get_filters(catalog, authentication, query_params.get('filters'))
try:
object_key = query_params['objectKey']
except KeyError:
+ filters = self.get_filters(catalog, authentication, query_params.get('filters'))
object_key, manifest = self.service.get_cached_manifest(format_=format_,
catalog=catalog,
filters=filters,
@@ -128,6 +128,10 @@
}
token = self.async_service.start_generation(state)
else:
+ # FIXME: Add support for long-lived API tokens
+ # https://github.com/DataBiosphere/azul/issues/3328
+ assert authentication is None, authentication
+ filters = self.get_filters(catalog, authentication, query_params.get('filters'))
try:
manifest = self.service.get_cached_manifest_with_object_key(
format_=format_,
But check the Optional[Authentication]
change and look for more places where that is wrong.
Squash the FIXME commit and the main commit. The Optional[Authentication]
changes should be a separate commit.
7e6b614
to
2ad65f9
Compare
01fb85d
to
4aacfd5
Compare
976e358
to
0ec35e3
Compare
I'm assuming the intention is for me to be assigned. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Index: src/azul/service/manifest_service.py
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/azul/service/manifest_service.py b/src/azul/service/manifest_service.py
--- a/src/azul/service/manifest_service.py (revision 4885cf2f20167ff2039f547f8b6a9221861331fe)
+++ b/src/azul/service/manifest_service.py (date 1649120207370)
@@ -451,12 +451,15 @@
catalog,
filters,
authentication)
- current_source_key = generator.compute_source_key()
- manifest_key, source_key, extension = object_key.rsplit('/', 1)[-1].split('.')
- # FIXME: Add support for long-lived API tokens
- # https://github.com/DataBiosphere/azul/issues/3328
- if False and source_key != current_source_key:
- raise CachedManifestSourcesChanged
+ # FIXME: Add support for long-lived API tokens
+ # https://github.com/DataBiosphere/azul/issues/3328
+ if False:
+ current_source_key = generator.compute_source_key()
+ # FIXME: Consolidate parsing of manifest object key
+ # REVIEW: insert link to ticket
+ manifest_key, source_key, extension = object_key.rsplit('/', 1)[-1].split('.')
+ if source_key != current_source_key:
+ raise CachedManifestSourcesChanged
file_name = self._get_cached_manifest_file_name(generator, object_key)
if file_name is None:
raise CachedManifestNotFound
@@ -918,6 +921,8 @@
timestamp = datetime.now().strftime("%Y-%m-%d %H.%M")
file_name = f'{file_name_prefix} {timestamp}.{self.file_name_extension}'
else:
+ # FIXME: Consolidate parsing of manifest object key
+ # REVIEW: insert link to ticket
file_name = 'hca-manifest-' + object_key.rsplit('/', )[-1]
return file_name
Index: src/azul/service/manifest_controller.py
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/azul/service/manifest_controller.py b/src/azul/service/manifest_controller.py
--- a/src/azul/service/manifest_controller.py (revision 4885cf2f20167ff2039f547f8b6a9221861331fe)
+++ b/src/azul/service/manifest_controller.py (date 1649120524595)
@@ -133,8 +133,7 @@
if authentication is None:
filters = self.get_filters(catalog, authentication, query_params.get('filters'))
else:
- raise BadRequestError(f'Authentication is not accepted when using the `objectKey` parameter. '
- f'Recieved authentication {authentication.as_http_header()}')
+ raise BadRequestError("Must omit authentication when passing 'objectKey'")
try:
manifest = self.service.get_cached_manifest_with_object_key(
format_=format_,
filters = self.get_filters(catalog, authentication, query_params.get('filters')) | ||
else: | ||
raise BadRequestError(f'Authentication is not accepted when using the `objectKey` parameter. ' | ||
f'Recieved authentication {authentication.as_http_header()}') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably shouldn't include the token in the response body.
4885cf2
to
7705de0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the two commits
9ef5a72
to
93762d2
Compare
Connected issue: #3922
Checklist
Author
1 when the issue title describes a problem, the PR title is
Fix:
followed by the issue titleAuthor (reindex)
r
tag to commit title or this PR does not require reindexingreindex
label to PR or this PR does not require reindexingAuthor (chains)
chain
label to the blocking PR or this PR is not chained to another PRAuthor (upgrading)
u
tag to commit title or this PR does not require upgradingupgrade
label to PR or this PR does not require upgradingAuthor (hotfixes)
h
tag to commit title and PR targetsprod
or this PR does not include a temporary hotfixH
tag to commit title or this PR does not include a permanent hotfixhotfix
label to PR or this PR does not include a hotfixprod
branchAuthor (requirements, before every review)
make requirements_update
or this PR does not touch requirements*.txt, common.mk, Makefile and DockerfileR
tag to commit title or this PR does not touch requirements*.txtreqs
label to PR or this PR does not touch requirements*.txtAuthor (before every review)
make integration_test
passes in personal deployment or this PR does not touch functionality that could break the ITdevelop
, squashed old fixupsPrimary reviewer (after approval)
demo
orno demo
no demo
no sandbox
Operator (before pushing merge the commit)
reindex
label andr
commit title tagno demo
sandbox
label or PR is labeledno sandbox
no sandbox
sandbox
or this PR does not require reindexingsandbox
sandbox
or this PR does not require reindexingsandbox
Operator (after pushing the merge commit)
N reviews
labelling is accurate or this PR is authored by leadprod
orMerged prod
or this PR does not represent a promotionOperator (reindex)
Operator
Shorthand for review comments
L
line is too longW
line wrapping is wrongQ
bad quotesF
other formatting problem