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

file upload api #4

Merged
merged 2 commits into from
Nov 6, 2024
Merged

file upload api #4

merged 2 commits into from
Nov 6, 2024

Conversation

metachris
Copy link
Contributor

No description provided.

@@ -7,7 +7,8 @@ import (
)

type SystemAPIConfig struct {
Actions map[string]string
Actions map[string]string

Choose a reason for hiding this comment

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

does this also require toml:"actions" too similar to the file_uploads?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the default works

log.Debug("Content read from payload", "content", string(content))

// 2. write content to file
err = os.WriteFile(filename, content, 0o600)

Choose a reason for hiding this comment

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

I wonder if we should also provide read access to the 'others' and 'groups' as well because the uploaded file in our case should be readable by the rbuilder, right?
The system-api process is executed from the root user, hence rbuilder user won't be able to read the content.
We could also later iterate more on this to add like a mapping such as tuple of (filename,ownership) which would write the content and assign the file ownership to the correct user.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good point! updated to 644

@MoeMahhouk
Copy link

MoeMahhouk commented Nov 6, 2024

It looks good to me but I have a question regarding authorization. Where are we restricting the call of such request to only the operator ? Are we handling this in the system-api code or is it through the other reverse proxies?

@metachris
Copy link
Contributor Author

@MoeMahhouk API access is restricted at the firewall level by the operator. The operator is responsible for opening up access to this port not to the public.

@metachris metachris merged commit 7871ca9 into main Nov 6, 2024
2 checks passed
@metachris metachris deleted the file_upload branch November 6, 2024 13: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.

3 participants