Skip to content

(PUP-9135) Treat task metadata referring to missing module as invalid #7083

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

Conversation

nicklewis
Copy link
Contributor

Previously, we were raising a ModuleNotFound error in the case where a task
depended on a file from another module that didn't exist. Raising that
error caused a failure that was difficult to debug (the task was treated as
simply not existing). In reality, this scenario is generally a problem with
the metadata just like any other metadata error. Because of that, we now
raise InvalidMetadata, which causes the actual error message to propagate
through puppet-server and orchestrator, to the client.

Additionally, this error message was vague and fairly unhelpful as it
didn't explain why it was trying to load that module in the first place.
That message has been improved.

(PUP-9135) Check for path traversal before checking file existence

Previously, we were checking whether the referred file existed before
checking whether it was a path traversal. This allowed a potential
disclosure of file existence, through the roundabout method of deploying
some task metadata using a path traversal to refer to a path of interest
and then attempting to run the task and checking the error message. We now
check for path traversal first, which also avoids checking it for every
separate file in a directory.

Previously, we were raising a ModuleNotFound error in the case where a
task depended on a file from another module that didn't exist. Raising
that error caused a failure that was difficult to debug (the task was
treated as simply not existing). In reality, this scenario is generally
a problem with the metadata just like any other metadata error. Because
of that, we now raise InvalidMetadata, which causes the actual error
message to propagate through puppet-server and orchestrator, to the
client.

Additionally, this error message was vague and fairly unhelpful as it
didn't explain *why* it was trying to load that module in the first
place. That message has been improved.
@nicklewis nicklewis force-pushed the PUP-9135-wrong-error-when-module-not-found branch from b13429d to 07637c3 Compare September 12, 2018 23:10
Copy link
Contributor

@MikaelSmith MikaelSmith left a comment

Choose a reason for hiding this comment

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

Tests failing.

@@ -63,11 +63,6 @@ def self.is_tasks_filename?(path)
end

def self.get_file_details(path, mod)

This comment was marked as resolved.

Previously, we were checking whether the referred file existed *before*
checking whether it was a path traversal. This allowed a potential
disclosure of file existence, through the roundabout method of deploying
some task metadata using a path traversal to refer to a path of interest
and then attempting to run the task and checking the error message. We
now check for path traversal *first*, which also avoids checking it for
every separate file in a directory.
@nicklewis nicklewis force-pushed the PUP-9135-wrong-error-when-module-not-found branch from 07637c3 to e9fed0a Compare September 12, 2018 23:53
@MikaelSmith
Copy link
Contributor

Merge when CI is green.

@nicklewis nicklewis merged commit d798621 into puppetlabs:master Sep 13, 2018
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