Code Monkey home page Code Monkey logo

Comments (6)

bt90 avatar bt90 commented on July 26, 2024

Something is fishy:

w.Header().Set("Content-Type", "application/javascript")

image

from syncthing.

bt90 avatar bt90 commented on July 26, 2024

Ah, this is apparently caused by /meta.js not being exempt from our authentication check. Maybe we need to add /meta.js here?

func isNoAuthPath(path string) bool {

At least the content doesn't look sensitive to me:

var metadata = {
    "authenticated": true,
    "deviceID": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    "deviceIDShort": "XXXXXX"
};

from syncthing.

calmh avatar calmh commented on July 26, 2024

I don't follow. There's nothing wrong with the content type. It's behind auth, as many other things. The OP's issue seems to be some proxy problem together with trying to interpret a retuned 403 error.

from syncthing.

bt90 avatar bt90 commented on July 26, 2024

The problem is that we're loading meta.js as regular frontend code:

<script type="text/javascript" src="meta.js"></script>

Once strict MIME type handling is enforced via X-Content-Type-Options: nosniff, this ends up as an error in the browser console.

Judging from a quick test, it doesn't break the UI even when X-Content-Type-Options: nosniff is added by a reverse-proxy. So it's more of an annoyance than a real bug and mostly not the cause of the problem observed by the user.

My proposal would be to exempt meta.js from authentication and instead populate its authenticated field dynamically:

syncthing/lib/api/api.go

Lines 717 to 721 in 6204670

meta, _ := json.Marshal(map[string]interface{}{
"deviceID": s.id.String(),
"deviceIDShort": s.id.Short().String(),
"authenticated": true,
})

from syncthing.

calmh avatar calmh commented on July 26, 2024

It doesn't break the UI at all as far as I can tell. There's an error in the console about it when you're not logged in, that's all. Potentially this could be nicer, perhaps we don't try to load the resource when not logged in, but I don't see a bug or problem here...

From what I can see in the forum thread the OP had some entirely unrelated problem with the proxy or their browser plugins and just latched onto this as the visible error in the console.

from syncthing.

bt90 avatar bt90 commented on July 26, 2024

From what I can see in the forum thread the OP had some entirely unrelated problem with the proxy or their browser plugins and just latched onto this as the visible error in the console.

Aye. nginx-proxy-manager has some interesting config bits:

https://github.com/NginxProxyManager/nginx-proxy-manager/blob/v2.11.1/docker/rootfs/etc/nginx/conf.d/include/assets.conf#L8-L9

from syncthing.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.