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

dashing-peacock upgrade: dark is all dark #202

Closed
gerwitz opened this issue Apr 17, 2023 · 15 comments
Closed

dashing-peacock upgrade: dark is all dark #202

gerwitz opened this issue Apr 17, 2023 · 15 comments

Comments

@gerwitz
Copy link

gerwitz commented Apr 17, 2023

Doing a normal upgrade on my Akkoma instance to dashing-peacock (from wrestling-red-panda) resulted in dark mode rendering dark text on a dark background on most content, except the posts feed of an individual profile.

@gerwitz
Copy link
Author

gerwitz commented Apr 17, 2023

This is only partially visible when not logged-in: https://social.gerwitz.com/

@Cl0v1s
Copy link
Collaborator

Cl0v1s commented Apr 17, 2023

Hi !

What is your new version of Akkoma ?
Their new stricter Content-policy prevent third party frontend from retrieving instance configuration. Do you see something related to CSP in your browser logs ?

EDIT: yup, it's that
image

@Cl0v1s
Copy link
Collaborator

Cl0v1s commented Apr 17, 2023

The solution is to override the Content-policy header in your nginx/apache configuration, to allow style-src :)

https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP

@crisukbot
Copy link
Contributor

or, if you're lazy or don't want to bother with it, you can roll back the security policy update and everything will work.

https://akkoma.dev/AkkomaGang/akkoma/commit/336d06b2a8ca75362578b1d67ea1f32a45c8edd3

@Cl0v1s
Copy link
Collaborator

Cl0v1s commented Apr 18, 2023

If you choose the solution to edit your reverse proxy Content-Policy header, i'm interested in your solution, so I can add it to the Readme on here :)

@crisukbot
Copy link
Contributor

crisukbot commented Apr 18, 2023

If you choose the solution to edit your reverse proxy Content-Policy header, i'm interested in your solution, so I can add it to the Readme on here :)

I still haven't found the time to set up the content-policy, so I'm still using the solution I wrote before this.)

@AdrianPaulCarrieres
Copy link

AdrianPaulCarrieres commented Apr 23, 2023

I've never done this kind of stuff with nginx but so far my solution is to 1) hide the Content-Security-Policy header, 2) set it again with the copy pasted original header with a change in the style-src part:

    # add style-src for mangane
    proxy_hide_header Content-Security-Policy;
    add_header Content-Security-Policy "upgrade-insecure-requests;style-src 'self' 'unsafe-inline';font-src 'self';script-src 'self' 'nonce-LbVARBmXD6txCer';connect-src 'self' https://example.com wss://example.com;media-src 'self' https:;img-src 'self' data: blob: https:;default-src 'none';base-uri 'none';frame-ancestors 'none';manifest-src 'self';";

The change by itself is
style-src: 'self' 'nounce-xxxxxxxx';
becomes
style-src: 'self' 'unsafe-unline;'

@muppeth
Copy link
Contributor

muppeth commented Apr 28, 2023

Shouldn't akkoma permit mangane to work out ocf the box? Perhaps good to check with the main devs there @Cl0v1s
It would make things much easier. I will try to update csp for now as for people running OTP version rolling back isnt possible.

@Cl0v1s
Copy link
Collaborator

Cl0v1s commented May 6, 2023

Since they unilateraly changed this security setting, and do not seem to have any interest in supporting a frontend beside their own, I think we could just instead clearly explain how to override CSP in Mangane's documentation.

I'll try to propose something based on @AdrianPaulCarrieres's answer :)

@muppeth
Copy link
Contributor

muppeth commented May 6, 2023 via email

@Cl0v1s
Copy link
Collaborator

Cl0v1s commented May 7, 2023

I read that on some comments to a open issue in the Akkoma repo, but you're right, maybe their position changed since then !

@Cl0v1s
Copy link
Collaborator

Cl0v1s commented May 7, 2023

Readme updated

@Cl0v1s Cl0v1s closed this as completed May 13, 2023
@mmai
Copy link

mmai commented Jul 22, 2023

Hi @Cl0v1s there is a typo on the Readme : you wrote proxy_hide_header Content-Security-Policy: with a ':' instead of proxy_hide_header Content-Security-Policy; with a ';'

@Cl0v1s
Copy link
Collaborator

Cl0v1s commented Jul 26, 2023

Thanks, I fixed that !

@sadorowo
Copy link

sadorowo commented Mar 30, 2024

I've never done this kind of stuff with nginx but so far my solution is to 1) hide the Content-Security-Policy header, 2) set it again with the copy pasted original header with a change in the style-src part:

    # add style-src for mangane
    proxy_hide_header Content-Security-Policy;
    add_header Content-Security-Policy "upgrade-insecure-requests;style-src 'self' 'unsafe-inline';font-src 'self';script-src 'self' 'nonce-LbVARBmXD6txCer';connect-src 'self' https://example.com wss://example.com;media-src 'self' https:;img-src 'self' data: blob: https:;default-src 'none';base-uri 'none';frame-ancestors 'none';manifest-src 'self';";

The change by itself is style-src: 'self' 'nounce-xxxxxxxx'; becomes style-src: 'self' 'unsafe-unline;'

I used your method, the only difference is that I'm using Caddy instead of Nginx.
Unfortunately, header isn't returned with the response - and issue persists

My Caddyfile rule:

social.sador.me {
    log {
        output file /var/log/caddy/akkoma.log 
    }

    encode gzip
    reverse_proxy akkoma:4000

    header {
        Content-Security-Policy "upgrade-insecure-requests; script-src 'self'; connect-src 'self' blob: https://social.sador.me wss://social.sador.me; media-src 'self' https:; img-src 'self' data: blob: https:; default-src 'none'; base-uri 'self'; frame-ancestors 'none'; style-src 'self' 'unsafe-inline'; font-src
'self'; manifest-src 'self';"
    }
}

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

No branches or pull requests

7 participants