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

Sos pmoravec dont obfuscate tmpdir path #2887

Merged

Conversation

pmoravec
Copy link
Contributor

Two commits preventing to apply cleaner obfuscation to the working directory path itself. Creating files or moving directories must happen within the (non-obfuscated) working dir.

The archive commit changes purpose of self._name variable from /var/tmp/sos.oq9ae6gj/sosreport-pmoravec-rhel8-2022-03-16-qzazpxi to just sosreport-pmoravec-rhel8-2022-03-16-qzazpxi. Since the full path is already captured in _archive_root variable.


Please place an 'X' inside each '[]' to confirm you adhere to our Contributor Guidelines

  • Is the commit message split over multiple lines and hard-wrapped at 72 characters?
  • Is the subject and message clear and concise?
  • Does the subject start with [plugin_name] if submitting a plugin patch or a [section_name] if part of the core sosreport code?
  • Does the commit contain a Signed-off-by: First Lastname email@example.com?
  • Are any related Issues or existing PRs properly referenced via a Closes (Issue) or Resolved (PR) line?

When writing down a private_map file local to a sosreport,
do cleanup of its filename but not its leading path (like
/var/tmp/).

Relevant: sosreport#2887

Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
@packit-as-a-service
Copy link

Congratulations! One of the builds has completed. 🍾

You can install the built RPMs by following these steps:

  • sudo yum install -y dnf-plugins-core on RHEL 8
  • sudo dnf install -y dnf-plugins-core on Fedora
  • dnf copr enable packit/sosreport-sos-2887
  • And now you can install the packages.

Please note that the RPMs should be used only in a testing environment.

When renaming the sosreport directory (inside the /var/tmp/sos.* working
directory), apply cleaner obfuscation to the sosreport directory but not
to the working directory path.

This is achieved by proper setting of FileCacheArchive._name that should
have the relative directory name only without the leading path.

Resolves: sosreport#2887

Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
@pmoravec pmoravec force-pushed the sos-pmoravec-dont-obfuscate-tmpdir-path branch from df10fe1 to ff07224 Compare March 17, 2022 08:25
@@ -135,6 +135,9 @@ class FileCacheArchive(Archive):
def __init__(self, name, tmpdir, policy, threads, enc_opts, sysroot,
manifest=None):
self._name = name
# truncate the name just relative to the tmpdir in case of full path
if os.path.commonprefix([self._name, tmpdir]) == tmpdir:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This condition is required due to TarFileArchive.add(testfile`) where we add files without their path.

@TurboTurtle TurboTurtle merged commit 938fefd into sosreport:main Mar 25, 2022
TurboTurtle pushed a commit that referenced this pull request Mar 25, 2022
When writing down a private_map file local to a sosreport,
do cleanup of its filename but not its leading path (like
/var/tmp/).

Relevant: #2887

Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
@pmoravec pmoravec deleted the sos-pmoravec-dont-obfuscate-tmpdir-path branch August 2, 2022 18:10
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.

None yet

2 participants