Skip to content
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

Add manifest and input arg validation to pm.release_package() #1237

Merged
merged 1 commit into from
Feb 8, 2019

Conversation

njgheorghita
Copy link
Contributor

What was wrong?

More validation in pm.release_package() would be useful to prevent mix-ups between on-registry data and data actually in the manifest, and prevent pushing invalid manifest to your registry

How was it fixed?

  • Added validation to pm.release_package() that the manifest uri is a valid content-addressed (IPFS/github) URI.
  • Add checks that given package_name and version match what's stored in the manifest

Cute Animal Picture

image

web3/pm.py Outdated
if (
not is_ipfs_uri(manifest_uri) and
not is_valid_content_addressed_github_uri(manifest_uri)
):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've avoided multi-line if statements via the following convention.

is_something = (
    <multi-line-statement
)
if is_something:
    ...

web3/pm.py Outdated
not is_ipfs_uri(manifest_uri) and
not is_valid_content_addressed_github_uri(manifest_uri)
):
raise PMError(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like this should be some sort of ValidationError type error. The base library error is normally not used directly, but rather designed to be a way for someone to catch any library error from py-ethpm

@njgheorghita njgheorghita force-pushed the pm-api-validation branch 2 times, most recently from 3805420 to 9a89f71 Compare February 8, 2019 01:37
@njgheorghita njgheorghita merged commit 29790ca into ethereum:master Feb 8, 2019
@njgheorghita njgheorghita deleted the pm-api-validation branch February 8, 2019 02:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants