Arc Forumnew | comments | leaders | submitlogin
2 points by akkartik 5 hours ago | link | parent | on: About lobste.rs

I'll invite you.
2 points by zck 8 hours ago | link | parent | on: About lobste.rs

I've never signed up for lobste.rs. Could I get an invite? What do you need to invite me? (email in profile)
2 points by i4cu 12 hours ago | link | parent | on: About lobste.rs

> I don't believe so.

I shouldn't post in the middle of the night... of course it's many-to-many... I was attempting to say I don't believe it will be a problem.

The rest of my comment should hold true.

2 points by i4cu 18 hours ago | link | parent | on: About lobste.rs

> Tags imply a many-to-many relationship.

I don't believe so, but it depends on what relationships and queries you have in mind.

I think you just need to maintain an index of story ids for each tag then alter the page list code to check each story against chosen tag indexes in order to apply custom filters. And you will also need to bypass the page caching operations for these filtered pages (just given the number of combinations that are possible).

Obviously db capabilities would make it (and everything else) much better, but it's not a showstopper.

4 points by i4cu 1 day ago | link | parent | on: Inline JavaScript

> What's needed is the ability to pass custom headers from the application to srv.arc

There is the possibility of just putting the CSP into a meta tag within the page header, but I didn't suggest that because not all CSP options are available when using the meta tag.

I think you're right in that being able to dynamically add headers is the right way to go. When I moved from arc to clojure I did this by implementing something like arc templates [1] and used them to pass attributes through to the server ops. I ended up with a 'defop' like call that took an options hash-map argument (i.e. a template instance) which then generated the headers dynamically (with built in sane defaults).

1. http://arclanguage.github.io/ref/template.html

> A lot of that can be removed altogether by removing the table layout and just using a basic grid...

Yeah the whole thing should get HTML5-alived. CSS, JS and web-standards have evolved significantly since the app was originally written.

3 points by i4cu 1 day ago | link | parent | on: Inline JavaScript

Strict CSP settings are a form of whitelisting what js, css etc, is valid thus protecting from injection. Inline code for both js and css can't be whitelisted like header items can be so they will fail (unless you use the hash code hack mentioned for js).

Css is vulnerable too (since at least 2009):

https://scarybeastsecurity.blogspot.com/2009/12/generic-cros...

"By controlling a little bit of text in the victim domain, the attacker can inject what appears to be a valid CSS string. It does not matter what proceeds this CSS string: HTML, binary data, JSON, XML. The CSS parser will ruthlessly hunt down any CSS constructs within whatever blob is pulled from the victim's domain...."

Furthermore:

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

"A policy needs to include a default-src or script-src directive to prevent inline scripts from running, as well as blocking the use of eval() . A policy needs to include a default-src or style-src directive to restrict inline styles from being applied from a <style> element or a style attribute."

So it's just the 'style' attribute people worry about and strict CSP manages.

2 points by hjek 1 day ago | link | parent | on: Algolia HN Search source

Has anyone used this with Anarki, ever?
3 points by hjek 1 day ago | link | parent | on: Inline JavaScript

> 4. All inline style attributes need to be removed and changes to news.css or news.js will need to be made in order to compensate.

Wat. Wow, browsers today! Is CSS vuln by default? Is that really necessary?

3 points by krapp 1 day ago | link | parent | on: About lobste.rs

Tags imply a many-to-many relationship, don't they? How difficult would that be to do efficiently in News, without a proper relational database?
3 points by krapp 1 day ago | link | parent | on: Inline JavaScript

>srv.arc needs the addition of a Content-Security-Policy header for server ops (with the appropriate settings).

What's needed is the ability to pass custom headers from the application to srv.arc (or maybe app.arc) since CSP headers would be application specific. Unfortunately, unless I'm wrong, it looks like header generation is baked into srv.arc.

> All inline style attributes need to be removed and changes to news.css or news.js will need to be made in order to compensate. i.e. stuff like this:

A lot of that can be removed altogether by removing the table layout and just using a basic grid. There's no reason the forum has to be pixel-perfect. This would have the added benefit of letting us get rid of a lot of hacky one-off table macros in html.arc.

2 points by i4cu 1 day ago | link | parent | on: About lobste.rs

I like the invitation tree concept. I plan to do that with one of my apps, but I think I would have to add that feature well after I obtain a decent user base.
3 points by i4cu 1 day ago | link | parent | on: Inline JavaScript

In order for the News app to have a CSP and be strict about it, you would need to:

1. Remove the inline js. This means the votelink code (votejs) needs to be moved from news.arc and put into an external file (news.js?) that is linked to as a file within the header.

2. The inline onclicks need to change. The onclick values have to be actual function pointers not strings and given Arc has no built in js functionality that likely means removing them completely. Instead you will need to have a js call in the new 'news.js' file that does document.addEventListener with the 'DOMContentLoaded' argument along with a function that finds all the relevant doms for a given page and adds listeners to each that will trigger the votejs code.

3. srv.arc needs the addition of a Content-Security-Policy header for server ops (with the appropriate settings).

4. All inline style attributes need to be removed and changes to news.css or news.js will need to be made in order to compensate. i.e. stuff like this:

   (div style "margin-top:1px;margin-bottom:0px")
edit #1. note that adding the hash code referred to (or even the 'nonce' option) is a hack intended to provide short term relief to production environments until proper changes can be implemented.

edit #2. regarding point 4 I believe (but not absolutely sure of) that all the inline font, color, font-size tags are a problem too. i.e. It's any tagged string value that will be interpreted by the browsers css engine. If anyone can confirm this, please do. Either way, none of that stuff is HTML 5 compliant and probably should be removed anyway.

2 points by hjek 1 day ago | link | parent | on: Self-hosting the Anarki community

Looks like banned IPs are written to the disk even:

    (def set-ip-ban (user ip yesno (o info))
      (= (banned-ips* ip) (and yesno (list user (seconds) info)))
      (todisk banned-ips*))
3 points by i4cu 2 days ago | link | parent | on: Self-hosting the Anarki community

Looks as though it ranks how bad you are and always keeps the baddest of the bad-asses in cache, while never deleting any from disk. In a low volume site like this I doubt you'll get out of it without contacting them.
2 points by akkartik 2 days ago | link | parent | on: Self-hosting the Anarki community

Hmm, I wonder if it stays banned until they restart the server. I'd ping hn@ycombinator.com.
2 points by hjek 2 days ago | link | parent | on: Self-hosting the Anarki community

Amazing you managed to get your IP banned!

Hacker News has an IP unpanning procedure[0] but I don't think Arc Forum has one.

In the Arc 3.1 code there is a function `set-ip-ban` for unbanning users, but no `unban` op.

(Someone should add that to Anarki, actually.)

[0]: https://news.ycombinator.com/item?id=4761102

3 points by shader 2 days ago | link | parent | on: Self-hosting the Anarki community

Anyone know how long an IP stays banned? Or what I can do about it? Rather inconvenient not to be able to check the forum from home...

I suppose I could set up a proxy or something. And I was planning on scraping everything to a new community site anyway, so maybe I should take this as the incentive to do so.

3 points by i4cu 8 days ago | link | parent | on: Advanced search for news.arc

As I understand it - the 'Open Source' movement concerns itself with improving the software by making the code openly accessible, where as the 'Free Software' movement concerns itself with a fighting for users rights (i.e. having the freedom to access, modify and distribute the code in a manner that empowers the user).

And so, an 'Open Source' repository holds code that is openly accessible for the purpose of improving the software. Where as an 'Ethical Repository' holds code that is graded by its' ability to guarantee users rights according to a specific set of morals (established by free software foundation). It so happens that open source repos tend to align well the ethics associated with free-software, but they should not be mistaken for each other. As an example to illustrate: If a repo SaaS were built for open source code, but restricted users from a certain country it wouldn't rank high in ethical repository grading. This is because while having the code openly accessible leans towards a Grade A rating (excellent), the restricting some users part puts it at a Grade F rating (unacceptable).

-- additional info --

https://en.wikipedia.org/wiki/Open-source_software

"Despite initially accepting it,[31] Richard Stallman of the FSF now flatly opposes the term "Open Source" being applied to what they refer to as "free software". Although he agrees that the two terms describe "almost the same category of software", Stallman considers equating the terms incorrect and misleading.[32] Stallman also opposes the professed pragmatism of the Open Source Initiative, as he fears that the free software ideals of freedom and community are threatened by compromising on the FSF's idealistic standards for software freedom.[33] The FSF considers free software to be a subset of open-source software, and Richard Stallman explained that DRM software, for example, can be developed as open source, despite that it does not give its users freedom (it restricts them), and thus doesn't qualify as free software.[34]"

1 point by hjek 8 days ago | link | parent | on: Advanced search for news.arc

I think free (or "open source") and ethical mean the same in most cases.

Exceptions might include something like Facebook, which is technically somehow usable w/o non-free JS when using their basic mobile web page, but where the company is still engaging in other unethical activities, like selling user data to sway elections.

Or something like Amazon, where you might possibly be able to buy something w/o non-free JS (haven't checked), but where the treatment of their employees is unacceptable.

But, I think, when we're talking git hosting sites, there's no difference?

But FSF considers Gitlab ethical enough for hosting GNU packages[0].

[0]: https://www.fsf.org/news/gnu-releases-ethical-evaluations-of...

2 points by i4cu 9 days ago | link | parent | on: Advanced search for news.arc

I'm pretty sure it would be similar to ad-blockers. The initial implementations are trivial and easily circumvented, but as they evolve they become more useful overall.

Plus note that I was just suggesting that it would be more effective than a social movement with 'ethical repositories'. Just imagine if the ad-blocker devs tried the same strategy...

1 point by krapp 9 days ago | link | parent | on: Advanced search for news.arc

It seems like the thesis here is that whether or not "non-trivial" Javascript (which is just about all Javascript in the wild) should be trusted depends on the presence of an explicit GPL license. If so, that doesn't seem like a reliable heuristic for a script blocker to me.
2 points by i4cu 9 days ago | link | parent | on: Advanced search for news.arc

Actually, I got the notion from Stallman's original post 'The Javascript Trap' [1].

"Finally, we need to change free browsers to detect and block nontrivial nonfree JavaScript in web pages. The program LibreJS detects nonfree, nontrivial JavaScript in pages you visit, and blocks it. LibreJS is included in IceCat, and available as an add-on for Firefox."

However I am opposed to that call for action given it's an all-or-none implementation. I feel it's the role of each country to regulate, which is why I expressly suggested it as a configuration option (ideally it could be enforced at the browser level country by country and if not then user by user).

1. https://www.gnu.org/philosophy/javascript-trap.html

2 points by hjek 9 days ago | link | parent | on: Advanced search for news.arc

> IMO; If they really wanted to make a dent, they should push for a regulation requiring that browsers provide functionality that enforces a free-software configuration OPTION.

Sounds interesting. Apart from the regulation part, it sounds a bit like LibreJS[0].

[0]: https://www.gnu.org/software/librejs/

2 points by hjek 9 days ago | link | parent | on: Advanced search for news.arc

Good question. I'm not sure, but I think it may have to do with removing Gravatar support?
3 points by zck 9 days ago | link | parent | on: With and withs

Similarly to this, when I'm writing Java, I use `final`^1 everywhere I can. It's nice to be able to know that anywhere later where the variable declared final is in scope, it will have the same value as at the point it's set. I don't need to look through any code to see if it's rebound; I know it hasn't been.

[1] "final" is kind of like "const", if I understand `const` right. `final int x = 3;` means that it is an error to later have the line of code `x = 4;`.

3 points by prestonbriggs 10 days ago | link | parent | on: With and withs

OK, I get it, thanks. In scheme, I would use letrec for this situation; my intuition for Arc isn't very well developed.
4 points by akkartik 10 days ago | link | parent | on: With and withs

I actually tend to the opposite: use with everywhere unless I need withs. The reason isn't performance. It tends to make code more elegant to not rely on the order in which things are defined. And when I'm reading code, with gives me the warm fuzzies that the code is going to be cleaner. When I see withs I slow down to look at the dependencies between the bindings.
3 points by kostas 10 days ago | link | parent | on: With and withs

Look at the definition of with and withs at https://github.com/arclanguage/anarki/blob/master/arc.arc

The macro definition of with creates a function with all the names as inputs and the body of the with as the body of the function. The newly created function is called with the definitions of each name, which are effectively in independent namespaces.

The withs definition, however; recursively calls itself so that each succeeding name sees the definitions of previous names.

I believe the difference is historically due to higher speed of with. In modern programming it probably makes sense to use withs everywhere and only change to with in places where optimization is necessary.

3 points by akkartik 10 days ago | link | parent | on: With and withs

Try running without your code.

    arc> (help get)
    [fn]  (get i)
    Returns a function to pass 'i' to its input.
    Useful in higher-order functions, or to index into lists, strings, tables, etc.
    Examples:
      arc> (get.2 '(1 2 3 4))
      3
      arc> (get!b (obj a 10 b 20))
      20
      arc> (get.9 sqrt)
      3
      arc> (map get.2
                '((a b c)
                  (1 2 3)
                  (p q r)))
      (c 3 r)
    nil

    arc> (help set)
    [mac] (set . args)
    Sets each place in 'args' to t.
    nil
These are the functions you end up calling because your dispatch can't see the earlier get and set bindings.
1 point by prestonbriggs 10 days ago | link | parent | on: With and withs

I should have given more info. If, while using "with", I type

  (= a (test))
things look good. But if I then type

  (a!get)
arc complains

  Error: " get: arity mismatch;\n the expected number of arguments does not match the given number\n  expected: 1\n  given: 0"
Adding to the general confusion, if I type

  (a!set 1)
arc complains

  Error: "Function call on inappropriate object #(tagged mac #<procedure: set>) (1)"
More