You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Server no longer warns when accessing a URL out of scope #1148
When you start the server with npm start -- -b http://example.com/ and go to http://localhost:3000/ you will get a 401: Not logged in error. Preferably you should get the error that we specifically made for this. I'm guessing that at some point the architecture changed so that the function that throws this error is not being called any more before checking authorization.
What is the expected behavior for this check when using subdomains? E.g. the test suite test\integration\Subdomains.test.ts fails when implementing a strict check on whether the request URL base matches the configured CSS baseUrl. I can extend the check to also allow subdomains of the configured baseUrl, but this could lead to the server failing to provide the expected warning in some scenarios (even with the check)
How is the baseUrl supposed to be configured when using subdomains and how do you expect the OriginalUrlExtractor to deal with this for these type of out-of-scope warnings/errors?
Good point. Adding a baseUrl to the class is actually not the solution but I didn't realize that with your previous question. What you need to do is what happens in the code linked above. To do that you need to pass an IdentifierStrategy as input parameter (instead of a baseUrl) and then call strategy.supportsIdentifier. To make your life easier, the identifier of the default strategy is urn:solid-server:default:IdentifierStrategy in the config. When starting up a server with a subdomain config a different a different strategy is used which solves your problem.
Oh right, the second part of the issue description also makes a lot more sense now (I thought you were referencing the type of error to throw). Thanks for the input!
Reopening as I just discovered this fix does not work as intended. The OriginalUrlExtractor triggers before the accept headers are parsed, meaning that the thrown error will never be converted to HTML. Currently you will always get a plain text response when you trigger this error, even in the browser.
The solution might be to split off the preference parsing from the rest of the RequestParser, or get those to the error handler in some other way as this is not the first time it is unfortunate those headers are only parsed later.
Activity
fix: Server no longer warns when accessing a URL out of scope #1148
test: updating unit tests for OriginalUrlExtractor, added test that c…
wkerckho commentedon Apr 6, 2022
What is the expected behavior for this check when using subdomains? E.g. the test suite
test\integration\Subdomains.test.tsfails when implementing a strict check on whether the request URL base matches the configured CSS baseUrl. I can extend the check to also allow subdomains of the configured baseUrl, but this could lead to the server failing to provide the expected warning in some scenarios (even with the check)How is the baseUrl supposed to be configured when using subdomains and how do you expect the
OriginalUrlExtractorto deal with this for these type of out-of-scope warnings/errors?jvherweg commentedon Apr 6, 2022
Good point. Adding a
baseUrlto the class is actually not the solution but I didn't realize that with your previous question. What you need to do is what happens in the code linked above. To do that you need to pass anIdentifierStrategyas input parameter (instead of abaseUrl) and then callstrategy.supportsIdentifier. To make your life easier, the identifier of the default strategy isurn:solid-server:default:IdentifierStrategyin the config. When starting up a server with a subdomain config a different a different strategy is used which solves your problem.wkerckho commentedon Apr 6, 2022
Oh right, the second part of the issue description also makes a lot more sense now (I thought you were referencing the type of error to throw). Thanks for the input!
fix: Server no longer warns when accessing a URL out of scope #1148
test: updated tests broken by #1148 fix
fix: Throw error when accessing URLs out of scope
jvherweg commentedon Apr 8, 2022
Fixed in #1257
jvherweg commentedon May 10, 2022
Reopening as I just discovered this fix does not work as intended. The
OriginalUrlExtractortriggers before the accept headers are parsed, meaning that the thrown error will never be converted to HTML. Currently you will always get a plain text response when you trigger this error, even in the browser.The solution might be to split off the preference parsing from the rest of the
RequestParser, or get those to the error handler in some other way as this is not the first time it is unfortunate those headers are only parsed later.jvherweg commentedon Jun 1, 2022
Done in #1314