2 Commits
Author SHA1 Message Date
Thomas Vincent a4018f77cb hardening: [develop] confine package import/export paths and use a private temp directory (#8830)
* fix(package): confine package import and export paths and use a private temp directory

find_paths() confines an export to the scripts/ and resource/ subtrees, so
an unrelated in-tree file cannot be bundled into a signed package.  Package
import and export share package_private_tmpdir(), a mode 0700 working
directory with an unpredictable name, in place of the guessable, in one case
world-writable, directory used before.  The package diff view reads only the
scripts/ and resource/ subtrees, and import refuses to write a package file
through a symbolic link.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* fix(package): keep template export writing to the system temp directory

package_template() exports a signed template whose archive name is already
sanitised through clean_up_name() + basename(), so it was never the
predictable, per-user import directory this change hardens. Routing it through
package_private_tmpdir() changed the documented export location (/tmp) and
broke PackageArchiveTest, which pins the metadata-derived archive to /tmp.
Restore the original temp-directory selection; the private directory stays on
the import/extraction paths that were actually affected.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* fix(package): keep template export in the private temp directory

Reverting the export path to the shared /tmp location reintroduced a
predictable-filename temp-write weakness (CWE-377/CWE-59): the archive name
derives from caller metadata, so a local attacker could pre-plant a symlink at
the archive path and redirect the write. Export stays in package_private_tmpdir()
(mode 0700, unpredictable name); update the PackageArchive fixture to assert the
archive lands in that private directory while still proving the name comes from
the sanitised metadata and is independent of request fields.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* test(package): cover the import path-containment guards

Extract the package-file symlink refusal in import_package() into
import_write_blocked_by_symlink() so the guard can be exercised directly, and
add an executing test for it alongside a slice fixture that runs the real
package_diff_file() scripts/resource boundary. Drop the now-redundant per-call
mkdir block in form_actions() since package_private_tmpdir() already creates the
private directory. This brings the changed import/package lines under coverage.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* test(package): dispatch the diff-boundary probe under request coverage

The changed-line coverage gate collects request-coverage probes listed in
run_request_coverage.sh; a fixture that is only spawned from a unit test runs in
a child process whose statements the parent clover run never records. Register
the package_diff_file boundary fixture so a package_import.php change runs it
under Xdebug, and assert the dispatch in test_request_coverage_dispatch.py.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* chore(security): refresh the sink baseline for the removed import redirect

Simplifying form_actions() dropped a now-redundant header() redirect that the
tracked sink inventory still listed. Rebuild the baseline so the sink and
architectural hotspot guard matches the current source.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* test(package): verify the workspace across import operations

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

---------

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
2026-11-19 21:54:54 -05:00
Thomas Vincent 6254b2c17d fix(package): name template archives without export-form fields (#8431)
* fix(packaging): name archives from supplied metadata

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* fix(packaging): make archive leaf-name confinement explicit

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* test(e2e): move the pointer off the Deepness multiselect button

Deepness sets a zero body margin, so the unhovered #ms-button sits at the viewport origin and headless Chromium on Linux intermittently applies :hover to it.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* ci: pull pinned integration database from authenticated mirror

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

---------

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
2026-10-23 10:37:58 -06:00