Commit Graph

4437 Commits

Author SHA1 Message Date
rugk 2c4dd2594c fix: do not encode source JSON translation string resulting in wrong display of special characters like '
Fixes #1712

Disclosure: Coded with help of Copiot. (description wrtten by me)

So this does indeed loosen the encoding a bit. However, IMHO, it was neither better before though. You could always bypass the encoding for `args{0]` when  you just include `<a` (or the other tag) somewhere or so.

**One important notice:** This was (due to the exceptions before and afterwards) valid before and also now: Translators **could** (and can) if they have malicious intent, inject/do "XSS attacks".
Thus, translations PRs (also from Crowdin) should be reviewed for wild HTML code inside translations. I suppose this is easy to fix, but anyway a valid risk.

But IMHO, we should teat the JSON files being part of our source code as a "trusted source". In the end, such an attak is basicaly just ends up being injecting malicious code. I hope such contributors would be detected.

References I explicitly checked again to not introduce an XSS here: https://cheatsheetseries.owasp.org/cheatsheets/Cross_Site_Scripting_Prevention_Cheat_Sheet.html and the PHP doc for he HTML encoding.

I feel the safter way obviously would be encoding the _whole_ string _after_ translation (just like you should apply DOMPurify after everything), but as explained it was not done before and would break compatibility. Also, I looked through the sources and I see no risk described by doing it only for the "dangerous" "untrusted" inputs.
Only here is a notice that `%s` shall not be used in some contexts, for example to define a tag: https://cheatsheetseries.owasp.org/cheatsheets/Cross_Site_Scripting_Prevention_Cheat_Sheet.html#dangerous-contexts (obviously in such a case, attacks may be possible even with encoding; but again; this is nothing new)

The basic "problem" of it all is: We want HTML to be translated/be usable in our translation. If we'd get rid of that, we would get for sure rid of all such XSS attack possibilities. But that woud be a bigger refactoring, so IMHO, this here is fine for a fix for the issue at hand.

Ah another point: I think the `is_int` check is harmless, but it's also kinda useless. Maybe it is some kind of obscure performance optimisation. (Yeah ints have nothing to encode as they have nothing that could be used for XSS, but they could also just be passed through that function.)
2025-11-13 10:52:08 +00:00
rugk 4cdc6871e7 docs: use CVE website link
Co-authored-by: El RIDO <elrido@gmx.net>
2025-11-13 10:35:49 +01:00
rugk 14ffbc68e2 Merge pull request #1698 from PrivateBin/ai/addCopilotInstructions
Add GitHub Copilot instructions
2025-11-13 09:36:15 +01:00
rugk 3ede063e0a Syncronize changelog with GitHub release doc (for CVE IDs)
Aka adding the CVE ID's. BTW GitHub will make the CVEs clickable automatically when published. As for the GitHub's own ID well yeah… I just kept it synchronous now. (Maybe it's not _that_ relevant to mention all that IDs.)
2025-11-12 20:42:05 +01:00
rugk f4216b34df Apply suggestions from code review
Co-authored-by: El RIDO <elrido@gmx.net>
2025-11-12 19:36:05 +01:00
rugk 10be6c25bf Merge pull request #1709 from PrivateBin/devcontainer/composer
Install PHP/composer unit testing dependencies globally for DevContainer
2025-11-12 15:37:38 +01:00
El RIDO d32ac29925 chore: prepare for next release 2025-11-12 08:51:05 +01:00
El RIDO 19ca6d3dab incrementing version 2.0.3 2025-11-12 08:00:50 +01:00
El RIDO f48544978b apply StyleCI suggestion 2025-11-12 07:57:30 +01:00
El RIDO 4434dbf73a Merge commit from fork
Fix arbitrary PHP file inclusion when enabling template switching
2025-11-12 07:54:10 +01:00
El RIDO bddfb173da Merge branch 'master' into advisory-fix-1 2025-11-12 07:47:43 +01:00
El RIDO f9550e5133 Merge commit from fork
Insert drag and drop file names as a text, not html
2025-11-12 07:46:35 +01:00
El RIDO 5b85d63942 Merge branch 'master' into advisory-fix-1 2025-11-12 07:18:43 +01:00
El RIDO e427458cd0 Merge branch 'master' into advisory-fix-1 2025-11-11 22:00:09 +01:00
rugk f9630e7e6c Add PHP composer global installation for DevContainer
Updated composer commands to require google/cloud-storage globally and optimized autoloader during update.

This helps with https://github.com/PrivateBin/PrivateBin/issues/1641 (but technically not solve it).
2025-11-11 20:02:36 +01:00
rugk 42df559d3c docs: update how to open
Co-authored-by: El RIDO <elrido@gmx.net>
2025-11-11 19:52:12 +01:00
Mikhail Romanov 1fbaba732e Merge pull request #1702 from PrivateBin/create_cloned_paste_error
fix: error fetching attachments from blob
2025-11-11 20:15:00 +02:00
Ribas160 08b3244314 privatebin.js SRI and CHANGELOG.md updated 2025-11-11 20:13:10 +02:00
Mikhail Romanov ff5aee85b4 Insert file names as break-separated text nodes
Co-authored-by: El RIDO <elrido@gmx.net>
2025-11-11 20:05:32 +02:00
El RIDO 2e11b13464 remove dead code 2025-11-11 17:56:49 +01:00
El RIDO c35fc4f790 use more straight forward in_array check
kudos @Ribas160 for the suggestion
2025-11-11 17:53:50 +01:00
El RIDO f456fb576e ensure template cookie cannot be a path 2025-11-11 17:52:48 +01:00
Ribas160 9c71fbcc70 Use pure JavaScript to create a div element 2025-11-11 17:45:27 +02:00
El RIDO a371f5cab5 remove dead code 2025-11-11 12:49:37 +01:00
El RIDO 51bb637411 document the change 2025-11-11 11:00:19 +01:00
El RIDO 94a854faca do add the configured template to the available ones, if missing 2025-11-11 10:59:55 +01:00
El RIDO ea73300e15 don't always set the cookie, having to unset it later
but still unset it, if it currently should not be in use (templateselection = false)
2025-11-11 09:45:51 +01:00
El RIDO be6a3702fc simplify logic and improve readability
function was only used in one place and only indirectly tested, so it could be inlined, which also makes the test for null and the extra variable allocation unnecessary
2025-11-11 09:43:41 +01:00
El RIDO f2164353c3 use realpath and validate tpl directory contents
to ensure only php files inside the tpl dir can get used as templates
2025-11-11 09:34:54 +01:00
El RIDO dae5f7fd61 partially revert #1559
Instead of automatically adding custom templates, we log an error if
that template is missing in the available templates. Still mitigates
arbitrary file inclusion, as the string is now checked against a fixed
allow list.
2025-11-10 17:31:35 +01:00
Ribas160 14b68af528 Insert drag and drop file names as a text, not html 2025-11-10 17:59:18 +02:00
El RIDO a479d75405 belt and braces: reset the template cookie, if function is not enabled 2025-11-10 12:25:19 +01:00
El RIDO 17ff44037a prevent use of paths in template names, only file names inside tpl directory are allowed 2025-11-10 12:23:50 +01:00
El RIDO 13949349af improve readability of logic 2025-11-10 12:22:29 +01:00
El RIDO 5f6c2beb3b Unit test on escaping the template directory 2025-11-10 12:00:29 +01:00
El RIDO 591d2d40e1 Merge pull request #1708 from calvinbui/patch-1
Fix typo in Shlink config docs
2025-11-09 07:46:23 +01:00
Calvin Bui ec178e0c38 Fix typo in Shlink config docs 2025-11-09 10:00:48 +11:00
PrivateBin Translator Bot 697753ab91 New Crowdin updates (#1706)
* New translations en.json (Lithuanian)
2025-11-08 06:00:28 +01:00
Ribas160 a7b253a43a fix: error fetching attachments from blob 2025-11-05 17:33:08 +02:00
El RIDO 5e10469ffc Merge pull request #1700 from HariZalanPrivateBin/master
Update hu.json
2025-11-05 07:45:54 +01:00
HariZalanPrivateBin feeac849c4 Update hu.json
My own translations currently used at privbin.harizalan.hu, enhanced at various points
2025-11-05 06:29:42 +01:00
rugk 4f64ad3b12 docs: remove wrong public dir advise
Co-authored-by: El RIDO <elrido@gmx.net>
2025-11-02 17:49:26 +01:00
rugk 46599af4f0 Add note about jQuery dropping
Co-authored-by: El RIDO <elrido@gmx.net>
2025-11-02 17:47:12 +01:00
El RIDO 0dd275db5c Merge pull request #1699 from PrivateBin/crowdin-translation
New Crowdin updates
2025-11-02 08:09:09 +01:00
PrivateBin Translator Bot cadfe65bfa New translations en.json (Finnish) 2025-11-01 12:52:40 +01:00
rugk baa0117028 wipfix: apply doc fixes from contributors 2025-10-30 15:11:16 +00:00
rugk 55fcca0f8d Add information about Composer dir 2025-10-30 13:21:59 +01:00
rugk 207c79057b Add GitHub Copilot instructions
As per discussion in https://github.com/orgs/PrivateBin/discussions/1696 here are some instructions generated by Copilot itself.

I used this prompt (in chat not agent mode, but well... should be enough) as suggested by GitHub: https://docs.github.com/copilot/how-tos/configure-custom-instructions/add-repository-instructions#anweisen-von-copilot-programmier-agent-zum-generieren-einer-copilot-instructionsmd-datei

Also added the feedback from the discussion.
2025-10-30 13:18:30 +01:00
El RIDO 9d7508f44f chore: prepare for next release 2025-10-28 16:54:42 +01:00
El RIDO 5018c963f9 chore: prepare for next release 2025-10-28 16:53:07 +01:00