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 Expression Function to Read File #166

Merged
merged 6 commits into from
Mar 19, 2024
Merged

Add Expression Function to Read File #166

merged 6 commits into from
Mar 19, 2024

Conversation

mfleader
Copy link
Member

@mfleader mfleader commented Mar 18, 2024

Changes introduced with this PR

  • Add a function to the expression language to read a file into a string, and return that string
  • Add unit tests

By contributing to this repository, I agree to the contribution guidelines.

@mfleader mfleader marked this pull request as ready for review March 18, 2024 22:17
Copy link
Contributor

@jaredoconnell jaredoconnell left a comment

Choose a reason for hiding this comment

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

Seems straightforward. It doesn't include any of our ideas for improving the security by pre-validating permission to access files outside of the working directory, but more prerequisites are required to make that work.

Let's see if Webb or Dave have any comments.

@webbnh webbnh self-requested a review March 18, 2024 23:31
Copy link
Contributor

@webbnh webbnh left a comment

Choose a reason for hiding this comment

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

On its face, the change looks good (except possibly for a nit or two).

I'm not sure what other constraints we want to place on file access. Is there a canonical list of permitted/disallowed locations that we should be checking?

fixtures/test-readFile/hello-world.yaml Outdated Show resolved Hide resolved
internal/builtinfunctions/functions.go Outdated Show resolved Hide resolved
@mfleader
Copy link
Member Author

mfleader commented Mar 18, 2024

I'm not sure what other constraints we want to place on file access. Is there a canonical list of permitted/disallowed locations that we should be checking?

That's a great question. I do not know what we should disallow.

@webbnh
Copy link
Contributor

webbnh commented Mar 19, 2024

I'm not sure what other constraints we want to place on file access. Is there a canonical list of permitted/disallowed locations that we should be checking?

That's a great question. I do not know what we should disallow.

We cannot enforce a policy which we do not have. Ship it! (Unless you want to tweak the nits, first....)

Copy link
Contributor

@webbnh webbnh left a comment

Choose a reason for hiding this comment

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

🚢

fixtures/test-readFile/hello-world.yaml Outdated Show resolved Hide resolved
Copy link

@dbutenhof dbutenhof left a comment

Choose a reason for hiding this comment

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

This is cool. I can't help wondering if it'd be useful to be able to read an object, e.g. from a YAML file, perhaps even with reference to a schema for validation; but even if that's desirable, it can wait.

@mfleader mfleader merged commit cdcbb0f into main Mar 19, 2024
5 checks passed
@mfleader mfleader deleted the fn-file-input branch March 19, 2024 15:31
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.

4 participants